×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SolidWorks Doc props: from API?

SolidWorks Doc props: from API?

SolidWorks Doc props: from API?

(OP)
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?

RE: SolidWorks Doc props: from API?

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

RE: SolidWorks Doc props: from API?

This code is from Joe Jones at:
http://www.nhcad.com/old/html/example7.html
Example 7 - config props.swb
'****************************************************************
'
' Config Props.swb
' Joe Jones
' New Hampshire CAD www.nhcad.com
' 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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources