Problem while creating a circle ?!
-
Hello everybody,
I'm trying to draw and paint a circle in the center of a Face, so here is my code :
The current selection is a Face :
center = Sketchup.active_model.selection.first.bounds.center normal = Sketchup.active_model.selection.first.normal outline = Sketchup.active_model.entities.add_circle(center,normal,10) circle = Sketchup.active_model.entities.add_face(outline) circle.material = "red"
This code draw a circle but "add_face" always return nil so I can't paint in red this new circle !??
Can't you help me please, because I don't understand the problem? -
Since you are drawing onto a face, when you try to make a face from the circle edges, there is already one there, and unfortunately it returns nil if it does not create a new face.
` face = Sketchup.active_model.selection.first # Keep track of the original face
center = face.bounds.center
normal = face.normal
outline = Sketchup.active_model.entities.add_circle(center,normal,10)assume that the circle edges borders to the new circle and the original face
circleface = ( circle.first.faces.to_a - [face] ).first
circleface.material = "red"` -
Thanks a lot for your reply!!
It's really better now !!
But withcircleface = ( **outline**.first.faces.to_a - [face] ).first
-
ooops!
Advertisement