Assign Custom Property to a Variable

Discussion in 'SolidWorks' started by Blair Sutton, Mar 17, 2006.

  1. Blair Sutton

    Blair Sutton Guest

    I want a custom property "Area" to be assigned to "SW-SurfaceArea" with
    a macro
    (or automatically to large number of existing files). For new files,
    I've added property to template.

    The manual way to do this is
    go to Custom Properties
    Property Name: Area
    Type: Text
    Value: "" (select from scrolldown)

    How do I add Property and value(referencing file) with a macro?

    I use the following line and get SW-SurfaceArea for Value.
    I need "SW-SurfaceArea" to be evaluated. How do I get the quotes?

    retval = Part.AddCustomInfo3("", "AREA",
    swCustomInfoText,"SW-SurfaceArea")

    Thanks, Blair

    BTW: I'd prefer a dynamic link, so I haven't used GetMassProperties
     
    Blair Sutton, Mar 17, 2006
    #1
  2. Blair Sutton

    Fye Guest

    Fye, Mar 17, 2006
    #2
  3. Blair Sutton

    Blair Sutton Guest

    Thanks Keith and Steve for the responses.

    Keith, Propagator does add "smart" mass properties which was what I
    wanted.

    Steve, Thanks for sharing your Macros. Batch-Add-Macros add the smart
    properties that I want.
    It also allowed me to peek inside and see that I had to put together a
    string with " in the form of ch(34) to keep the quotes necessary.

    Thanks for the useful help.

    Sincerely, Blair
     
    Blair Sutton, Mar 21, 2006
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.