Read $PRPSHEET value with VB6 ?
Read $PRPSHEET value with VB6 ?
(OP)
How can I read a $PRPSHEET value in VB6 ? I have tried the following without success:
----
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
Customer_string = "$PRPSHEET:" & Ch(34) "Customer_dwg_name" & Chr(34)
Customer_dwg_name = Part.custominfo2("", "Customer_string")
MsgBox Customer_dwg_name
----
The MsgBox returns nothing. It does not work for standard SW properties. It does not work with $PRP values either.
This does work very nicely for normal custom properties.
----
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
Customer_string = "$PRPSHEET:" & Ch(34) "Customer_dwg_name" & Chr(34)
Customer_dwg_name = Part.custominfo2("", "Customer_string")
MsgBox Customer_dwg_name
----
The MsgBox returns nothing. It does not work for standard SW properties. It does not work with $PRP values either.
This does work very nicely for normal custom properties.






RE: Read $PRPSHEET value with VB6 ?
All the detail is not listed here, but may get you started.
Description = Part.CustomInfo("Description")
txtSfDescription.Text = Description
To get a better idea of real teaching, go to web site:
http://www.nhcad.com/old/html/example7.html and
http://www.nhcad.com/old/html/cprops.html
Bradley
RE: Read $PRPSHEET value with VB6 ?
Thanks for reply. I'm not sure where the difference is in your suggestion. Do mean the part.custominfo will work, whereas part.custominfo2 (as in my example) does not work ?
I suspect my problem is in the "Set Part = swApp.ActiveDoc" area, because I think this information is contained in the active sheet or view, or something.
Thanks, Don.
RE: Read $PRPSHEET value with VB6 ?
Yep, that's it. You just need to drill down a bit further into the swApp.ActiveDoc object and grab the drawing sheet. Sorry I don't know the specific call but it's definitely in the API help file.
Chris Gervais
Mechanical Designer
American Superconductor
RE: Read $PRPSHEET value with VB6 ?
I think that ModelDoc.CustomInfo2() is only for part properties, not for drawing properties.
Mabe you should try DrawingDoc.GetSheetNames(), with the drawing as active doc.
Regards
RE: Read $PRPSHEET value with VB6 ?
I have only just begun to research drawing properties but the best I can figure is that $PRPSHEET:"property" refers to custom properties belonging to the model whereas $PRP:"property" refers to custom properties belonging to the drawing. $PRPSHEET: and $PRP: are just used in the drawing format to tell SolidWorks where to get the custominfo from. They are not included when getting the info via an API call. In the case of the original question, fieldname would be "Customer_dwg_name"
To get the custom property from the model, I believe you have to make the model the active document then use the ModelDoc.GetCustomInfo2 (configuration, fieldname) API call to retieve it.
ModelDoc.GetCustomInfo2 (configuration, fieldname) can be used on a drawing but since it does not contain configuration specific custom properties, the configuration parameter is set to an empty string. I generally use ModelDoc.GetCustomInfo2 ("",fieldname).
Oh yes, Models and Assemblies can also use non configuration specific custom properties. It all depends on what information you want to store and whether it pertains to all configurations or an individual configuration.