- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Context for publication- Inventor Presentation
Hi,
In PresentationDocument class, ActivePublication property requires ("Context") as argument. I would like to know how publication and presentation document is related and what is the required "context" as argument.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Publications are basically fully featured Scene objects, both of which are children of the Presentation document.
After much digging, I was not able to determine what the context variable should be. (There is a lot of goodies hidden in the document attributes, but none worked...)
However, I was able to find a suitable workaround I believe to access all the publications without using SelectSet. This operates on two principles: The model browser scene nodes return PublicationObject type and no Scenes can have the same names (Inventor throws an error if you try to name them the same). Therefore, I am able to get a list of all publication objects and also determine the active publication.
Note this code is iLogic and can be run using the new 2023 ribbon buttons.
Dim doc As PresentationDocument = ThisApplication.ActiveDocument
Dim pubs As New List(Of Publication) 'Essentially PresentationDocument.Publications
Dim topnode = doc.BrowserPanes.Item("Model").TopNode
For Each node As BrowserNode In topnode.BrowserNodes 'These are all the scene nodes
If node.NativeObject IsNot Nothing AndAlso TypeOf node.NativeObject Is Publication Then
pubs.Add(node.NativeObject)
End If
Next
Dim activePub = pubs.First(Function(p) p.DisplayName = doc.ActiveScene.Name) 'Essentially PresentationDocument.ActivePublication