iLogic pattern in pattern

iLogic pattern in pattern

viktor.van.hove
Participant Participant
1,031 Views
4 Replies
Message 1 of 5

iLogic pattern in pattern

viktor.van.hove
Participant
Participant

Hello everyone,

I made a small assembly with some patterns and I used iLogic to enable and disable some patterns (using a form for that). But I want to pattern (big pattern) this assembly so that I can have multiple small assemblies in the same file. The issue that I have is that when I made the big pattern and try to disable a pattern in the small assembly iLogic cannot find that pattern anymore. If I delete the big pattern for the total assembly then everything works again. 

So my question is can you somehow still suppress a pattern in a pattern when using iLogic?

 

The iLogic rule is also pretty basic to suppress the pattern.

If Bracing_width_top = False Then
Component.IsActive("Bracing_width_top") = False
Else Component.IsActive("Bracing_width_top") = True
End If

 Many thanks if someone can help and best regards,

Viktor

0 Likes
1,032 Views
4 Replies
Replies (4)
Message 2 of 5

Sergio.D.Suárez
Mentor
Mentor

Could you share an image of the structure of your assembly to analyze what you need? If you could share a basic example assembly to visualize the action it would be easier to try to help you. Cheers


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 5

viktor.van.hove
Participant
Participant

Hello @Sergio.D.Suárez,

i made a basic example of what I want to find out. I made 2 parameters to hide the a set of beams. I can hide the beams if I do not have pattern 7. If I have pattern 7 then I get the errors.


Aantekening 2020-04-22 155818.png

 

 



Many thanks and best regards,

Viktor

 

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor

Do you want the code to only effect Element1, and not Element2?

Tip 1:

In is generally reccomended that you rename your browser nodes to help uniquely identify and clarify what each item is.  This will also help out on the programming side.

Tip 2:

It is also good practice, when searching through assembly ComponentOccurrences by their Names, to loop through them checking if it's {Name.Contains("pattern name")}, so you don't have to worry about the colon (:) and Integer at the end of the Name.

 

When I opened your files, it couldn't find certain external rules, but within the one local rule in the assembly file, I crafted the following rule that seems to be working the way you want it to.

It was definately a pain, though, because of how deep you have to dig, and how many checks you have to put in place to help eliminate possible errors.

 

Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition

Dim oRectOccPatt As RectangularOccurrencePattern
Dim o1stLevelElement As OccurrencePatternElement
Dim o1stLevelOcc As ComponentOccurrence
Dim o2ndLevelPatt As RectangularOccurrencePattern
Dim o2ndLevelOcc As ComponentOccurrence

For Each oRectOccPatt In oADef.OccurrencePatterns
	If oRectOccPatt.Name.Contains("Component Pattern 7") Then
		For Each o1stLevelElement In oRectOccPatt.OccurrencePatternElements
			For Each o1stLevelOcc In o1stLevelElement.Occurrences
				If o1stLevelOcc.IsPatternElement Then
					If o1stLevelOcc.PatternElement.Parent.Type = ObjectTypeEnum.kRectangularOccurrencePatternObject Then
						o2ndLevelPatt = o1stLevelOcc.PatternElement.Parent
						If o2ndLevelPatt.Name.Contains("Component Pattern 2") Then
							On Error Resume Next
							If Top_braces_width = True Then
								For Each o2ndLevelOcc In o2ndLevelPatt.ParentComponents
									If o2ndLevelOcc.Suppressed = True Then
										o2ndLevelOcc.Unsuppress
									End If
								Next
							Else
								For Each o2ndLevelOcc In o2ndLevelPatt.ParentComponents
									If o2ndLevelOcc.Suppressed = False Then
										o2ndLevelOcc.Suppress
									End If
								Next
							End If
						ElseIf o2ndLevelPatt.Name.Contains("Component Pattern 3") Then
							On Error Resume Next
							If Bottom_braces_width = True Then
								For Each o2ndLevelOcc In o2ndLevelPatt.ParentComponents
									If o2ndLevelOcc.Suppressed = True Then
										o2ndLevelOcc.Unsuppress
									End If
								Next
							Else
								For Each o2ndLevelOcc In o2ndLevelPatt.ParentComponents
									If o2ndLevelOcc.Suppressed = False Then
										o2ndLevelOcc.Suppress
									End If
								Next
							End If
						End If
					End If
				End If
			Next
		Next
	End If
Next

 

 

I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" 👍.

 

Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.

  • Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
  • MessageBox, InputBox, and InputListBox Size & Format Options Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
  • SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here
  • Create DocumentSubTypeEnum Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

viktor.van.hove
Participant
Participant

Hello WCihfiend,

sorry for the delay I thought I answered this.
I will try this and come back to you.

Already many thanks for the response!

Greetings Viktor

0 Likes