James Liao

SOLIDWORKS vba Replace replacement parts according to specifications

Discussion created by James Liao on Oct 29, 2020
Latest reply on Oct 31, 2020 by James Liao

Is there an example to replace the part syntax to achieve
1. The user executes the macro
2. Enter the specifications in the macro window,
3. The macro program is placed in the designated catalog, and the replacement parts are replaced according to the specifications

 

for example:
1. The component AA.sldasm is fixed as A_100.sldprt, B_100.sldprt, C_100.sldprt


2. Known parts
   A Parts, according to their specifications, are A_100.sldprt, A_200.sldprt, A_300.sldprt.
   B parts, according to their specifications, are B_50, B_150, and B_150.
  C parts, according to their specifications, are C_20, C_40, C_60, C_80.

 

3. Open AA.sldasm, execute the macro, enter the specifications, change A to 200, B to 150, and C to 80
4. Through the macro, replace the original parts of AA.sldasm with the following
A_100.sldprt-> A_200.sldprt
B_100.sldprt-> B_150.sldprt
C_100.sldprt-> C_80.sldprt

 

Is it possible? Are there examples for reference? Thank you all

Outcomes