Ciao
Sto cercando di capire come si costruisce una Brep, data una superficie base e una curva di bordo.
Questo usando RhinoCommon.
Per ora, data la mia zucca dura, non ci riesco …
Qualcuno sa come fare o sa dove trovare un esempio da studiare ?
Io ho trovato esempi in C++, ma a quanto pare sbaglio qualcosa cercando di riprodurli in RhinoCommon…
Grazie
p.s.
questo e’ cio’ che ho provato … ma non funge:
import Rhino
def main():
# define surface surf = Rhino.Geometry.PlaneSurface( Rhino.Geometry.Plane.WorldXY, Rhino.Geometry.Interval( -100, 100 ), Rhino.Geometry.Interval( -100, 100 ) )
# draw surface Rhino.RhinoDoc.ActiveDoc.Objects.AddSurface( surf )
# define outer curve circ = Rhino.Geometry.Circle( 75 ) curve3d = Rhino.Geometry.ArcCurve( circ )
# draw outer curve Rhino.RhinoDoc.ActiveDoc.Objects.AddCurve( curve3d ) Rhino.RhinoDoc.ActiveDoc.Views.Redraw()
# get curve 2D tolr = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance curve2d = surf.Pullback( curve3d, tolr ) vertexpnt = curve3d.PointAtStart
# surface orientation backsurf = False
# curve orientation backedge = False
# build brep: rep = Rhino.Geometry.Brep() # add vertex vertex = rep.Vertices.Add( vertexpnt, Rhino.RhinoMath.UnsetValue ) vertexindex = vertex.VertexIndex # add curve 3D cur3dindex = rep.AddEdgeCurve( curve3d ) # add edge edge = rep.Edges.Add( vertexindex, vertexindex, cur3dindex, Rhino.RhinoMath.UnsetValue ) # add surface surfindex = rep.AddSurface( surf ) # add face face = rep.Faces.Add( surfindex ) # add loop loop = rep.Loops.Add( Rhino.Geometry.BrepLoopType.Outer, face ) # add curve 2D cur2dindex = rep.AddTrimCurve( curve2d ) # add trim trim = loop.Trims.Add( edge, backedge, loop, cur2dindex ) trim.IsoStatus = Rhino.Geometry.IsoStatus.None trim.TrimType = Rhino.Geometry.BrepTrimType.Boundary trim.SetTolerances( Rhino.RhinoMath.UnsetValue, Rhino.RhinoMath.UnsetValue ) # set surface orientation face.OrientationIsReversed = backsurf
print 'Brep is valid: %s' % str( rep.IsValid )
main()