Automated Centerlines (API)

Automated Centerlines (API)

NSBowser
Advocate Advocate
2,667 Views
6 Replies
Message 1 of 7

Automated Centerlines (API)

NSBowser
Advocate
Advocate

I'm using the following code to apply automated Centerlines to what is basically a simple drawing of a washer. The washer is created by extruding the area between two circles, so there is not a hole feature. On the drawings, the topview is looking at the flat sides of the washer (OD, and ID) and the section is looking at a midplane cut (Thickness).

 

        protected void applyAutomatedCenterlines()
        {
            AutomatedCenterlineSettings settings = DrawingDocument.DrawingSettings.AutomatedCenterlineSettings;
            settings.ApplyToCircularPatterns = true;
            settings.ApplyToCylinders = true;
            settings.ApplyToHoles = true;
            settings.ProjectionNormalAxis = true;
            settings.ProjectionParallelAxis = true;
            _topView.SetAutomatedCenterlineSettings(settings);
            _sectionView.SetAutomatedCenterlineSettings(settings);
        }

The result is that the centermark on the top of the washer is created, but the centerline on the section view is not.

If I select the section view afterwards and apply automated centerlines the settings I used above persit, and when applied, achieve the desired result.

I have confirmed that the _sectionView object is populated correctly.

 

Any thoughts why the automated version of this is not working using the same settings?

 

Here is a picture of the items I'm working with (desired center lines shown)

 

5-24-2017 1-58-04 PM.jpg

Thanks for any help!

 


Best of Luck

---------------------------------------------------------------------------------------------------------------------------------
If you find this reply helpful or insightful, please use the 'Accept as Solution' or 'Kudos' button below.
0 Likes
Accepted solutions (1)
2,668 Views
6 Replies
Replies (6)
Message 2 of 7

ekinsb
Alumni
Alumni
Accepted solution

I just created the same model and it's working fine for me.  I'm using Inventor 2017.  I converted your code to VBA because it's a little easier to prototype and debug but they're both calling the same API so I wouldn't expect that to make any difference.  Here's my code that you can test on your drawing.  I narrowed it down to the two settings you can see below to get the desired result, but having the other setting didn't cause any problems either.

 

Public Sub CenterLineTest()
    Dim drawDoc As DrawingDocument
    Set drawDoc = ThisApplication.ActiveDocument
    
    Dim topView As DrawingView
    Dim sectionView As DrawingView
    Set topView = drawDoc.ActiveSheet.DrawingViews.Item(1)
    Set sectionView = drawDoc.ActiveSheet.DrawingViews.Item(2)
    
    Dim settings As AutomatedCenterlineSettings
    Set settings = drawDoc.DrawingSettings.AutomatedCenterlineSettings
    
    settings.ApplyToCylinders = True
    settings.ProjectionParallelAxis = True
    Call topView.SetAutomatedCenterlineSettings(settings)
    Call sectionView.SetAutomatedCenterlineSettings(settings)
End Sub

Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 7

NSBowser
Advocate
Advocate

Brian,

 

Thanks for your reply.

 

The part is coming from content center (we're adding them dynamically to the content center tables, and then building assemblies and models and drawings of them automatically.)

 

I ran into an issue trying to get the assembly section view to behave (section participation and content center parts don't get along with the API), but I didn't have any such issue creating the section on the individual content center part. I can't help but think it is somehow related.

 

Thanks again for your thoughts.

 

 


Best of Luck

---------------------------------------------------------------------------------------------------------------------------------
If you find this reply helpful or insightful, please use the 'Accept as Solution' or 'Kudos' button below.
0 Likes
Message 4 of 7

ekinsb
Alumni
Alumni

I just created a small assembly that included a content center washer, created a drawing and ran my little test script and it still worked as expected. Not sure what's going on in your case.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 5 of 7

NSBowser
Advocate
Advocate

I performed a similar test, running an iLogic rule (based on your VBA) and the center line shows up correctly... Obviously there is something amiss, but it escapes me.

 

Thanks for your time!


Best of Luck

---------------------------------------------------------------------------------------------------------------------------------
If you find this reply helpful or insightful, please use the 'Accept as Solution' or 'Kudos' button below.
0 Likes
Message 6 of 7

Anonymous
Not applicable

You can apply this to holes, punches, and cylinders but is there syntax to show centerlines "Revolve Features"?

 

Thanks!

0 Likes
Message 7 of 7

wmgshurik
Enthusiast
Enthusiast

Hello!

Did you solve your problem?  I have the same situation.

When I call the native command from the context menu I see my presettings, and I need only press OK button for proper result. But I cant do this in auto mode..

oDrawView.SetAutomatedCenterlineSettings(oACenterLines); - It looks like if that command line dont work..