×
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

API - How to Apply Method to Active Document

API - How to Apply Method to Active Document

API - How to Apply Method to Active Document

(OP)
I'm in the very beginning stages of learning the SWX API and I have a simple question.

In the following statement (cut from API Help), how do I have the method apply to whatever document is active rather than having to specifically name the file?

CODE

swApp.GetConfigurationCount("C:\calls5\part3.sldprt")

There is a preceding statement

CODE

Set Model = swApp.ActiveDoc
but I don't understand how to use that object to meet my need.

Thanks in advance.

--------------------
Bring back the HP-15
www.hp15c.org
--------------------

RE: API - How to Apply Method to Active Document

its something similar to this:


swApp.GetConfigurationCount(swApp.ActiveDoc.GetPath())


im not sure if the call is getpath(), or filename()...or something....but you get the picture

RE: API - How to Apply Method to Active Document

sorry, the actual call is GetPathName()

try this:

swApp.GetConfigurationCounts(swApp.ActiveDoc.GetPathName())

RE: API - How to Apply Method to Active Document

There are two GetConfigurationCounts methods, one for ModelDoc2 object and one for SldWorks object.

retval = ModelDoc2.GetConfigurationCount( ) only works for loaded or open SW files.

count = SldWorks.GetConfigurationCount ( filePathName ) works on files that are not opened.

If your file is already loaded or open, I think you should go with ModelDoc2.GetConfigurationCount.

Due to illness, the part of The Tick will be played by... The Tick.
http://www.EsoxRepublic.com

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