Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Design View Error

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

iLogic Design View Error

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.

1 REPLY 1
Message 2 of 2
adam.nagy
in reply to: Anonymous

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

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

Post to forums  

Autodesk Design & Make Report