Accessing Custom Properties of unopened SolidWorks models

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,
Reply to
Chris Dubea
Loading thread data ...
Hello Chris,
If this is a general custom file property, you can use the dsofile tool from Microsoft to give you access to that value. Please check the MSDN website
formatting link
and search for dsofile.
Best Regards,
Reply to
Robert V. Hanson
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.
Reply to
Chris Dubea
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
Reply to
Mr. Pickles
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!
Reply to
Heikki Leivo
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.
Reply to
Chris Dubea
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.
Reply to
Tony O'Hara

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.