31 lines
769 B
C#
31 lines
769 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using Autodesk.Revit.Attributes;
|
|
using Autodesk.Revit.DB;
|
|
|
|
using Nice3point.Revit.Toolkit.External;
|
|
|
|
namespace ShrlAlgoToolkit.RevitAddins.RvCommon;
|
|
/// <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;
|
|
}
|
|
}
|