Message 1 of 3
Activating LODs in an invisible document

Not applicable
10-25-2009
11:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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!
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!