- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I am working on a programm to get the center point of surfaces. To calculate the center point, I try to get the data of the surface, i.e. the corner points. I tried to get the corner points as MinPoints and MaxPoints of the SurfaceEvaluator and its properties 'ParamRangeRect' and 'RangeBox'. Right now, this is not working.
It seems that the properties 'ParamRangeRect' and 'RangeBox' both are not getting the actual surface. The results of using those properties are always different than the 'real' face. I have created a sketch with the MinPoints and MaxPoints to see the contours of the properties (see screenshots attached).
Is there something I am missing in using ParamRangeRect oder RangeBox?
Is there another way to get the 3d coordinates of the surface center point?
Down below you can see my Sub to get the center of a surface. The input face is selected before.
This is the example for the property 'RangeBox':
Private Sub f_getCenter(InputFace As Face) As SketchPoint
Dim eval As SurfaceEvaluator = InputFace.Evaluator
' Get the center of the parametric range.
Dim center(1) As Double
' Get RangeBox for Min and Max Values
Dim oRange As Box = eval.RangeBox
' Get center of the RangeBox
center(0) = (oRange.MaxPoint.Z + oRange.MinPoint.Z) / 2
center(1) = (oRange.MaxPoint.Y + oRange.MinPoint.Y) / 2
Dim oAsmCompDef As AssemblyComponentDefinition = g_inventorApplication_
.ActiveDocument.ComponentDefinition
Dim oTG As TransientGeometry = g_inventorApplication.TransientGeometry
Dim oSketch As PlanarSketch = oAsmCompDef.Sketches.Add(InputFace)
' Draw sketch point of center
Dim oPoint As SketchPoint = oSketch.SketchPoints._
Add(oTG.CreatePoint2d(center(0), center(1)), True)
' ----------- TEST for min and max points of surface --------------
Dim oPoint1 As SketchPoint = _ oSketch.SketchPoints._
Add(oTG.CreatePoint2d(oRange.MinPoint.Z, oRange.MinPoint.Y), True)
Dim oPoint2 As SketchPoint = oSketch.SketchPoints._
Add(oTG.CreatePoint2d(oRange.MaxPoint.Z, oRange.MinPoint.Y), True)
Dim oPoint3 As SketchPoint = oSketch.SketchPoints._
Add(oTG.CreatePoint2d(oRange.MinPoint.Z, oRange.MaxPoint.Y), True)
Dim oPoint4 As SketchPoint = oSketch.SketchPoints._
Add(oTG.CreatePoint2d(oRange.MaxPoint.Z, oRange.MaxPoint.Y), True)
' -------------------------------
Return oPoint
End Function
The Sub with the property 'ParamRangeRect' only has a few changes compared to the one above.
Thank you for your help.
Sebastian
Solved! Go to Solution.