Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

API - How to Apply Method to Active Document 1

Status
Not open for further replies.

Beggar

Mechanical
Mar 24, 2004
715
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
--------------------
 
Replies continue below

Recommended for you

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
 
sorry, the actual call is GetPathName()

try this:

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

 
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.

[bat]Due to illness, the part of The Tick will be played by... The Tick.[bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor