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

iLogic Rule for suppressing Assembly features and Sub Assembly Features

1 REPLY 1
Reply
Message 1 of 2
vince480
1081 Views, 1 Reply

iLogic Rule for suppressing Assembly features and Sub Assembly Features

Hi There

 

I'm just exploring the world of iLogic in inventor. One thing I would like to do which will save alot of time in my work process is:

 

Being able to suppress and unsurpress Assembly Level Features and Sub Assembly Level Features which contain a particular word i.e. "cut"

 

Any help with this would be greatly appreciated.

 

Thanks

 

Vince

1 REPLY 1
Message 2 of 2
vince480
in reply to: vince480

Through various research (alot of references taken from here). This is what I have come up with so far.

 

I've included LOD setting and creation. I'm sure my code/rule can be streamlined, in fact I welcome any comments to stream line this, as I'm fairly lacking in knowledge on this at present. This is a work in progress!

 

'This Rule will suppress or unsuppress any features with a name that starts with "Cutaway".
'It will also change the LOD to "Cutaway ON". If this LOD doesnt exist, it will create it.
'Turning off the Cutaways (Unsupressing the features) will change the LOD back to "Master".

'get user input as True or False
wfBoolean = InputRadioBox("Turn Cutaway Features On/Off", "Off", "On", True, "Assembly Cutaways")

'define the active assembly
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument  

'Set Level of Detail. Cutaways off = LOD "Master", Cutaways ON = LOD "Cutways ON" (if LOD doesnt exist, one is created).
Dim oLOD As LevelOfDetailRepresentation  
Dim oAsmCompDef As ComponentDefinition  
oAsmCompDef = oAssyDoc.ComponentDefinition 
If wfBoolean = False Then
Try 
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("Cutaway ON").Activate(True)
Catch
Dim nLOD As LevelOfDetailRepresentation
nLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add("Cutaway ON")
oLOD = nLOD
Finally
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("Cutaway ON").Activate(True)
End Try
Else
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("Master").Activate(True)
End If

'Set Any Features starting with the name "Cutaway" to be suppressed or Unsuppressed.

'Check all main assembly features
'set Cutaway Suppression
For Each oCutaway In oAssyDoc.ComponentDefinition.Features
	If Left(oCutaway.Name,7) = "Cutaway" Then
		oCutaway.Suppressed = wfBoolean
	End If
Next

'Check all referenced features 
Dim oDoc As Inventor.Document
For Each oDoc In oAssyDoc.AllreferencedDocuments
    'set Cutaway Suppression
    For Each oCutaway In oDoc.ComponentDefinition.Features
		If Left(oCutaway.Name,7) = "Cutaway" Then
			oCutaway.Suppressed = wfBoolean
		End If
	Next
Next

'update the files
InventorVb.DocumentUpdate()

 

 

 

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

Post to forums