创建视图样式对象

转载请复制以下信息:

原文链接: http://blog.csdn.net/joexiongjin/article/details/7433087

作者:  叶雄进

2012.4.6

 

 

有开发者问到如何创建视图样式对象。这篇文章与之前我写的对象创建技巧这篇文章使用的相同的技巧,使用类型对象的Duplicate() 方法。请参看如下链接。

http://blog.csdn.net/joexiongjin/article/details/7213424

 

视图样式对象在Revit中是用ElementType这个类来代表的。我们同样可以用上面的方法创建。

下面是参考代码。为了快速举例,这里使用了一个模型中现有视图的Id来获得视图对象,然后从视图对象获得视图样式对象。实际用时请替换

    ElementId id = new ElementId(70040);

这行代码

 

            //please assign doc value here.
            
            //Here 70040 represents a existing Structural plan view. you need to replace this line by the code getting the target structural plan view.
            ElementId id = new ElementId(70040);
            Transaction trans = new Transaction(doc);
            trans.Start("CreateViewType");
            ViewPlan view = doc.get_Element(id) as ViewPlan;
            ElementId typeId = view.GetTypeId();
            ElementType type = doc.get_Element(typeId) as ElementType;
            ElementType newType = type.Duplicate("Joe Test");
            trans.Commit();


本文主要是想表达可以编程创建试图样式对象。

希望有帮助!
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值