Can't seem to assign Linetype when baking

In communications they say that the “Last Mile” to the customer is the hardest problem to solve. In GH maybe that should be Baking. All the fancy parametric design doesn’t matter at all if you can’t get it into the Rhino model.

I have some parametrically derived geometry that I need to bake onto various Layers in specific Colors and Linetypes. I have set up the layers in the Rhino document and in GH I am making the layer assignments. I have had bad luck (no luck really) baking to specific layers and I am stuck here:

I can successfully filter the layer table and pull the specific Color and LT for the Layer I want to bake the geometry to, but I can’t figure out how to get it to Bake that way.

On the right, in the approach on the top using Define Object Attributes, the Geometry bakes to that layer but it ignores the Dots linetype the layer is set to and Bakes as Continuous. It even REASSIGNS that layer to Continuous ! Don’t want that.

The approach below it that uses CreateAttributes just throws the error message “1. Something went wrong. Please double-triple check your data tree structures to see if they all line up”.

In both cases the same Geometry - a set of about 23 simple 2D arcs - is what is being Baked. What am I doing wrong?

Most probably you don’t assign the source of the linetype for the lines you draw. by baking you create an object and give the object some attributes like on which layer it is. with these attributes you don’t really change the layer’s linetype, but the objects linetype. however, if your line takes it’s linetype from the layer and not from the object, the linetype will stay the same as the layers.

i got you a simple c# file that should do the trick for you: (10.1 KB)

hope this helps


Wow, Thanks, I’ll give that a try!

Sorry, Ben, the version I downloaded doesn’t have the LT input that the one you posted the image of. How do I get that into that component?

argh, my desktop has too many items that look alike: (10.1 KB)

sorry for the confusion

That seems to work, Ben. Thanks very much!

1 Like

you’re welcome!
please mark the thread as solved if this works for you:)

btw, here the version where you actually change the layers linetype,in case this suits your needs better: (7.6 KB)

Well NOT fixed yet…

The pic below shows some arcs baked with GH using the above component to set the LT to Dots. Its clearly not Dots.

The diagonal line is drawn in Rhino on the same layer which is set to Dots. It is corrrect.

Why are they different? Does GH have its own set of LTs that are completely different from those in Rhino? All I really want to do is bake the GH geometry using the LT setting of the target layer, but this never seems to work for me.


I think I see the problem - I am not a C# coder but your C# code seems to be hard-coded to set the LT as DashDot instead of reading the input to LT. How do I fix that?

      int layerIndex = doc.Layers.FindName(L, RhinoMath.UnsetIntIndex).Index;
      //set attributes
      Rhino.DocObjects.ObjectAttributes att = new Rhino.DocObjects.ObjectAttributes();
      att.Name = "AjourCutter";
      att.LayerIndex = layerIndex;
      att.LinetypeIndex = doc.Linetypes.Find("DashDot");
      att.LinetypeSource = Rhino.DocObjects.ObjectLinetypeSource.LinetypeFromObject;

      //bake with attributes
      RhinoDocument.Objects.AddCurve(C, att);
      //RhinoDocument.Objects.AddBrep(B, att);


what a stupid error…sorry about that. indeed where “DashDot” is written, LT should be written.
replace the line:

att.LinetypeIndex = doc.Linetypes.Find("DashDot");


att.LinetypeIndex = doc.Linetypes.Find(LT);

so sorry about that. it’s been late

Thank you!