Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

SolidWorks Doc props: from API?

Status
Not open for further replies.

rocheey

Industrial
Jan 21, 2001
230
This one *seems* easy enough: there are properties available
to link to drawings and models, even when 'manually' making parts, that are not listed in the standard File Properties tabs of "Summary", "Custom", or "Configuration Specific", but are available in a design table as properties, such
as "$PARTNUMBER" and "$PARENT".

Anyone know of a way to access these variables thru the API,
if a Design Table is not present?

 
Replies continue below

Recommended for you

For $PARTNUMBER see Configuration::UseAlternateNameInBOM
and Configuration::AlternateName

As for $PARENT, I am not familar with that. If you could give an example, it may wake up my brain.

Regg
 
This code is from Joe Jones at:
Example 7 - config props.swb
'****************************************************************
'
' Config Props.swb
' Joe Jones
' New Hampshire CAD ' 03/09/98
'
' Will write several custom properties to active configuration
' ***************************************************************
Dim swApp As Object
Dim Part As Object
Dim Configuration As Object
Dim ConfigName As String
Dim retval As Boolean

Sub main()
Set swApp = CreateObject ("SldWorks.Application")
Set Part = swApp.ActiveDoc

Set configuration = Part.GetActiveConfiguration
ConfigName = configuration.Name

' retval is True or False upon successful AddCustomInfo3 function
retval = Part.DeleteCustomInfo2 (ConfigName, "drawnby")
retval = Part.AddCustomInfo3 (ConfigName, "drawnby", _
30, "Joe Jones")

' will insert todays date
retval = Part.DeleteCustomInfo2 (ConfigName, "Date")
retval = Part.AddCustomInfo3 (ConfigName, "Date", 64, Str(Date))

retval = Part.DeleteCustomInfo2 (ConfigName, "LuckyNumber")
retval = Part.AddCustomInfo3 (ConfigName, "LuckyNumber", _
3, 345.99)

retval = Part.DeleteCustomInfo2 (ConfigName, "Success")
retval = Part.AddCustomInfo3 (ConfigName, "Success", 11, "Yes")

End Sub


Bradley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor