Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Presentation - Hide / Show Trails

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
d_stockinger
1092 Views, 10 Replies

Presentation - Hide / Show Trails

Hello,

 

I would like to hide / show all Trails via API.

 
 

HideAllTrails.pngShowAllTrails.png

Tried it with the "PresentationExplodedViews" Object, but there is the Trail Visibility is a read only Object. 


Is there a way to get access via API?

Thanks

 

Regards

Daniel

10 REPLIES 10
Message 2 of 11
HideoYamada
in reply to: d_stockinger

Hello Daniel,

 

I tried to change the visibility of the trails, but couldn't.

There are undocumented APIs such as PublicationTweak or PublicationTrailSegment.

I found that PublicationTrailSegment.Visible is related to the visibility of the Trail, but it seems to be read-only.

 

Sub ChangeAllTrailVisibility(Optional showTrail As Boolean = True)
    Dim oPrDoc As PresentationDocument
    Set oPrDoc = ThisApplication.ActiveDocument
    
    Dim oBNs As BrowserNodesEnumerator
    Set oBNs = oPrDoc.BrowserPanes(1).TopNode.BrowserNodes(1).BrowserNodes(2).BrowserNodes
    Dim oBN As BrowserNode
    For Each oBN In oBNs
        If TypeOf oBN.NativeObject Is PublicationTweak Then
            Dim oPT As PublicationTweak
            Set oPT = oBN.NativeObject
            Dim oPTSeg As PublicationTrailSegment
            For Each oPTSeg In oPT.TrailSegments
                ' PublicationTrailSegment.Visible can be read.
                Debug.Print oPTSeg.Visible
                ' But we cannot write on it.
                'oPTSeg.Visible = showTrail
            Next oPTSeg
        End If
    Next oBN
End Sub

So I think that we cannot change the visibility of the trails.

 

=====

Freeradical

 Hideo Yamada

 

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
Message 3 of 11
d_stockinger
in reply to: HideoYamada

Hello Hideo,

 

Thanks for your Answer.

In the meantime I found an object in the Inventor Api Help that can affect the visibility of the path segment.

InventorAPIDocumentation.png

 

Found the object in the Inventor API object model but can not get back any path segments.

TrailSegmentObjectModel.png

 

Here is a Screenshot from a Watch in VBA

2019-11-13 18_34_21-Window.png

 

VBA Code:

Public Sub Test()
Dim PresDoc As PresentationDocument
Set PresDoc = ThisApplication.ActiveDocument

Dim Scene As PresentationScene
Set Scene = PresDoc.Scenes(1)

Dim SnapShot As PresentationSnapshotView
Set SnapShot = Scene.SnapshotViews(1)

'Dim Trails As PresentationTrails
'Set Trails = SnapShot.Trails
End Sub

 

Thanks


Regards

Daniel

Message 4 of 11

@d_stockinger,

 

Thanks for writing it in forum,

 

I tried to set hide or show trail using below VBA code. Fails to set value for PresentationTrailSegment.Visible Property.

Public Sub Test()
    Dim PresDoc As PresentationDocument
    Set PresDoc = ThisApplication.ActiveDocument
    
    Dim Scene As PresentationScene
    Set Scene = PresDoc.Scenes(1)
    
    Dim SnapShot As PresentationSnapshotView
    Set SnapShot = Scene.SnapshotViews(1)
    
    Dim Trails As PresentationTrail
    Set Trails = SnapShot.Trails.Item(9)
    
    Trails.Segments.Item(1).Visible = False
End Sub

To address this, a change request (INVGEN - 35227) is created with engineering team.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 5 of 11

Hello,

@chandra.shekar.g 

Thanks for your time to test this usecase.

 

Is there any timeframe for this fix?

Regards
Daniel

Message 6 of 11

@d_stockinger,

 

I will let you know once it is implemented.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 7 of 11
YuhanZhang
in reply to: d_stockinger

Hi Daniel,

 

Do you want to hide the trails in the storyboard or in a snapshot view? As you can see the current API PresentationSnapshotView.Trails only returns the trails in a PresentationSnapshotView, we have not exposed the API for storyboard yet, so if you want to hide all the trails in the storyboard it would be a new wish for us. I just want to check if we implement the PresentationTrailSegment.Visible as R/W can help you or not.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 8 of 11
d_stockinger
in reply to: YuhanZhang

Hello Rocky,

 

thanks for you replay.


For shure it would be nice to hide all Trails in the StoryBoard, but if I can hide the Trails via Snapshot, I can iterate programmatically through all snapshots. So for me the snapshot is enough.

 

Thanks

Daniel

Message 9 of 11
YuhanZhang
in reply to: d_stockinger

Thanks Daniel, this will help us to estimate this requirement.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 10 of 11
YuhanZhang
in reply to: d_stockinger

Hi Daniel,

 

In Inventor 2021 you can try below VBA to see if it works for you:

 

Sub TurnOffTrailsInSnapshotView()

Dim oPresDoc As PresentationDocument
Set oPresDoc = ThisApplication.ActiveDocument

Dim oScene As PresentationScene
 Set oScene = oPresDoc.Scenes(1)

Dim oSnapShot As PresentationSnapshotView
 Set oSnapShot = oScene.SnapshotViews(1)

' we need to break the associativity between the snapshot view and storyboard before editing it
oSnapShot.StoryboardAssociative = False

' enter the edit mode for snapshot view(eitherwise the edit will fail)
oSnapShot.Edit

Dim oTrail As PresentationTrail
For Each oTrail In oSnapShot.Trails
    Dim oSeg As PresentationTrailSegment
    For Each oSeg In oTrail.Segments
        Debug.Print oSeg.Visible
        oSeg.Visible = False
        Debug.Print oSeg.Visible
    Next
Next

End Sub

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 11 of 11
d_stockinger
in reply to: YuhanZhang

Hello Rocky,

 

Thank you so much. It works now as expected in Inventor 2021.

 

Regards

Daniel

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report