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:Ā 

Rule to suppress features containg certain word

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
fakeru
481 Views, 5 Replies

Rule to suppress features containg certain word

Hi

Would it be possible that a rule can suppress all part's features that contain in their name a certain word.

I use to rename features for better workflow. More features that form a part of the model can contain same word, for instance "foot": foot_extrusion; foot_plate and so on.

When working with ilogic I have to specify each feature name, but I was thinking that may be would be easier to suppress the features by their name.

 

Thanks

Alexandru

Autodesk Inventor 2015 Certified Professional
5 REPLIES 5
Message 2 of 6
rossano_praderi
in reply to: fakeru

Hi Alexandru,

this piece of code che be your solution...

 

Sub Main
	Fsuppress(True)
	Fsuppress(False)
End Sub

Private Sub Fsuppress(suppress As Boolean)
myparam = InputBox("Feature Name", "Feature suppress", "")
If myparam <> "" Then
	Dim oDoc as PartDocument
	oDoc = ThisApplication.ActiveDocument
	Dim oFeature As PartFeature
	For Each oFeature In oDoc.ComponentDefinition.Features
		If oFeature.Name.ToUpper.Contains(myparam.ToUpper) Then
			oFeature.Suppressed = suppress
			oDoc.Update
		End If
	Next
End If
End Sub

 Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 3 of 6
fakeru
in reply to: rossano_praderi

Thank you, this is almost what I wanted.

The difference is that, I don't need the input window.

For example I want a rule when it will be run to suppress al features with "nozzle" word in their name.

I tried to adapt the code, but didn't manage šŸ˜ž

 

Autodesk Inventor 2015 Certified Professional
Message 4 of 6
rossano_praderi
in reply to: fakeru

Hi Fakeru, let me know if this is helpful to you.

 

myparam = "YOUR TEXT"
Dim oDoc as PartDocument
oDoc = ThisApplication.ActiveDocument
Dim oFeature As PartFeature
For Each oFeature In oDoc.ComponentDefinition.Features
  If oFeature.Name.ToUpper.Contains(myparam.ToUpper) Then
	oFeature.Suppressed = True
	oDoc.Update
  End If
Next

 

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 5 of 6
fakeru
in reply to: rossano_praderi

Yes, it works! Thank you so much!

Autodesk Inventor 2015 Certified Professional
Message 6 of 6
rossano_praderi
in reply to: fakeru

You are welcome.


--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------

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

Post to forums