How to determine if selection is a surface
-
How can I determine it Sketchup.active_model.selection is a surface, and not just a bunch of faces?
-
Do yu mean surface as in lots of faces with soft/smooth edges in between?
-
I think you'd have to check if all the faces in the selection is connected with each other by Soft edges.
-
@remus said:
Do yu mean surface as in lots of faces with soft/smooth edges in between?
Yes - in particular I mean that thing, which if you right click on it in SketchUp and click "Entity Info" it reports it as a surface.
If you created a cylinder and select just the curved face it is reported as a surface, but if you select the entire cylinder, it is reported as "NNN entities"
-
@thomthom said:
I think you'd have to check if all the faces in the selection is connected with each other by Soft edges.
Aha - I searched the SketchUp API docs for surface and found this:
@unknownuser said:
Selection.is_surface?
The is_surface? method is used to determine if the selection contains only all of the faces that are part of a single curved surface. Returns: status true if the selection contains all faces that belong to a single curved surface. False if the selection does not contain all faces that belong to a single curved surface. selection.add entity status = selection.is_surface
-
Doh! I never noticed that method!
Noris_curve?
orsingle_object?
. -
@thomthom said:
Doh! I never noticed that method!
Noris_curve?
orsingle_object?
.I know. I searched the SCF first, but never thought to try to search the Ruby documentation.
(I kind of assume that if something is important we have discussed it here already.)Actually their search works pretty well. (even better than that)
if you go to:
And use their search box for something like "Curve" it displays text from and links to pages in the SketchUp documentation containing the word curve. (Just what you might expect it to - but I also suspected that it might search the whole universe for the word curve)
I need to use it more often.
Advertisement