Failed to set material for construction line

I know there’s a method of ‘materials=’ for ConstructionLine object, but I found that this method has no effect after execution.

mod = Sketchup.active_model
material = mod.materials.first
line = mon.selection.first # ConstructionLine object
line.material = material # => return material
line.material # => return nil

Anyone know why’s that?

There is a box in the Style Modeling window to choose a material for Guides. It appears that this overrides any material you attempt to assign via the Ruby API.

So try …

mod.rendering_options["ConstructionColor"]= mod.materials.first.color

This method will set all the construction lines to the same color, but I want set color for some specific construction lines.

So is it a bug?

That’s arguable - it is probably working as designed, but not how you want it to work.

No, if you try to manually set the color with the PaintBucket tool, you’ll see the cursor change to a not allowed cursor over the Guide line. Also if you select the guide and look at the Entity Info panel, you’ll see that there are no material swatches.

So in reality, the API should have removed the #material and #material= methods from the ConstructionLine and ConstructionPoint subclasses. (We might consider it an API Issue.)

The only way I have found to have different guide colors is to have the guide assigned to use different tags (layers) that have differing colors and then use the Color By Tag rendering option.


I see, thanks so much!