Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read $PRPSHEET value with VB6 ?

Status
Not open for further replies.

DMichaels

Mechanical
Mar 5, 2002
22
0
0
US
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.
 
Replies continue below

Recommended for you

Bradley;
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.
 
"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."

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
 
DMichaels

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
 
I know this is an old thread but I ran across it in search of another old thread.

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.




 
Status
Not open for further replies.
Back
Top