更新
This commit is contained in:
74
Revit-API/ElementTransformUtils.md
Normal file
74
Revit-API/ElementTransformUtils.md
Normal file
@@ -0,0 +1,74 @@
|
||||
## ElementTransformUtils
|
||||
|
||||
### CopyElement(args)
|
||||
|
||||
- UIDocument uidoc = commandData.Application.ActiveUIDocument;
|
||||
Document doc = uidoc.Document;
|
||||
Selection sel = uidoc.Selection;
|
||||
Reference r = sel.PickObject(ObjectType.Element);
|
||||
Element element = doc.GetElement(r);
|
||||
using(Transaction tr = new Transaction(doc))
|
||||
{
|
||||
tr.Start("test");
|
||||
ElementTransformUtils.CopyElement(doc, element.Id, new XYZ(20, 20, 20));
|
||||
tr.Commit();
|
||||
}
|
||||
|
||||
### CopyElements(args)
|
||||
|
||||
### MirrorElement(args)
|
||||
|
||||
- UIDocument uidoc = commandData.Application.ActiveUIDocument;
|
||||
Document doc = uidoc.Document;
|
||||
Selection sel = uidoc.Selection;
|
||||
var create = doc.Create;
|
||||
Reference r = sel.PickObject(ObjectType.Element);
|
||||
Element element = doc.GetElement(r);
|
||||
using(Transaction tr = new Transaction(doc))
|
||||
{
|
||||
tr.Start("test");
|
||||
ReferencePlane plane = create.NewReferencePlane(new XYZ(0, 0, 0), new XYZ(0, 0, 20), new XYZ(0, 20, 0), doc.ActiveView);
|
||||
ElementTransformUtils.MirrorElement(doc, element.Id, plane.Plane);
|
||||
tr.Commit();
|
||||
}
|
||||
|
||||
### MirrorElements(args)
|
||||
|
||||
### MoveElement(args)
|
||||
|
||||
- UIDocument uidoc = commandData.Application.ActiveUIDocument;
|
||||
Document doc = uidoc.Document;
|
||||
Selection sel = uidoc.Selection;
|
||||
|
||||
Reference r = sel.PickObject(ObjectType.Element);
|
||||
Element element = doc.GetElement(r);
|
||||
using(Transaction tr = new Transaction(doc))
|
||||
{
|
||||
tr.Start("test");
|
||||
ElementTransformUtils.MoveElement(doc, element.Id, new XYZ(20, 20, 20));
|
||||
tr.Commit();
|
||||
}
|
||||
|
||||
### MoveElements(args)
|
||||
|
||||
### RotateElement(args)
|
||||
|
||||
-
|
||||
UIDocument uidoc = commandData.Application.ActiveUIDocument;
|
||||
Document doc = uidoc.Document;
|
||||
Selection sel = uidoc.Selection;
|
||||
|
||||
Reference r = sel.PickObject(ObjectType.Element);
|
||||
Element element = doc.GetElement(r);
|
||||
using(Transaction tr = new Transaction(doc))
|
||||
{
|
||||
tr.Start("test");
|
||||
Line line = Line.CreateBound(new XYZ(10, 20, 0), new XYZ(10, 20, 30));
|
||||
// line为旋转的轴,要为Z轴方向的线
|
||||
ElementTransformUtils.RotateElement(doc, element.Id, line,Math.PI/2);
|
||||
tr.Commit();
|
||||
}
|
||||
|
||||
### RotateElements(args)
|
||||
|
||||
*XMind: ZEN - Trial Version*
|
||||
Reference in New Issue
Block a user