Macro insert a CutList

Hi all

I'm looking to create a VBA macro in SolidWorks to automate the updating of Cut Lists in my drawings.

Here is my background:

  • I often work from already existing drawings with all my views.
  • When I replace the referenced Part with another Part, the Cut List is not automatically updated.

My goal with this macro:

  1. Delete all existing weld lists in the drawing.
  2. Insert a new Cut List based on view 1 of the drawing.
  3. The new table should ideally use a specific template and respect the anchor point defined in the template.

I've tried several approaches with InsertWeldmentTable, InsertWeldmentCutList or InsertWeldmentTableAnnotation, but I always run into 438 or 91 errors, related to view selection or methods not available in VBA.

Could someone help me find a reliable method in VBA to:

  • Delete old Cut Lists
  • Automatically insert the new one on view 1 with the template anchor point

Thank you in advance for your help and advice! :wink:

Hello;

Why try to do this update in the drawing when Solidworks allows you to do it automatically in the room?
image
To be associated with " automatic update of the welded part list" in the settings of the Template property of your drawings:


=> This should save you a macro...