Activating LODs in an invisible document

Activating LODs in an invisible document

Anonymous
Not applicable
414 Views
2 Replies
Message 1 of 3

Activating LODs in an invisible document

Anonymous
Not applicable
I need to open assemblies in invisible mode
and switch from Master to custom LODs and
vice versa to work with BOM and to suppress/unsuppress
components depending on external variables.
Hidden mode is required to do this behind the scene
to avoid flashing screen and for higher speed (may be?).
This problem is not too critical for me.
But executing rules in hundreds of documents
I prefer to see only progress bar on my display.

My test VBA code in IV 2009 SP2 fails
to activate custom LOD in hidden mode.
Here is it’s code:
{code}
Sub Swith_to_CustomLOD()

'Assembly Assy.iam has custom LOD "MyLOD"

Dim Filename As String
Filename = "C:\TEMP\Assy.iam"

' Open assembly document in LOD Master.
' Invisible mode.
Dim oAssyDoc As AssemblyDocument
Set oAssyDoc = ThisApplication. _
Documents.Open(Filename, False)

Dim oRepManager As RepresentationsManager
Set oRepManager = oAssyDoc. _
ComponentDefinition.RepresentationsManager

' Reference to custom LOD
Dim oLOD As LevelOfDetailRepresentation
Set oLOD = oRepManager. _
LevelOfDetailRepresentations.Item("MyLOD")

' Swith to custom LOD fails
Call oLOD.Activate '<== error 5 in this line
' "Invalid procedure call or argument"
End Sub
{code}

On Apr 21, 2008 Sanjay has already reported that
a problem with activating LODs in a hidden sssembly
was filed in Autodesk database:
http://discussion.autodesk.com/forums/thread.jspa?messageID=5908564⡔

In IV 2009 SP2 this is still isn’t possible.
Who can check and report if this sample code
works in Inventor 2010 ?

Thanks in advance!
0 Likes
415 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Yes, this issue has been fixed in Inventor 2010.

For Inventor 2009, possible workarounds include opening the document with
the specified LOD (instead of activating the LOD within the document), as
demonstrated in the original post, or opening the document as visible and
setting the Application.ScreenUpdating property to False so the user doesn't
see the view updates.

Sanjay-
0 Likes
Message 3 of 3

Anonymous
Not applicable
> Yes, this issue has been fixed in Inventor 2010.
Good news. Thank you.
0 Likes