algorithmic modeling for Rhino
Hello all,
I have a component where I need to convert Objects to GeometryBase and then check their ObjectType.
I have done this in the past but I have recently found that if I have pass an object that I know is a surface the resulting GeometryBase variable will have an ObjectType of a Brep....
What I really want to do is...
Dim myObject As Object = <some surface or brep>
Dim BaseObj As GeometryBase = Grasshopper.Kernel.GH_Convert.ToGeometryBase(myObject)
If BaseObj.ObjectType = Rhino.DocObjects.ObjectType.Surface Then
'do something to the Surface
Else If BaseObj.ObjectType = Rhino.DocObjects.ObjectType.Brep Then
'do something to the Brep
End If
If the object is a Surface, the above code will always do something as if it were a Brep so my two conditions won't work as expected.
Any suggestions?
-Nathan
Tags:
I should also note, that I have other conditions in my component to determine if myObject is a point, curve, or mesh. These all work as expected...
The real hang up is differentiating between surfaces and breps with GeometryBase
-Nathan
It's not the most elegant solution, but it might be an ok workaround:
Dim myObject As Object = <some surface or brep>
Dim BaseObj As GeometryBase = Grasshopper.Kernel.GH_Convert.ToGeometryBase(myObject)
Else If BaseObj.ObjectType = Rhino.DocObjects.ObjectType.Brep Then
Dim myBrep As Brep = BaseObj
If(myBrep.IsSurface)
'do something to the Surface
Else
'do something to the Brep
End If
End If
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by