Ilogic to update design view in assembly

Ilogic to update design view in assembly

Anonymous
Not applicable
750 Views
3 Replies
Message 1 of 4

Ilogic to update design view in assembly

Anonymous
Not applicable

I have an assembly that contain subassembly with Ilogic to control occurence visibility,

what i'm trying to do, is make an Ilogic in the main assembly to update all subassembly to be  associative design view representation to default

 

I've been trying a few different rules, but i missing something to make it work well.

 

If someone have an idea that will be very appreciated

Capture.JPG

0 Likes
Accepted solutions (1)
751 Views
3 Replies
Replies (3)
Message 2 of 4

dgreatice
Collaborator
Collaborator
Accepted solution

Hi,

 

You can try this code:

 

Dim oAssydoc As AssemblyDocument

oAssydoc = ThisApplication.ActiveDocument

 

Dim oCompDef As AssemblyComponentDefinition

oCompDef = oAssydoc.ComponentDefinition

 

Dim oCC As ComponentOccurrence

oCC = oCompDef.Occurrences.Item(1) 'or

'oCC = oCompDef.Occurrences.ItemByName("type here your component name")
   
'default = Representation View at Occurence index 1
'
'true = Assosiative are Enable

Call oCC.SetDesignViewRepresentation("Default", , True)

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 3 of 4

Anonymous
Not applicable

Many thanks dgreatis , this code doing exactly what I was looking for.

0 Likes
Message 4 of 4

KenVaessen
Enthusiast
Enthusiast
	'Representation on Default and associative 
	Dim doc As AssemblyDocument = ThisDoc.Document
	Dim oAsmCompDef As ComponentDefinition
	Dim oCompOcc As Inventor.ComponentOccurrence
	oAsmCompDef = doc.ComponentDefinition
	For Each oCompOcc In oAsmCompDef.Occurrences
	If oCompOcc.Visible = True Then
	If oCompOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
	oCompOcc.SetDesignViewRepresentation("Default", True)
	Else
	End If
	Else
	End If
	On Error Resume Next
	Next
	ThisApplication.ActiveView.Fit
0 Likes