Open Assembly with view representation last saved

Open Assembly with view representation last saved

m.schrepfer
Advocate Advocate
129件の閲覧回数
2件の返信
メッセージ1/3

Open Assembly with view representation last saved

m.schrepfer
Advocate
Advocate

Is there a way to open an assembly via programming (vb.net/VBA) with the last saved view representation?

In other words, the same behavior that I can configure in the application options.

Markus Schrepfer
0 件のいいね
130件の閲覧回数
2件の返信
返信 (2)
メッセージ2/3

WCrihfield
Mentor
Mentor

Yes.  There are two main ways to open a document.  One is without specifying any options other than visibility.  The other option is to specify some options.  If you do not specify any options when opening a document by code, then the application options settings will be used.  If you specify options, then it will obey those specified options.

Below are links to the online help documentation for those two methods that are usually involved.

Documents.Open 

Documents.OpenWithOptions 

Example of opening an assembly with options specified:

Dim oDoc As Inventor.Document
Dim sFDN As String = "C:\Temp\MyAssembly.iam"
Dim oOptions As Inventor.NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap()
oOptions.Value("SkipAllUnresolvedFiles") = True
oOptions.Value("DesignViewRepresentation") = "Default" 'name of DVR (view rep)
oOptions.Value("ExpressModeBehavior") = "OpenDefault"
oDoc = ThisApplication.Documents.OpenWithOptions(sFDN, oOptions, True)
'do something with that 'oDoc' variable now

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

 

Edit:  There is also a way to determine which DVR (DesignViewRepresentation) was the last one active in a specified file, using the FileManager.GetLastActiveDesignViewRepresentation method, which returns a String representing the name of that DVR.  Then that could be used when specifying the name of the one you want to be active when specifying options, and which DVR you want active when you open it.  That FileManager object is obtained directly from the application object ('ThisApplication' term in code) (Application.FileManager).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

メッセージ3/3

m.schrepfer
Advocate
Advocate

Hi Wesley,

 

thanks a lot for this tipp. I will check this.

Markus Schrepfer
0 件のいいね