Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Suppress occurrence of pattern with iLogic

9 REPLIES 9
Reply
Message 1 of 10
fakeru
2305 Views, 9 Replies

Suppress occurrence of pattern with iLogic

Hello!

Is it possible to suppress an occurrence of a pattern in part enviroment using iLogic? I saw something for aseembly enviroment, but I can't make it work for part. My iLogic knowledge is quite basic.

If you have a rule for this, please help me!

 

Regards

Autodesk Inventor 2015 Certified Professional
9 REPLIES 9
Message 2 of 10
CCarreiras
in reply to: fakeru

Hi!!

 

I think is not possible because the software can't guess which occurrence to suppress.

 

Instead, you may create several Patterns, each one with the propper configuration, and use ilogic to supress the Patterns you don't need for each specific case.

 

Regards

 

  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.

 

CCarreiras

EESignature

Message 3 of 10
Telson.Hadden
in reply to: CCarreiras

Yes, it is possible.  difficult, but possible - and you have to be careful not to try to change the suppression on the first item, because it will error out without telling you why.

 

 Dim oPattern As RectangularPatternFeature 
 oPattern = ThisDoc.Document.ComponentDefinition.Features.RectangularPatternFeatures.Item("<pattern name>")
 
 Dim oElement As FeaturePatternElement
 
 	For Each oElement In oPattern.PatternElements
		if oElement.index = 1 then
			'do nothing - you're not allowed
		else
			oElement.suppressed = True 'or false
		end if
	Next 
ThisDoc.Document.update

I know this is an old post, but they are everywhere, with no solution to be found.

Message 4 of 10
serpennica
in reply to: Telson.Hadden

Inventor 2017

I'm working with a "sketch driven pattern" in a part.

Was looking at the script and only got the whole

 pattern to suppress. Was not able to get individual occurrences suppressed.

how do we get the 5, 6,7 occurrence to suppress.

have not seen much on this, mostly with assemblies,

any help, thanks Sergio 

 

 

sketch driven pattern-01.JPG

Message 5 of 10

Please read your last topic.

And

https://www.cadlinecommunity.co.uk/hc/en-us/articles/210054325-Inventor-2017-quick-tip-Set-rules-to-...

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
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 !

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
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: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 !

Message 6 of 10

the option of pattern properties is not what i was looking for.

that option only gives me an if statement to suppress the whole pattern.

I was looking to suppress the occurrences one at a time.

thanks for the help.

Message 7 of 10
DRoam
in reply to: serpennica


@serpennica wrote:

Was looking at the script and only got the whole

 pattern to suppress. Was not able to get individual occurrences suppressed.

how do we get the 5, 6,7 occurrence to suppress.

have not seen much on this, mostly with assemblies,


This isn't a question of part vs. assembly, it's simply a question of programming. There are many ways to only suppress those occurrences. Probably a Select Case is one of the simpler methods:

 

Dim oPattern As RectangularPatternFeature 
oPattern = ThisDoc.Document.ComponentDefinition.Features.RectangularPatternFeatures.Item("<pattern name>")
 
For Each oElement As FeaturePatternElement In oPattern.PatternElements
	Select Case oElement.index
		Case 5,6,7
			oElement.suppressed = True 'or false
	End Select
Next

ThisDoc.Document.update
Message 8 of 10
DRoam
in reply to: DRoam

Actually, to suppress specific elements, you don't even need to iterate through the elements. You can suppress them directly like this:

 

Dim oPattern As RectangularPatternFeature
oPattern = ThisDoc.Document.ComponentDefinition.Features.RectangularPatternFeatures.Item("<pattern name>")
 
Dim oElements As FeaturePatternElements = oPattern.PatternElements

oElements(5).Suppressed = True
oElements(6).Suppressed = True
oElements(7).Suppressed = True

ThisDoc.Document.update
Message 9 of 10
serpennica
in reply to: DRoam

Perfect. That was it.

changed the rectangular pattern to sketch driven pattern and used a function to drive the true/false. now I can get a dialog box "forms" to select the element i want to remove.

thank you.

 

Pattern Rules.JPG

Message 10 of 10
serpennica
in reply to: DRoam

Perfect. That was it.

changed the rectangular pattern to sketch driven pattern and used a function to drive the true/false. now I can get a dialog box "forms" to select the element i want to remove.

thank you.

 

Pattern Rules.JPG

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

Post to forums  

Autodesk Design & Make Report