algorithmic modeling for Rhino
I need to access a component which has been written in GHpython in my loop And feed its input and evaluate its output,
The python class file is accessible either
I searched and ended up with adding python class in VS with .NET4 . but i need to work with C# script component inside GH.(its much easier to debug)
-----------------------------------------------------------------------------
1.How can I access component or load its class that has written in python in myC# script component?
2.The component is Laydbug that use sticky for communicate between its sub components .
Could I access s.th like sticky in C#?
thanks in advance for your help
Tags:
I will not test this definition right now but it should also be relatively easily possible.
Basically you put everything you want to do ("statements") in the first string, and then the last string contains what you want to get ("expression"). The result of the expression is then transferred to C#.
@"import scriptcontext as sc
tst2 = sc.sticky[""testclass""](7,8)",
"tst2.area()"
Otherwise you can also make it all into one line,
"import scriptcontext as sc"
and
"sc.sticky[\"testclass\"](7,8).area()"
So, do as you wish. :)
Let me know if this helps,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
with this simple class it worked :)
m_ps.EvaluateExpression("import scriptcontext as sc\n" +
"tst3= sc.sticky[\"testclss\"](7,8)", "tst3.area()");
I'll check it out tomorrow. Yes, sorry, you would have to put the literal value (like 7).
m_ps.EvaluateExpression(@"import scriptcontext as sc
tst2=sc.sticky[""testclass""](7,8)",
"tst2.area()");
(fixed above)
with simple definition that input could change to string it will work but for other definition that need other object type as input how could I feed them?
in GHpython script we make an instance of what sticky refers in main class
so we can easily feed them;
but in C# I dont know if its possible ?
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by