码迷,mamicode.com
首页 > 其他好文 > 详细

How to retrieve instance parameters from an uninstantiated (uninserted) family

时间:2014-12-18 21:55:08      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:style   blog   ar   io   color   os   sp   for   on   

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 = 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

标签:style   blog   ar   io   color   os   sp   for   on   

原文地址:http://www.cnblogs.com/xpvincent/p/4172700.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!