Grasshopper

algorithmic modeling for Rhino

I found that I can bake curves like this

ObjectAttributes attr = RhinoDocument.CreateDefaultAttributes();

doc.Objects.AddCurve(curve, attr);

and I found here that the ObjectAttributes class has a property LinetypeIndex, and I guessed I could change that property to bake the curve with different line types, but I haven't found which value corresponds to each line type. It has -1 by default, and I tried with values like 0, 1, 2... but I don't see any effect when I bake the curve. I wish someone could help me with this.

Views: 479

Replies to This Discussion

The LinetypeIndex refers to the LineTypeTable in the loaded 3dm file. If you pick an index which doesn't exist you'll see no linetypes. However even if you pick an index which does exist it still depends on the display mode whether or not the dashes are visible instead of the solid curve. Try toggling the _PrintDisplay command to see if it's just a matter of Rhino display.

Thanks for answering.

I checked the document properties and it has some linetypes by default

Then I did this

ObjectAttributes attr = RhinoDocument.CreateDefaultAttributes();

attr.LinetypeIndex = doc.Linetypes.Find("Puntos", true);

doc.Objects.AddCurve(curve, attr);

but it doesn't have any effect (the value of doc.Linetypes.Find("Puntos", true) is 5). When I see the properties of the curve, in the linetype it says by layer.

When I bake the curve to a layer with this

ObjectAttributes attr = RhinoDocument.CreateDefaultAttributes();

attr.LayerIndex = doc.Layers.Find("Layer01", true);

doc.Objects.AddCurve(curve, attr);

it does it right, but when I change the linetype, it doesn't do it.

Make sure you also set the LinetypeSource property to be ObjectLinetypeSource.LinetypeFromObject, otherwise it will continue to use the by-layer setting. 

It worked. Thanks a lot.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service