首页 > 代码库 > How to retrieve instance parameters from an uninstantiated (uninserted) family
How to retrieve instance parameters from an uninstantiated (uninserted) family
The trick to be able to read the default values for instance parameters is to get to the FamilyManager.
The family manager is a whole separate area of the API, with separate classes for FamilyType and FamilyParameter. You can think of it as the API version of the Family Types dialog in the Family Editor.
Getting there involves opening the family as a document, something along the lines of:
if (ColFam.IsEditable){ Document familyDoc = mainDocument.EditFamily( ColFam ); FamilyManager manager = familyDoc.FamilyManager; foreach (FamilyParameter fp in manager.Parameters ) { // over simplified, but hopefully you get the idea.... if (fp.IsInstance) { string instanceValue =http://www.mamicode.com/ manager.CurrentType.AsString( fp ); } } // don‘t forget to close the family when you‘re done. familyDoc.Close(false);}
How to retrieve instance parameters from an uninstantiated (uninserted) family
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。