Revit API 移动元素

简介: Revit API 移动元素

1、Using Location

ElementId ElementId = new ElementId(470604);
Element Element = doc.GetElement(ElementId);
LocationPoint location = Element.Location as LocationPoint;
XYZ newlocation = new XYZ(location.Point.X+10, location.Point.Y, location.Point.Z);
location.Point = newlocation;

MOVE后加偏移量!

ElementId ElementId = new ElementId(470604);
Element Element = doc.GetElement(ElementId);
LocationPoint location = Element.Location as LocationPoint;
XYZ newlocation1 = new XYZ(10,0,0);
location.Move(newlocation1);

参考文献:http://help.autodesk.com/view/RVT/2014/ENU/?guid=GUID-CD3B9A83-8DBC-418E-8099-D655AB3DA010  

public void MoveColumn(Autodesk.Revit.DB.Document document, FamilyInstance column)
{
        // get the column current location
        LocationPoint columnLocation = column.Location as LocationPoint;
        XYZ oldPlace = columnLocation.Point;
        // Move the column to new location.
        XYZ newPlace = new XYZ(10, 20, 30);
        ElementTransformUtils.MoveElement(document, column.Id, newPlace);
        // now get the column's new location
        columnLocation = column.Location as LocationPoint;
        XYZ newActual = columnLocation.Point;
        string info = "Original Z location: " + oldPlace.Z + 
                        "\nNew Z location: " + newActual.Z;
        TaskDialog.Show("Revit",info);
}
相关文章
|
测试技术 API Windows
使用钩子(Hook)实现Revit API中 PickObjects 完成按钮的触发
使用钩子(Hook)实现Revit API中 PickObjects 完成按钮的触发
使用钩子(Hook)实现Revit API中 PickObjects 完成按钮的触发
快速设置Revit模型材质(Dynamo和API)
快速设置Revit模型材质(Dynamo和API)
快速设置Revit模型材质(Dynamo和API)
Revit API中可设置的面板控件
Revit API中可设置的面板控件
Revit API中可设置的面板控件
|
存储 API
Revit API 修改项目文档中族参数的几个要点
Revit API 修改项目文档中族参数的几个要点
Revit API 修改项目文档中族参数的几个要点
Revit API获取链接模型状态
Revit API获取链接模型状态
Revit API 不能直接隐藏(Hide)Group?另有它法!
Revit API 不能直接隐藏(Hide)Group?另有它法!
Revit API 修改视觉样式(Visual Style)
Revit API 修改视觉样式(Visual Style)
|
5天前
|
机器人 API Python
智能对话机器人(通义版)会话接口API使用Quick Start
本文主要演示了如何使用python脚本快速调用智能对话机器人API接口,在参数获取的部分给出了具体的获取位置截图,这部分容易出错,第一次使用务必仔细参考接入参数获取的位置。
|
2天前
|
XML JSON API
RESTful API设计最佳实践:构建高效、可扩展的接口
【8月更文挑战第17天】RESTful API设计是一个涉及多方面因素的复杂过程。通过遵循上述最佳实践,开发者可以构建出更加高效、可扩展、易于维护的API。然而,值得注意的是,最佳实践并非一成不变,随着技术的发展和业务需求的变化,可能需要不断调整和优化API设计。因此,保持对新技术和最佳实践的关注,是成为一名优秀API设计师的关键。