AnsweredAssumed Answered

Suppress Components in Assembly by File Property

Question asked by Daniel Silberstein on Feb 20, 2020
Latest reply on Feb 25, 2020 by Daniel Silberstein

Hello,

 

I am trying to create a macro to suppress certain parts in an assembly by a custom file property called "code". The value of code will be something like "metal" or "wood". I will create a configuration for metal where all the wood parts are suppressed and vice-versa.

 

This post has most of the code I need. 

 Macro to suppress assembly components 

 

However, I can't get the code to read the file property. I am using the following example

bool = swCustProp.Get4("Property_Name", False, val, valout)

2019 SOLIDWORKS API Help - Get Custom Properties of Referenced Part Example (VBA) 

When I use this code, I get an error for "val" that says the argument is not optional.

 

What else do I need to add to my code to make it suppress the files in the assembly that don't have the code in the configuration I am using.

 

 

NOTE: I am not using advanced component select because of the reasons found in this post.

Advance component select 

Outcomes