2026-02-20 16:47:26 +08:00
|
|
|
|
using Autodesk.Revit.Attributes;
|
2025-07-11 09:20:23 +08:00
|
|
|
|
using Autodesk.Revit.DB;
|
|
|
|
|
|
|
|
|
|
|
|
using Nice3point.Revit.Toolkit.External;
|
|
|
|
|
|
|
2026-02-22 20:03:42 +08:00
|
|
|
|
namespace ShrlAlgoToolkit.RevitAddins.General;
|
2025-07-11 09:20:23 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 相对移动
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Transaction(TransactionMode.Manual)]
|
|
|
|
|
|
internal class MoveElementByRelationshipCmd : ExternalCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
public override void Execute()
|
|
|
|
|
|
{
|
|
|
|
|
|
var ids = UiDocument.Selection.GetElementIds();
|
|
|
|
|
|
foreach (var id in ids)
|
|
|
|
|
|
{
|
|
|
|
|
|
var elem = Document.GetElement(id) as FamilyInstance;
|
|
|
|
|
|
;
|
|
|
|
|
|
ElementTransformUtils.MoveElement(Document, id, elem.FacingOrientation * 121 / 304.8);
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|