Why so? Is this a bug?
Considering it might be a list of mixed Surfaces and Breps , so I need to distinguish the cases from: only surfaces (8), only breps (16) and mixed surfaces and breps (24).
Any workaround?
with some extra code, yes there is a workaround Brep has a IsSurface property you can use to filter you selected objects
beware that a trimmed surface is actually a Brep
ā¦it would be nice that GetSelectedObjectTypes() can return a finer grained class/type
Yes, with more coding.
But with a large selection I need to iterate through all objects, cast to geometry, cast to brep (if it is a brep), and finally iām doing bool isSurf = brep.Faces.Count() == 1;
to detect if it is a ānon-polysurfaceā ā¦
But this all is quite heavyā¦ i think.
ā¦ and bug-free.
I mean, Iām trying to use as simple as possible surfaces and it always return 16 ā¦ I am not able to trigger it to return 8.
The type returned on the top level object is a brep so you do need to check the face count - if 1, then it is a āsurfaceā in the Rhino sense, but not as RhinoCommon sees it - it is still a brep until you dig down to the faces.
I mean, there is some other hidden/deep method for this?
Or even rhino with his āSelect surfaceā functions is checking face count every time?
(Iām asking just out of curiosity by nowā¦)
Anyway, if there arenāt any other workaround, iāll work with face count for now. No problem.
Yep, but in RhinoscriptSyntax at least - I canāt tell in Rhino Script - the function does exactly that - gets the brep and then counts the faces and returns 8 if it is one. I think the main thing is that under the hood, Rhino deals with breps at the top level (of geometry) and surfaces are components within these - sometimes only one.
rhobj = rhutil.coercerhinoobject(object_id, True, True)
geom = rhobj.Geometry
if isinstance(geom, Rhino.Geometry.Brep) and geom.Faces.Count==1:
return 8 #surface
return int(geom.ObjectType)