iLogic turn off occurrence in a rectangular pattern (in an area that is moving)

iLogic turn off occurrence in a rectangular pattern (in an area that is moving)

Milan_Nosil
Advocate Advocate
1,164 Views
5 Replies
Message 1 of 6

iLogic turn off occurrence in a rectangular pattern (in an area that is moving)

Milan_Nosil
Advocate
Advocate

Hi all,

Will you help me create iLogic code please?

 

I have the assembly with a derived part (in the picture) and a lot of rectangular patterns in main assembly. 

image.png

 

 

 

 

 

 

Because the derivative part are moves, I need to write an iLogic code that will turn off occurrences after moving the part.

image.png

 

 

 

 

 

 

 

 

 

If it is possible to create a parameter that would determine the position and space (in the assembly) in which all elements of a particular rectangular array turn off.

 

Thank you very much for any advices.

Milan

0 Likes
Accepted solutions (1)
1,165 Views
5 Replies
Replies (5)
Message 2 of 6

Mark.Lancaster
Consultant
Consultant

@Milan_Nosil

 

Programming needs for Inventor should be asked in the Inventor Customization forum (for best results).  I will have the moderator relocate your posting there to best suit your needs.

 

https://forums.autodesk.com/t5/inventor-customization/bd-p/120

 

Also you should indicate what version of Inventor you're using.

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

0 Likes
Message 3 of 6

clutsa
Collaborator
Collaborator

I think that can be done but I'm going to need a better explanation. The selected item (highlighted blue) moves within that assembly. When the highlighted item is within a certain zone you want to change a pattern? 

Video of you updating the model manually would really help and also some idea of how you've created your assembly (I'm sure asking for that actual model is asking to much)

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 4 of 6

Milan_Nosil
Advocate
Advocate

Thank you for your message. There is the screencast video (https://autode.sk/2EcEzJi).

In the video, I show how rectangular pattern are modeled. At the end of the video I also show the rules for extrusion that I have my problem maybe solved (but it is very demanding in this number of parts).

 

 

Screencast will be displayed here after you click Post.

d79d45cb-34dc-4bde-b4bb-36d323c2fe5e

 

The rectangular patterns can be reworked if you need them.

Unfortunately, I will probably be unable to provide the model.

 

Thank you very much.

Milan

0 Likes
Message 5 of 6

clutsa
Collaborator
Collaborator
Accepted solution

Here is what I got...

Dim app As Inventor.Application = ThisApplication
Dim doc As AssemblyDocument = app.ActiveDocument
Dim results As InterferenceResults
Dim transObj As TransientObjects = app.TransientObjects
Dim objCol1 As ObjectCollection = transObj.CreateObjectCollection
Dim objCol2 As ObjectCollection = transObj.CreateObjectCollection
Dim compDef As AssemblyComponentDefinition = doc.ComponentDefinition
Const ClearanceZone As String = "clearanceZone:1" 'rename to meet your clearance zone

Dim ZoneObj As ComponentOccurrence = compDef.Occurrences.ItemByName(ClearanceZone)
ZoneObj.Visible = True 'can only detect if part is visible

'Add all parts from patterns to Collection - You could make this a sub if you want
For Each elem In compDef.OccurrencePatterns.Item("Component Pattern 4:1").OccurrencePatternElements
 For Each compOcc In elem.Occurrences
  compOcc.Excluded = False 'bring back parts that may have been removed
  objCol1.Add(compOcc)
 Next
Next
'same as above for another pattern
For Each elem In compDef.OccurrencePatterns.Item("Component Pattern 5:1").OccurrencePatternElements 
 For Each compOcc In elem.Occurrences
  compOcc.Excluded = False
  objCol1.Add(compOcc)
 Next
Next

'add the clearance zone
objCol1.Add(ZoneObj)

Dim IntResults As InterferenceResults
Dim result As InterferenceResult
IntResults = compDef.AnalyzeInterference(objCol1)
'MessageBox.Show("Results count = " & IntResults.Count, "Title")
For Each result In IntResults
 'check if the interference is with the cut zone 
 If result.OccurrenceOne.Name = ClearanceZone Then
  objCol2.Add(result.OccurrenceTwo) 'add to collection if found
  'MessageBox.Show(result.OccurrenceTwo.Name, "Title")
 End If
 'same as above just checking the other direction
 If result.OccurrenceTwo.Name = ClearanceZone Then
  objCol2.Add(result.OccurrenceOne)
  'MessageBox.Show(result.OccurrenceOne.Name, "Title")
 End If
Next

'remove found parts
For Each Occ In objCol2
 'MessageBox.Show(Occ.Name & " will be excluded", "Title")
 Occ.Excluded = True
Next

ZoneObj.Visible = False 'rehide zone 
InventorVb.DocumentUpdate() 'update part

You'll have to add a part that will float to where ever you want parts removed (just a brick shaped object with it's BOM structure set to referenece) anything the block touches will be remove.

 

 

 

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

Message 6 of 6

Milan_Nosil
Advocate
Advocate

YOU ARE AWESOME!!!

 

Smiley Wink Thank you very much Smiley Very Happy

0 Likes