Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
g.georgiades
in reply to: mjkoushik

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