I want to change element name by API and I have the following code.
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);
元素的名称是只读的,不应更改。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.