Torus geometry does not evaluate as expected

Torus geometry does not evaluate as expected

CAD_CAM_MAN
Advocate Advocate
559 Views
2 Replies
Message 1 of 3

Torus geometry does not evaluate as expected

CAD_CAM_MAN
Advocate
Advocate

Using Autodesk Inventor Professional 2020 Build: 396, Release 2020.4

 

I am working on a program that evaluates torus surfaces on imported .step file geometry (solid bodies). It seems on some items that are imported the torus evaluates as if it is fully revolved around its center axis which in some cases it is not. For example I would expect a rangebox to be as shown below (smaller box only containing the actual surface), Instead the result is the larger box as if the torus was fully revolved around its center axis.

Is there a way to only evaluate the actual surface? Do I need to do something else when importing the geometry?

Some imports evaluate as expected some do not. Can anyone explain the inconsistency?

 

CAD_CAM_MAN_0-1636052287452.png

 

CAD_CAM_MAN_1-1636052409231.png

'Sample code
For Each face As Face In MyBody.Faces
            If Not IsNothing(TryCast(face.Geometry, Torus)) Then
                Dim ADoc As PartDocument = InventorApp.ActiveDocument
                Dim PCdef As PartComponentDefinition = ADoc.ComponentDefinition
                Dim FaceGeo As Torus = face.Geometry
                Dim MyBox As Box = FaceGeo.Evaluator.RangeBox
                With PCdef.WorkPoints
                    .AddFixed(MyBox.MaxPoint)
                    .AddFixed(MyBox.MinPoint)
                End With
            End If
        Next

Sample code result...

CAD_CAM_MAN_2-1636053241356.png

 

I have also tried using .isParamOnFace with points that are not on the actual surface shown but would be on the surface if the torus was fully revolved around its center axis. The points still evaluate as if on the surface.

 

0 Likes
Accepted solutions (1)
560 Views
2 Replies
Replies (2)
Message 2 of 3

J-Camper
Advisor
Advisor
Accepted solution

The Geometry Property of the Face is a generic Geometric Shape.  Use the Face Itself:

For Each f As Face In MyBody.Faces
    If Not IsNothing(TryCast(f.Geometry, Torus)) Then
        Dim ADoc As PartDocument = ThisApplication.ActiveDocument
        Dim PCdef As PartComponentDefinition = ADoc.ComponentDefinition
        'Dim FaceGeo As Torus = f.Geometry
        Dim MyBox As Box = f.Evaluator.RangeBox 'FaceGeo.Evaluator.RangeBox
        With PCdef.WorkPoints
            .AddFixed(MyBox.MaxPoint)
            .AddFixed(MyBox.MinPoint)
        End With
    End If
Next

 

Let me know if you have any questions or if this is not working as intended.

0 Likes
Message 3 of 3

CAD_CAM_MAN
Advocate
Advocate

Thank you JCamper!

 

This works as expected now...

'Sample Code
        For Each face As Face In MyBody.Faces
            If Not IsNothing(TryCast(face.Geometry, Torus)) Then
                Dim ADoc As PartDocument = InventorApp.ActiveDocument
                Dim PCdef As PartComponentDefinition = ADoc.ComponentDefinition
                'Dim FaceGeo As Torus = face.Geometry
                Dim MyBox As Box = face.Evaluator.RangeBox
                With PCdef.WorkPoints
                    .AddFixed(MyBox.MaxPoint)
                    .AddFixed(MyBox.MinPoint)
                End With
            End If
        Next

 

CAD_CAM_MAN_0-1636115451808.png

 

0 Likes