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: 

Suppressing a component without using the components name

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
rockportbusiness
213 Views, 6 Replies

Suppressing a component without using the components name

I need to suppress a component whose name is going to change. Is there a way to suppress the part without referencing its name, maybe using a part number or something like that? I have an assembly that is use as a template, I adjust the size with an external rule to my needs, and then I copy the assembly and parts under different names . Also if you have any tips on linking part parameter to user parameter in a main assembly, even if the name of the part and assembly change, please share. I'm very new to this and your help would be appreciated.

6 REPLIES 6
Message 2 of 7

You can do that on each iproperty. Let me know which you choose!

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

With a stock number.

Message 4 of 7

Could you help please

 

Message 5 of 7

Hi @rockportbusiness.  How can this component be identified, if not by its name?  Is there anything else unique about it that could be used to identify it?  Once we can find this component by code, we can simply run an iLogic rule that will check the value of the 'Stock Number' iProperty of the assembly, and if its value is a certain value, then it will suppress that component, and if the value is different, it will unsuppress the component, or not do anything.

 

Are you familiar with the process of 'stabilizing component browser names" in your assembly?  This is essentially the process of renaming all of the assembly components within your template assembly to new unique, but meaningful names.  I'm not talking about changing the names of the files, just the labels that are automatically assigned to the components as you see them within the model browser tree.  Their names usually have something like ":1", or ":2" after them, in order to keep each name unique, but by default these are usually named as the file names.  If you just change their names within the model browser tree, to something other than file name or part number, but still meaningful, that will stabilize their names for you.  What I mean is, when you replace that component with another one, so that it is pointing to a different source model file, the name of the component, as seen in the model browser tree, will stay the same.  When this is the case, you can always find that component within the assembly by its name, within your iLogic rule codes, even after they have been replaced with different source files.  This has been a common practice talked about here on this forum, and on a few different user's personal Blogs, so you could probably search around for some codes to do the renaming part for you, if you do not want to do it manually.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 7

Sorry for the late reply, totally forgotten due to the amount of other questions!

 

Dim a As AssemblyDocument = ThisAssembly.Document
Dim acd As AssemblyComponentDefinition = a.ComponentDefinition
Dim ac As ComponentOccurrence
Dim YC As String = "Your Condition"
For Each ac In acd.Occurrences
Dim d As Document = ac.Definition.Document

If d.PropertySets.Item(3).Item("Stock Number") Is YC Then

'If Not d.PropertySets.Item(3).Item("Stock Number") Is YC Then
ac.Suppress

End If
Next

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

Well that's a eye opener. Thank you so much and keep up the good work.🙂

 

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report