iLogic: Remove Patterns with a QTY of 0

iLogic: Remove Patterns with a QTY of 0

Anonymous
Not applicable
585 Views
2 Replies
Message 1 of 3

iLogic: Remove Patterns with a QTY of 0

Anonymous
Not applicable

Hello,

 

I am trying to create a template assembly for a project that will require the rapid generation on 100's of similar conveyors made of modular pieces. Each will have a typical 5' drive assembly and a 5' tail assembly.  For lengths of 20' and greater, a repeating pattern of 10' will be used.  I've got the assembly work generate the appropriate number of 10' lengths based on whatever I specify as my overall length except when I need a length that is under 20'.  This causes an issue with the pattern generating the 10' section as having a QTY of 0 and throws an error.

Is there an iLogic rule that could delete the assembly and 10' section when the QTY equals 0?

Thanks!

0 Likes
586 Views
2 Replies
Replies (2)
Message 2 of 3

bradeneuropeArthur
Mentor
Mentor

Hi try to use this for vba and vb.net:

 

Public Sub Main()

Dim a As AssemblyDocument
Set a = ThisApplication.ActiveDocument

Dim b As AssemblyComponentDefinition
Set b = a.ComponentDefinition

Dim c As OccurrencePattern

For Each c In b.OccurrencePatterns
If c.OccurrencePatternElements.Count = 0 Then
c.Delete
End If
Next


End Sub

for I-logic:

Public Sub main()

Dim a As AssemblyDocument
a = ThisApplication.ActiveDocument

Dim b As AssemblyComponentDefinition
b = a.ComponentDefinition

c As OccurrencePattern

For Each c In b.OccurrencePatterns
If c.OccurrencePatternElements.Count = 0 Then
c.Delete
End If
Next

End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 3

Anonymous
Not applicable

Hi bradeneurope

Thanks for the reply.  I'm just getting started with this break away from the snippits.  I'm not quite sure where to input my pattern name and determining parameters.

 

When the parameter "MD_QTY" is  0

then the pattern that I would like to delete is called "TYP Middle Assembly Pattern"

That assembly contains the component "947-00-MD-18:1" and it would need to be deleted.

 

Where can I input that information in the string?

Also, Where can I read up on the basics of vba?

 

Thanks again!

0 Likes