Applying color to circles?
-
the following code draws 4 circles:
mod = Sketchup.active_model ents = mod.active_entities sel = mod.selection face = sel.grep(Sketchup;;Face)[0] locations=[@pt1,@pt2,@pt3,@pt4] locations.each{|loc| @pt1=loc ents.add_circle(@pt1, @vec3, @dia, 24)What code do I need to apply a single color to each circle?
I'm looking at http://ruby.sketchup.com/Sketchup/Color.html for inspiration,
but I'm not able to make the code work!
color=Sketchup;;Color.new(163,204,204)TIA!
-
In order to see colored materials for faces, the rendering options (style) must be set to either "shaded" or "shaded with textures". See the RenderingOptions class:
http://ruby.sketchup.com/Sketchup/RenderingOptions.htmlIF you are painting the circle's edges, then in order to see the edges colored, the EdgeColorMode by be set to "ByMaterial" rather than "AllTheSame" (black).
-
Yikes! I should have been more descriptive.
I'm trying provide a color to the faces of those 4 circles. -
Your current 'circle' code only draws some edges [all be it that they are in the form of circles].
Use e.g.
edges=ents.add_circle(@pt1, @vec3, @dia, 24)
Then make a face for one of those edges...
ents.find_faces(edges[0]) face=edges[0].faces[0]
Then add a material to the 'face'...Of course this is very simplistic...
e.g. if your circles might overlap etc not all edges might get a face, so then you probably need to make each circle/face inside its own group in turn, at least until you have finished making/painting it etc, after which exploding the temp-group can put the faces back into the desired entities-context...
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement