algorithmic modeling for Rhino
hi, I am trying to develop a component with c # .I need to do this :
1- create a first layer in rhino
2-Create a second layer in rhino
3- the output "A " baked in the first layer
4-the output "B " baked in the second layer
I don't know if it is possible to do this in my component and how ?
Note : "Bake" this is the function that exists when we do right click
thank you SAWSAN
Tags:
string ln1 = "layername1"; //the layername
int lay1 = RhinoDocument.Layer.Find(ln1, false);
if(lay1 < 0)
lay1 = RhinoDocument.Layer.Add(ln1, Color.Black);
So now you have your Layer...now you can add your geometry to rhino and set this layer as attribute to the object.
Rhino.DocObjects.ObjectAttributes att = new Rhino.DocObjects.ObjectAttributes();
att.LayerIndex = lay1;
RhinoDocument.Objects.AddCurve(somecrv, att);
This is how it works basically...question: why do you need this? there are several existing solutions that work pretty well. I've lastly made a collection of scripts with basically all options available for bake: take a look at http://www.grasshopper3d.com/group/fabtools
Cheers
FF
hi Florian ,
thank you for your reply
but there is an error : RhinoDocument does not exist in the current context !!
string default_name = doc.Layers.CurrentLayer.Name;
please I have problem visual studio does not know "doc" although I added the RhinoCommon.dll !!
This script only works in a c# script component...
in visual Studio you have to instantiate the rhinodocument
doc or RhinoDocument reference to Rhino.RhinoDoc.ActiveDoc. So either instantiate both:
RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc;
RhinoDoc RhinoDocument = Rhino.RhinoDoc.ActiveDoc;
but better change the variable name of RhinoDocument to doc. You can also replace doc and RhinoDocument and call directly Rhino.RhinoDoc.ActiveDoc.Layers ... ect.
Hi Florian ,
when the type is "List<Point3d> "
How do I change this :
RhinoDocument.Objects.AddCurve(somecrv, att);
it can be :
doc.Objects.AddPoint (....,att) ://
same case when I have " List<Curve>"
Always my layer is empty ://
thank you
1) doc.Objects.AddPoints(yourlist, att);
2) foreach(Curve c in yourlist)
doc.Objects.AddCurve(c, att);
and start reading the SDK ;-)
http://4.rhino3d.com/5/rhinocommon/html/AllMembers_T_Rhino_DocObjec...
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
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by