iLogic Design View Error

iLogic Design View Error

Anonymous
Not applicable
654 Views
1 Reply
Message 1 of 2

iLogic Design View Error

Anonymous
Not applicable

I'm getting an infrequent error with my code. Occasionally I get this error:

1.png

 

What does this mean and how can I fix it? Here's my code:

 

Dim doc as AssemblyDocument = ThisDoc.Document  
Dim oAsmCompDef As ComponentDefinition  
oAsmCompDef = doc.ComponentDefinition 
Dim oCompOcc As Inventor.ComponentOccurrence
For Each oCompOcc in oAsmCompDef.Occurrences
oCompOcc.SetDesignViewRepresentation("Default", True)
Next

ThisApplication.ActiveView.Fit

 Any help would be greatly appreciated. Thanks guys.

0 Likes
655 Views
1 Reply
Reply (1)
Message 2 of 2

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

When trying to find the issue, first you can try to comment out more and more of your code until the error goes away.

In your case the first choice would be commenting out 

oCompOcc.SetDesignViewRepresentation

 

Then if you found the line where the error happens, you can place it inside a try/catch and bring up a dialog with some info about the object where the error happened. E.g.:

Dim doc as AssemblyDocument = ThisDoc.Document  
Dim oDim doc as AssemblyDocument = ThisDoc.Document  
Dim oAsmCompDef As ComponentDefinition  
oAsmCompDef = doc.ComponentDefinition 
Dim oCompOcc As Inventor.ComponentOccurrence
For Each oCompOcc in oAsmCompDef.Occurrences
Try
	oCompOcc.SetDesignViewRepresentation("Default", True)
Catch
	MsgBox(oCompOcc.Name)
End Try 
Next

ThisApplication.ActiveView.Fit

 

Then try to make the same changes for the same object through the UI as well - it will probably fail there too, which should give you an idea about how to solve it.

 

Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes