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!

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