iLogic Part Visibility in SubAssembly Design View Representation

iLogic Part Visibility in SubAssembly Design View Representation

Curtis_Waguespack
Consultant Consultant
1,966 Views
4 Replies
Message 1 of 5

iLogic Part Visibility in SubAssembly Design View Representation

Curtis_Waguespack
Consultant
Consultant

I feel like I've done this in the past, but I can't seem to find a way to do it now,  and I can't find an example anywhere, so I thought I'd ask and see if anyone could help.

 

What I'm trying to do is turn off the visibility of a part in a subassembly, from the top level assembly, but do so by modifying the sub assembly's design veiw rep. Attached is a simple example data set with a couple of rules.

 

When I run the rule called "Turn Off" it turns the visibility of the part off from the top level assembly, but if you open the subassembly (Lego Assembly2) you will see that the part is not turned off, and the view representation called "Default" has not been modified.

 

iLogic Part Visibility in SubAssembly Design View Representation.PNG

 

 

 

If you walk through this same workflow manually, by right-clicking on the part and turning it off while the subassembly is set to a View Rep, you receive a message prompt asking if you want to modify the view rep or make it not associative.

 

 

iLogic Part Visibility in SubAssembly Design View Representation2.PNG

 

 

So the goal is to turn off the part in the subassembly by updating the Veiw Represetnation. Am I just overlooking something, or is there not a way to do this?

 

Thanks in advance,

Curtis

 

 

The attached files were last saved in Inventor 2015

 

EESignature

0 Likes
Accepted solutions (1)
1,967 Views
4 Replies
Replies (4)
Message 2 of 5

nmunro
Collaborator
Collaborator
Accepted solution

Curtis,

 

See the attached zip. I think I've modified the Turn-Off rule to perform the way you were expecting. Not a lot of care taken with the code and I don't have much experience with iLogic (yikes, no intellisense). I did not modify the Turn-On rule.

 

Neil

        


https://c3mcad.com

Message 3 of 5

Curtis_Waguespack
Consultant
Consultant

Thanks Neil!

 

I'm posting the code here in case it helps someone's search in the future.

 

' set a reference to the assembly component definintion.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'define the Component Occurrence collection
Dim oCompOcc As Inventor.ComponentOccurrence 
Dim oSubCompOcc As Inventor.ComponentOccurrence
'set top level view rep to Default
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default").activate

For Each oCompOcc in oAsmCompDef.Occurrences
	oCompOcc.SetDesignViewRepresentation("Default",, True) 'True sets the view rep to be associative
Next

Dim occurDocDef as AssemblyComponentDefinition

'modify actual subassembly document
If oCompOcc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
	'get assembly component defintion in the subassembly document
	occurDocDef = oCompOcc.Definition
	
	For Each oSubCompOcc in occurDocDef.Occurrences
		If oSubCompOcc.Name = "Lego Brick 2x2:2" Then
			oSubCompOcc.Visible = False
		End If
	Next
	
End If

EESignature

Message 4 of 5

cencinaNB2ET
Advocate
Advocate

I have seen many threads on this topic but Im still not sure how to achieve a simple task.

When I run rules confiscating a parent Assembly and its Sub-assemblies by running rules at a top level of an assembly which are found in the sub-assemblies, the sub-assembly it self will change its view representation to master and non - associative.

I want the default or another view representation to always stay associative despite the configuration.

 

I dont want to make things invisible in the sub assembly but rather just change the  specific sub-assembly view representation.

 

Thank you

0 Likes
Message 5 of 5

Anonymous
Not applicable

I am trying to make this code into a parameter based code to go through my entire model and search for a specific parameter and if the part doesn't have the parameter the visibility is turned off. Is there a way to make that happen? 

0 Likes