Accessing Custom Properties of unopened SolidWorks models

Discussion in 'SolidWorks' started by Chris Dubea, Sep 8, 2003.

  1. Chris Dubea

    Chris Dubea Guest

    Hi there,

    I'm doing some tweaking of my custom property routines, and have the
    following issue. I can modify the properties of a drawing easily
    enough, but is there a way to access the properties of a model in a
    view in a drawing without opening the model? I want to write a
    description of the part in my drawing custom property description
    field, and I'd like to get that description from the model's
    description custom property. I can certainly do this by opening the
    model, but this seems to be a rather un-elegant solution. One of the
    issues is if the model is large this all becomes rather time consuming
    and cumbersome.

    I use the model custom property in the drawing to display the
    description field using the $PRPSHEET functionality, but can't seem to
    figure out if this can be accessed from VB.

    Thanks in advance,

    Chris
     
    Chris Dubea, Sep 8, 2003
    #1
  2. Chris Dubea

    Chris Dubea Guest

    No, unfortunately, this isn't a general custom property. I'll keep
    poking around to see if I can figure out a less cumbersome way of
    doing this. I got it working by loading the model, but it's not what
    I'd call an elegant solution.

    Chris
     
    Chris Dubea, Sep 8, 2003
    #2
  3. Chris Dubea

    Mr. Pickles Guest

    Chris,

    No, Robert is right.

    You state you are using Custom Properties, in your part, and want the
    Drawing to have the "same" Custom Property as the part in the drawing view.

    If you are using $PRPSHEET to do what you want, then you are using a Custom
    Property that can be accessed, read, and written using Microsofts DSOFILE
    utility, which is available on the Internet.

    If you right-click on the part your want in Explorer, you will see a Custom
    tab, that will have your parts Custom Properties in it. If you are doing
    something other than what is listed here, you need to be more specific,
    other than saying "No, it isn't...."

    Perhaps you are wanting to get a Configuration Specific property instead?


    Mr. Pickles
     
    Mr. Pickles, Sep 9, 2003
    #3
  4. Chris Dubea

    Heikki Leivo Guest

    I use the model custom property in the drawing to display the
    By using VB, you can easily write a macro to get the selected model handle
    and write custom properties. If the drawing is open, the model is loaded as
    well in most cases, unless the drawing is a lightweight drawing or the
    models are lightweight in an assembly. In a such case the model has to be
    loaded to get the model handle. Refer to API help on custom properties.

    Hope this was what you were wondering!

    -h-
     
    Heikki Leivo, Sep 9, 2003
    #4
  5. Chris Dubea

    Chris Dubea Guest

    Absolutely. Thank you. I had the name of the file, then I used
    GetOpenDocumentbyName to get a pointer to it that I could pass to
    CustomInfo2 to get the custom property I wanted.

    Trivial almost. Thank you very much for the suggestion.

    The dsofile thing was not appropriate because I'm transitioning all my
    custom properties to be configuration specific and dsofile doesn't let
    you get at those.

    Thanks to all who commented.
     
    Chris Dubea, Sep 9, 2003
    #5
  6. Chris Dubea

    Tony O'Hara Guest

    As you have discovered, SWX will not allow you to do anything with Config
    Properties outside of SWX.
    However, what you can do is launch SolidWorks invisibly, do the task and end
    SolidWorks session. Have a look at "SolidWorks Visible or BackGround
    Example" in SWX API Help.

    --
    Tony O'Hara
    Melbourne, Australia.

    Absolutely. Thank you. I had the name of the file, then I used
    GetOpenDocumentbyName to get a pointer to it that I could pass to
    CustomInfo2 to get the custom property I wanted.

    Trivial almost. Thank you very much for the suggestion.

    The dsofile thing was not appropriate because I'm transitioning all my
    custom properties to be configuration specific and dsofile doesn't let
    you get at those.

    Thanks to all who commented.[/QUOTE]
     
    Tony O'Hara, Sep 10, 2003
    #6
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.