Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Solidworks VBA question

Status
Not open for further replies.

dbrew0

Technical User
Dec 15, 2003
38
US
Hi all,

Does anyone here do VBA programming for Solidworks (a 3-D CAD package)?

I'm working on a VBA application within Solidworks (SW 2006 sp 4.1) and am running into a problem.

I need to be able to find and list all of the external part and assembly file references within an assembly programmatically. Once I have a list of them I'll be able to manipulate the list as needed. The problem is that in an assembly file, using the SldWorks.ModelDocExtension.ListExternalFileReferencesCount method (or SldWorks.ModelDoc2.ListExternalFileReferencesCount2) returns a 0; and using the ListExternalFileReferences method to collect the reference info yields nothing. However, if I view the 'Find References' pull-down from within SW, it lists all of the references within that assembly.

If I create a part A part file, and a part B part file; then insert part B into part A and save part A as a part file and use those methods, they do return a count >0. However, as soon as I create an assembly of the part A part file (with part B inserted), I again get a 0 count using those methods.

Are there other methods that need to be used on an assembly?

Thanks,

Dan
 
I know some programmers who do AutoCad VBA over at www. vbaexpress.com, but not Solidworks. Is it a similar program? Does the software manufacturer not give any recommendations for VBA help? Have you contacted them?

Regards,
Zack Barresse

Simplicity is the ultimate sophistication. What is a MS MVP? PODA
- Leonardo da Vinci
 
firefytr,

Solidworks is a similar program to Autocad, in the fact that they are both 3-D CAD packages. But the API's are very different, not to mention the internal workings of the programs.
I have contacted the manufacturer and am waiting on a response. I posted on this site as well because I've gotten good feedback and help with other VB and VBA questions.

Thanks anyway for the response, and the vbaexpress website.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top