suppressing a part of a pattern with an external ilogi rule

suppressing a part of a pattern with an external ilogi rule

Anonymous
Not applicable
527 Views
5 Replies
Message 1 of 6

suppressing a part of a pattern with an external ilogi rule

Anonymous
Not applicable

Hi.

I need some help with working with pattern and using ilogic.

 

I have a main assembly A2.iam.

Inside A2.iam I have a subassembly A1.iam.

Inside A1.iam I have a pattern "Pat 01".

I need to supress some elements of this pattern (not a whole pattern) with an external rule, running from main assembly (A2.iam).

So inside subassembly A1.iam I have a rule which looks like this:

 

Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

Dim oPattern1 As OccurrencePattern
oPattern1 = oDoc.ComponentDefinition.OccurrencePatterns.Item("Pat 01") 
Dim oElement1 As OccurrencePatternElement
oPattern1.OccurrencePatternElements.Item(2).Suppressed = True

This rule will suppress second element of this pattern. It works when run from subassembly level.

I want to run this rule with an external rule in main assembly, which looks like this:

iLogicVb.RunRule("A 1:1", "Rule1")

However when I run this external rule  it doesn't work - I get an error message.

I know the reason for this - when running an external rule it looks for a pattern in main assembly and not in subassembly.

Do you know solution for this?

 

 

 

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

clutsa
Collaborator
Collaborator
Accepted solution
Dim oDoc As AssemblyDocument
oDoc = ThisDoc.Document '<------

Dim oPattern1 As OccurrencePattern
oPattern1 = oDoc.ComponentDefinition.OccurrencePatterns.Item("Pat 01") 
Dim oElement1 As OccurrencePatternElement
oPattern1.OccurrencePatternElements.Item(2).Suppressed = True

and don't forget to add

InventorVb.DocumentUpdate()

to the external rule

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 3 of 6

Anonymous
Not applicable

The easiest solutions are hardest to find.

Thanks a lot. Now it works.

0 Likes
Message 4 of 6

j_weber
Mentor
Mentor

Thats great, this is what a customer of mine want. 

Now, is it possible to pick first the pattern in the assembly and after that pick the elements to suppress. 

Tha background for this is that in the assembly are many pattern exist and the customer didn't such in the browser. 

 

And the second, he want hide a element and dont suppress. But I think that is not possible. 




Jörg Weber
CAD Systemtechniker für AutoCAD, Inventor, Vault





0 Likes
Message 5 of 6

clutsa
Collaborator
Collaborator
Dim oDoc As AssemblyDocument
oDoc = ThisDoc.Document

Dim oPattern1 As OccurrencePattern
Dim oCompOcc As ComponentOccurrence
Dim oElement1 As OccurrencePatternElement
oCompOcc = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select an Element")
If oCompOcc.IsPatternElement Then 
	oElement1 = oCompOcc.PatternElement
	oElement1.Occurrences.Item(1).Visible = False	
End If

I believe you're in luck. If I understood your question right the code above should do exactly what you want. 

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

j_weber
Mentor
Mentor

Cool, fantastic, brilliant

Thats what my customer want. 

Perheps it is possible to do this in a loop so that he can do this more than once in a step.

but I say it again, great job. 

Thanks a lot. 




Jörg Weber
CAD Systemtechniker für AutoCAD, Inventor, Vault





0 Likes