简体   繁体   English

在SolidWorks API中从装配文档中获取零件文档

[英]Getting Part Documents From Assembly Documents in SolidWorks API

Here is my scenario: I am reading in an Assembly file into Solidworks. 这是我的场景:我在装配文件中读到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? 有没有办法在导入AssemblyDoc文件时获取所有PartDoc信息? The closest I got to was getting the Body2 objects from the AssemblyDoc using GetComponents() and GetBodies2() function described here . 我最接近的是使用此处描述的GetComponents()GetBodies2()函数从AssemblyDoc获取Body2对象。 I had hoped that I could somehow grab the PartDocs from the bodies but I've found no way out. 我曾希望我能以某种方式从身体中抓住PartDocs ,但我找不到任何出路。

Thank you in advance! 先感谢您!

GetComponents return an array of IComponent2 s. GetComponents返回一个IComponent2数组。

For each component you can call GetModelDoc2 method to retrieve corresponding ModelDoc which can be either PartDoc, or AssemblyDoc. 对于每个组件,您可以调用GetModelDoc2方法来检索相应的ModelDoc,它可以是PartDoc或AssemblyDoc。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM