masotann
masotann

Reputation: 911

Getting Part Documents From Assembly Documents in SolidWorks API

Here is my scenario: I am reading in an Assembly file into Solidworks. From there, when the user is trying to edit a part, I want to get the information on which part file they want to edit.

Is there a way to get all the PartDoc information upon importing an AssemblyDoc file? The closest I got to was getting the Body2 objects from the AssemblyDoc using GetComponents() and GetBodies2() function described here. I had hoped that I could somehow grab the PartDocs from the bodies but I've found no way out.

Thank you in advance!

Upvotes: 1

Views: 3770

Answers (1)

Andrey.Dankevich
Andrey.Dankevich

Reputation: 509

GetComponents return an array of IComponent2s.

For each component you can call GetModelDoc2 method to retrieve corresponding ModelDoc which can be either PartDoc, or AssemblyDoc.

Upvotes: 4

Related Questions