AnsweredAssumed Answered

VBA Show center of mass symbol

Question asked by Joshua Cote on Sep 7, 2020
Latest reply on Sep 16, 2020 by Austin Schukar

I am writing a macro in VBA to automatically create views for a shipping / lifting drawing.

I am missing how to import the center of mass symbol.

I have tried recording using import model items and it gives me

vAnnotations = Part.InsertModelAnnotations3(0, 0, True, True, False, True)

But the second "0" doesnt do anything.

I then tried recording using the right click "show" on the feature.

boolstatus = Part.Extension.SelectByID2("Center of Mass@prt1-1@Drawing View9", "CENTEROFMASS", 0, 0, 0, False, 0, Nothing, 0)

That is closer, but without the name of the center of mass & view, i am unable to do this for every view/page.



Currently i have it;

  1. getting a list of files from a directory
  2. Copying "Sheet1" of a drawing and renaming it to match the part file
  3. opening the part file, creating (3x) 3d sketches one for bounding box, one for center of mass, and finally one for suggested sling locations/angles.
    1. While it has the part open it creates a "Center Of Mass Feature"
    2. It also adds a display state, and hides all other reference geometry but these sketches.
  4. Adding an isometric view centered in the sheet of the part in the correct display state onto the correct sheet
  5. importing the model dimensions that are marked for the drawing, and locating them about right.
  6. Adding a view label with the name of the part file.