[英]How to change Revit 2014 element name by API C#
I want to change element name by API and I have the following code. 我想通过API更改元素名称,并且有以下代码。
Reference r = docUI.Selection.PickObject(ObjectType.Element, "Please pick an element");
Element element = doc.GetElement(r.ElementId);
element.Name = "MyElement";
But why occured this error ? 但是为什么会发生此错误? 'This element does not support assignment of a user-specified name.'
“此元素不支持分配用户指定的名称。” Or should I change the name by another way ?
还是应该以其他方式更改名称?
Please help! 请帮忙!
Element names can't be changed. 元素名称不能更改。 If you are actually looking to change the name of the element "type", that is editable.
如果您实际上要更改元素“类型”的名称,则该名称是可编辑的。
I believe you have to change the Element Type to change its Name. 我相信您必须更改元素类型才能更改其名称。 Something like the following:
类似于以下内容:
element.ChangeTypeId(anotherElementTypeId);
元素的名称是只读的,不应更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.