How to set a gumball from a brep?


#1

Hi, I want get a brep’s gumball,but I can’t find it in sdk

    Public Function SetFromArc(ByVal arc As Arc) As Boolean
Public Function SetFromBoundingBox(ByVal boundingBox As BoundingBox) As Boolean
Public Function SetFromBoundingBox(ByVal frame As Plane, ByVal frameBoundingBox As BoundingBox) As Boolean
Public Function SetFromCircle(ByVal circle As Circle) As Boolean
Public Function SetFromCurve(ByVal curve As Curve) As Boolean
Public Function SetFromEllipse(ByVal ellipse As Ellipse) As Boolean
Public Function SetFromExtrusion(ByVal extrusion As Extrusion) As Boolean
Public Function SetFromHatch(ByVal hatch As Hatch) As Boolean
Public Function SetFromLight(ByVal light As Light) As Boolean
Public Function SetFromLine(ByVal line As Line) As Boolean
Public Function SetFromPlane(ByVal plane As Plane) As Boolean

@dale
@DavidRutten
I use net in gh. I am writing a gha need to do this.


#2

@stevebaer
Trouble Stevebaer to see this problem.


(Steve Baer) #3

@DavidRutten has a bit more experience with this than me. The gumball access in the SDK could use some tuning up.


(Dale Fugier) #4

The gumball should be oriented to some plane. So determine a plane on one of the faces of the Brep, and then pass that plane to SetFromPlane().


#5

I have asked him. he can’t give any solution either


#6

Hi Dale,Thank you first.
Can you say more detail ? or Post some net code.
I don’t understand “Determine a plane on one of the faces of the Brep”, if the face is not a planar surface How can I get a plane from it?
And you see "Public Function SetFromPlane(ByVal plane As Plane) As Boolean"
SetFromPlane just need One Plane,but a brep may be many faces–


(Dale Fugier) #7

Gumball is a transformation widget. And the basis for many transformation is a base plane (e.g. starting location). So the Gumball wants to be oriented to some plane.

A Brep does not necessarily have an obvious plane on which to orient on. So, it might not be easy to come up with a single “SetFromBrep” function that always set it to where you want.

But if you need some example, then perhaps you can use this as a starting place.

Public Shared Function SetFromBrepFace(ByRef gbl As GumballObject, ByVal face As BrepFace) As Boolean
  Dim result As Boolean = False
  If (gb IsNot Nothing AndAlso face IsNot Nothing) Then
    Dim u As Double = face.Domain(0).Mid
    Dim v As Double = face.Domain(1).Mid
    Dim frame As New Plane()
    result = face.FrameAt(u, v, frame)
    If (result = True) Then
      result = gbl.SetFromPlane(frame)
    End If
  End If
  Return result
End Function

Get the gumball frame of GeometryBase
#8

Just get the Frameat(u.mid,v.mid)? I don’t belive the gumball will use in rhino is so easy–
Not say the gumball, I want to know, Is there a OCS coodinate system in a geometrybase?
I need it,when the geometrybase being trimed or split,the OCS plane do not change.
@dale are you there? I really hate the time difference-- It’s midnight now here


(Dale Fugier) #9

This is just an example. As it is your tool, feel free to come up with whatever method works best for you.

No, Rhino does not maintain an object coordinate system, or OCS. Ironically, this is something we are considering for Rhino 6 for this very reason.


#10

OK,I see.
Thank you for your reply. I hope Rhino6 will come soon.
I am a fans of your rhino develop team. I believe,rhino6 will be more Powerful.
Thank you again dear dale–