Cubic colored grid
-
I downloaded the cubic colored grid ruby from the Ruby Library Depot. From the description given, the color of each grid section is suppossed to match the axis it is on. Mine are all black. I went into the ruby and found:
group.material = Sketchup;;Color.new(255, 0, 0) #----------------------------------------------------------------------------- Duplicates 2D grid model.start_operation "Duplicate 3D grid" pis2 = 1.5707963267948965 transfo = Geom;;Transformation.rotation( [0,0,0], Geom;;Vector3d.new(1, 0, 0), pis2) new_group = group.copy new_group.material = Sketchup;;Color.new(0, 255, 0) new_group.move!(transfo) transfo = Geom;;Transformation.rotation( [0,0,0], Geom;;Vector3d.new(0, -1, 0), pis2) new_group = group.copy new_group.material = Sketchup;;Color.new(0, 0, 255) new_group.move!(transfo)
I thought I had figured out that this type of line
Sketchup;;Color.new(255, 0, 0)
shows the color used (255) and, because the number moves its location in the sequence, WHERE it is used. When I tried to change 255 to a different color (chosen from the Materials menu) all it did was turn the grid into 2D.
How do I change the colors?
-
It will show balck if your style has edges set to be 'all the same color' - change it to 'by material' and they'll be colored.
However tehre is an error in the script in that the RGB colors for the axes are wrong you need to swap the colors over - so R >>> B, G >>> R and B >>> G.
Also the grid's spacing is stuck in integers which are translated into inches - if you want something else change the inputbox's values to say 1.m, 1.m and 100.mm...
Finally, as the grids are all copied from one original flat one and colored to suit IF you have different length/width entered one of the vertical grids will be made too high - it's be a simple matter to draw each of the three grids separately to their respective correct size. If you are adjusting the script note that the X/Y sizes aretransposed inside of the calculations...
-
Thanks, TIG! Is there any way to set the edge option of "Color By Material" as a default setting?
KJ
-
@kayjay said:
Thanks, TIG! Is there any way to set the edge option of "Color By Material" as a default setting?
KJYou can a (re)set this in a Style or set it in the Style in your Template...
To do it via Ruby...
Sketchup.active_model.rendering_options["EdgeColorMode"]
returns the current edge color setting...
0 = All The Same
1 = By Material
2 = By Axis
so reset it thus...
Sketchup.active_model.rendering_options["EdgeColorMode"]=1
to show the edges 'by material'...
. -
Thank you so much!
KJ
Advertisement