Circular Centerline

Circular Centerline

Lesoux
Advocate Advocate
7,723 Views
9 Replies
Message 1 of 10

Circular Centerline

Lesoux
Advocate
Advocate

Hi, everyone. Is it possible to create a circular centerline for a pattern of features? If not, when it will be possible?

If I know, even Inventor API doesn't support this feature. Thanks.

 

Example.png

 

 

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Reply
Reply
0 Likes
Accepted solutions (1)
7,724 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
If you mean the BCD in which your 4X 0.88 holes are on, you can use Annotate > Symbols > Centerline tool. Select 3 holes, then the first hole again and it will make a circular centerline.
Reply
Reply
0 Likes
Message 3 of 10

Lesoux
Advocate
Advocate

We are on ETO page. I know how to do it through Inventor tools. How to do it using Intent or Inventor API?

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Reply
Reply
Message 4 of 10

wayne.brill
Collaborator
Collaborator

Hi,

 

I logged a ticket with ETO Engineering:

"Need a way to create a centerline for a pattern of features"

 

 

Perhaps using the Inventor API could provide a way. Here is a VBA example I have. I believe it does what you are asking about. (note that it would need to be updated to work with your Inventor files)

 

 

Sub test_AddCenteredPattern()

    Dim oDrawDoc As DrawingDocument

    Set oDrawDoc = ThisApplication.ActiveDocument

   

    Dim objColl As ObjectCollection

    Set objColl = ThisApplication.TransientObjects.CreateObjectCollection()

    Dim oCurveEnum As DrawingCurvesEnumerator

    Dim oIntent As GeometryIntent

 

    Dim oIptDoc As PartDocument

    Set oIptDoc = oDrawDoc.ReferencedDocuments.Item(1)

    Set oCurveEnum = oDrawDoc.ActiveSheet.DrawingViews.Item(1).DrawingCurves(oIptDoc.ComponentDefinition.Features("Drilled_Hole 1"))

           

    Dim oCenterPts As ObjectCollection

    Set oCenterPts = ThisApplication.TransientObjects.CreateObjectCollection()

    Dim oCenterPt As Point2d

    Dim bValidPt As Boolean

    Dim i As Integer

    For i = 1 To oCurveEnum.Count

        If oCurveEnum.Item(i).CurveType = CurveTypeEnum.kCircularArcCurve Then

            bValidPt = True

            Set oCenterPt = oCurveEnum.Item(i).CenterPoint

            Dim j As Integer

            ' Dont use duplicate center points

            For j = 1 To oCenterPts.Count

                If oCenterPt.IsEqualTo(oCenterPts.Item(j)) Then

                    bValidPt = False

                    Exit For

                End If

            Next j

          

            If bValidPt Then

                Call oCenterPts.Add(oCenterPt)

                Set oIntent = oDrawDoc.ActiveSheet.CreateGeometryIntent(oCurveEnum.Item(i), Nothing)

                Call objColl.Add(oIntent)

                oCurveEnum.Item(i).color = ThisApplication.TransientObjects.CreateColor(0, 0, 0)

            End If

        End If

    Next i

 

    Set oCurveEnum = oDrawDoc.ActiveSheet.DrawingViews.Item(1).DrawingCurves(oIptDoc.ComponentDefinition.Features("Center_Hole"))

    Set oIntent = oDrawDoc.ActiveSheet.CreateGeometryIntent(oCurveEnum.Item(1), Nothing)

    Dim oCenterline As Centerline

    Set oCenterline = oDrawDoc.ActiveSheet.Centerlines.AddCenteredPattern(oIntent, objColl, , , True)

End Sub

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Reply
Reply
0 Likes
Message 5 of 10

Lesoux
Advocate
Advocate

Thank you for example.

I tried to use this way and I had some issues with last method to add centerline directly. In Intent design editor you cannot skip agruments (...AddCenteredPattern(oIntent, objColl, , , True)). I tried to delete optional arguments (see red text color), it doesn't work (showing unspecified error). I tried to use NoValue on empty arguments, the same thing. Seems like this code is good for VB, I have no idea how to use it in Intent.

Actually, I solved a problem using Get/SetAutomatedCenterlineSettings. There is one more problem. How to evaluate rule with my code? See example below.

 

Rule addCenterlines As Any
Dim app As Any = %%InventorApplication
Dim activeDoc As Any = app.ActiveDocument
Dim activeSheet As Any = activeDoc.ActiveSheet
Dim drwViews As Any = activeSheet.DrawingViews

Dim isDrw? As Boolean = (activeDoc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject)
   Dim settings As Any

   If isDrw? Then
   settings = activeDoc.DrawingSettings.AutomatedCenterlineSettings

      For i = 1 To drwViews.Count
         drwViews.get_Item(i).GetAutomatedCenterlineSettings(settings)

         settings.ProjectionNormalAxis = True
         settings.ProjectionParallelAxis = True
         settings.ApplyToCylinders = True
         settings.ApplyToHoles = True
         settings.ApplyToCircularPatterns = True

 

         drwViews.get_Item(i).SetAutomatedCenterlineSettings(settings)
      Next

      Return True
   End If

 

   Return False
End Rule

 

Still, thank you for help, it was very helpful.

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Reply
Reply
0 Likes
Message 6 of 10

AlexKorzun
Autodesk
Autodesk

Hi

 

Though you haven't specified the error, I assume the Rule fails on the line:

 

drwViews.get_Item(i).GetAutomatedCenterlineSettings(settings)

 

The reason: settings arg is passed into function with ByRef convention, which is not currently supported in Intent code.

The workaround is to call the equivalent function from external .dll

 

 

Also:

Use GetHostObject( thePart) Function to get the .Net reference behind Intent Part. More samples. Please avoid using .Active* calls in your Intent code, to save some time in future, if you decide to run your code with ETO Server.

 

 

 

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Reply
Reply
0 Likes
Message 7 of 10

Lesoux
Advocate
Advocate

Hi, Alex.

 

I don't have any problem with my code shown in previous post. It works, but with manual handling only. I know that to run rule I need to call it. This is my problem. Is there some simple way to run rule without calling him?

 

Thanks.

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Reply
Reply
0 Likes
Message 8 of 10

Lesoux
Advocate
Advocate

I had error message when I tried to use Wayne example.

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Reply
Reply
0 Likes
Message 9 of 10

wayne.brill
Collaborator
Collaborator
Accepted solution

Hi,

 

Here is a suggestion for getting your rule to be automatically called by Intent.

 

Create a design and mix in a design such as IvCenterMark. In this design have your rule that you want to get called and copy in the %%updateSelf rule from the system design %%IvCenterMark. Intent will use the version of %%updateSelf that is in your design. In your %%updateSelf call your rule. Below are Designs from a test project I got from a colleague that does this. 

 

Note:  Keep in mind that in a future release of ETO this may break if the system design being used is changed.

 

 

Design IvConcentricCL : CCLRoot IvCenterMark

 

Rule ShowHideCenterlines AsAny

  

Dim activeDoc = GethostObject( View.Parent.Parent)

Dim theView = GethostObject(View)

  

  

Dim settings AsAny = activeDoc.DrawingSettings.AutomatedCenterlineSettings

 

theView.GetAutomatedCenterlineSettings(settings)

 

settings.ProjectionNormalAxis = True

settings.ProjectionParallelAxis = True

settings.ApplyToCylinders = True

settings.ApplyToHoles = True

settings.ApplyToCircularPatterns = True

 

theView.SetAutomatedCenterlineSettings(settings)

   

ReturnTrue

End Rule

 

 

  < %%category("Render Controls") > _

 Rule %%updateSelf AsString

    View.Model.modelSelf

    View.sheet.%%updateSelf

    View.ModelSelf

    %%updateSelf = iv_createCentermark(part1, entity1, Style, layer, View, View.Model)

    ShowHideCenterlines

 End Rule

 

Here is the design that creates the child

 

Design TheBaseView : CCLRoot IvBaseView

 

Child TheCentermark As :IvConcentricCL

view = Me

part1 = Root.ThePartOcc

entity1 =  "Edge1"

ExtensionLinesVisible? = True

visible? =True

style = "Center Mark (ANSI)"

layer = "Center Mark (ANSI)"

End Child

End Design

 

 

 

 

Thanks,

Wayne

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Reply
Reply
0 Likes
Message 10 of 10

Lesoux
Advocate
Advocate

Thank you Wayne. Everything works very well except one thing. Took a look at the attached picture. The left view has concentric center line, but holes don't have any tangent center lines. The right view has everything. I used absolutely the same rule on these view designs. Any ideas?

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Reply
Reply
0 Likes