Factory Design Utilities Forum
Welcome to Autodesk’s Factory Design Utilities Forums. Share your knowledge, ask questions, and explore popular Factory Design Utilities topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic for Controlling LODs and View Rep not working

1 REPLY 1
Reply
Message 1 of 2
Anonymous
272 Views, 1 Reply

iLogic for Controlling LODs and View Rep not working

Hello All,

 

I am pretty new to iLogic but have managing my way. I have an Assembly that I am controlling the Levels of Detail and View Representations of using iLogic. The code that i have works when from an assembly level without any issues. My problems arise when I make this item into a Factory Asset. All the parameters come in correctly when placed into a Factory Layout. In fact i can even control any other items i set up. However, when i try to switch the parameters for the View reps or the LODs it throws me this error "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))". Can anyone shed some light on where i am going wrong?

 

My code (might be slightly primitive, I'm still new at this) is as follows:

 

For the Levels of Detail

'Drive Size and Location
If Drive_Size_and_Location = "Default" Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Master").Activate
iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
Else If Drive_Size_and_Location = "1-2 Horsepower LH" Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("1-2 Horsepower LH").Activate
iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
Else If Drive_Size_and_Location = "1-2 Horsepower RH" Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("1-2 Horsepower RH").Activate
iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
Else If Drive_Size_and_Location = "3-5 Horsepower LH" Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("3-5 Horsepower LH").Activate
iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
Else If Drive_Size_and_Location = "3-5 Horsepower RH" Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("3-5 Horsepower RH").Activate
iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
End If

 

For the View Representations

If Setup_Planes = "Setup_Planes:Off" Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Item("Setup Planes:Off").activate

iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
Else If Setup_Planes = "Setup_Planes:On" Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Item("Setup Planes:On").activate

iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
Else If Setup_Planes = "Default" Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Item("Master").activate

iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
End If

 
1 REPLY 1
Message 2 of 2
XuesongBai
in reply to: Anonymous

Hi there,

 

Try not to use active document for the factory asset.

The following ilogic code used in my asset for your reference.

 

Thanks,

-Xuesong

 

Dim doc as AssemblyDocument = ThisDoc.Document
Dim oLOD As LevelOfDetailRepresentation  
Dim oAsmCompDef As ComponentDefinition  
oAsmCompDef = doc.ComponentDefinition
    Try
        oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("LevelofDetail1").Activate(True)
        Catch
        Dim nLOD As LevelOfDetailRepresentation
        nLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add("LevelofDetail1")
        oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("LevelofDetail1").Activate(True)
    End Try
End If

Please mark as a solution if somehow I got it right.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report