public void SolidDefault() { var solid = TestGeomGenerator.CreateImprint(); var array = LinearArray.Create(solid.Body); array.Quantity1 = 4; array.Distance1 = 25; array.Quantity2 = 3; array.Distance2 = 30; Assert.IsTrue(array.Make(Shape.MakeFlags.None)); Assert.AreEqual(ShapeType.Solid, array.ShapeType); AssertHelper.IsSameModel(array, Path.Combine(_BasePath, "SolidDefault")); }
public void SketchBorder() { var sketch = TestGeomGenerator.CreateSketch(TestGeomGenerator.SketchType.SimpleAsymmetric, true); var array = LinearArray.Create(sketch.Body); array.Quantity1 = 4; array.Distance1 = 10; array.Quantity2 = 3; array.Distance2 = 25; array.Border = true; Assert.IsTrue(array.Make(Shape.MakeFlags.None)); Assert.AreEqual(ShapeType.Sketch, array.ShapeType); AssertHelper.IsSameModel(array, Path.Combine(_BasePath, "SketchBorder")); }
public void SketchOverallExtent() { var sketch = TestSketchGenerator.CreateSketch(TestSketchGenerator.SketchType.SimpleAsymmetric, true); var array = LinearArray.Create(sketch.Body); array.Quantity1 = 4; array.Distance1 = 100; array.DistanceMode1 = LinearArray.DistanceMode.OverallExtent; array.Quantity2 = 3; array.Distance2 = 100; array.DistanceMode2 = LinearArray.DistanceMode.OverallExtent; Assert.IsTrue(array.Make(Shape.MakeFlags.None)); Assert.AreEqual(ShapeType.Sketch, array.ShapeType); AssertHelper.IsSameModel(array, Path.Combine(_BasePath, "SketchOverallExtent")); }
public void SolidRotationAlignCenter() { var solid = TestGeomGenerator.CreateImprint(); var array = LinearArray.Create(solid.Body); array.Quantity1 = 4; array.Distance1 = 25; array.Alignment1 = LinearArray.AlignmentMode.Center; array.Quantity2 = 3; array.Distance2 = 30; array.Alignment2 = LinearArray.AlignmentMode.Center; array.Rotation = 45; Assert.IsTrue(array.Make(Shape.MakeFlags.None)); Assert.AreEqual(ShapeType.Solid, array.ShapeType); AssertHelper.IsSameModel(array, Path.Combine(_BasePath, "SolidRotationAlignCenter")); }
public void SketchDefault() { var sketch = TestGeomGenerator.CreateSketch(TestGeomGenerator.SketchType.SimpleAsymmetric, true); var array = LinearArray.Create(sketch.Body); array.Quantity1 = 4; array.Distance1 = 10; array.Quantity2 = 3; array.Distance2 = 25; Assert.IsTrue(array.Make(Shape.MakeFlags.None)); Assert.AreEqual(ShapeType.Sketch, array.ShapeType); AssertHelper.IsSameModel(array, Path.Combine(_BasePath, "SketchDefault")); // Ensure that original shape is still unmodified AssertHelper.IsSameModel(sketch, Path.Combine(_BasePath, "SketchDefaultUnmodified")); }
public void SketchRotationAlignCenter() { var sketch = TestSketchGenerator.CreateSketch(TestSketchGenerator.SketchType.SimpleAsymmetric, true); var array = LinearArray.Create(sketch.Body); array.Quantity1 = 4; array.Distance1 = 10; array.Alignment1 = LinearArray.AlignmentMode.Center; array.Quantity2 = 3; array.Distance2 = 25; array.Alignment2 = LinearArray.AlignmentMode.Center; array.Rotation = 45; Assert.IsTrue(array.Make(Shape.MakeFlags.None)); Assert.AreEqual(ShapeType.Sketch, array.ShapeType); AssertHelper.IsSameModel(array, Path.Combine(_BasePath, "SketchRotationAlignCenter")); }
public void SolidCompound() { var body = TestGeomGenerator.CreateBox().Body; var linearArray = LinearArray.Create(body); linearArray.Quantity1 = 2; linearArray.Quantity2 = 2; linearArray.Distance1 = 2; linearArray.Distance2 = 2; linearArray.DistanceMode1 = LinearArray.DistanceMode.Spacing; linearArray.DistanceMode2 = LinearArray.DistanceMode.Spacing; var offset = Offset.Create(body, 0.5); Assert.IsTrue(offset.Make(Shape.MakeFlags.None)); AssertHelper.IsSameModel(offset, Path.Combine(_BasePath, "SolidCompound")); }
public void SolidSpacingYZandZX() { var solid = TestGeomGenerator.CreateImprint(); var array = LinearArray.Create(solid.Body); array.Plane = LinearArray.PlaneType.YZ; array.Quantity1 = 4; array.Distance1 = 5; array.DistanceMode1 = LinearArray.DistanceMode.Spacing; array.Quantity2 = 3; array.Distance2 = 10; array.DistanceMode2 = LinearArray.DistanceMode.Spacing; Assert.IsTrue(array.Make(Shape.MakeFlags.None)); Assert.AreEqual(ShapeType.Solid, array.ShapeType); AssertHelper.IsSameModel(array, Path.Combine(_BasePath, "SolidSpacingYZ")); array.Plane = LinearArray.PlaneType.ZX; Assert.IsTrue(array.Make(Shape.MakeFlags.None)); Assert.AreEqual(ShapeType.Solid, array.ShapeType); AssertHelper.IsSameModel(array, Path.Combine(_BasePath, "SolidSpacingZX")); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var uiapp = commandData.Application; UIDocument uidoc = commandData.Application.ActiveUIDocument; Document doc = uidoc.Document; Selection sel = uidoc.Selection; doc.Invoke(m => { View view = doc.ActiveView; ElementId eleId = sel.PickObject(ObjectType.Element).ElementId; //表明阵列的相对方向 XYZ translation = new XYZ(1000d.MmToFeet(), 2000d.MmToFeet(), 0); LinearArray.Create(doc, view, eleId, 3, translation, ArrayAnchorMember.Second); //count: 阵列后的总数量 //ArrayAnchorMember.Last :相邻元素的间距为 将translation按count 均分 //ArrayAnchorMember.Second : 相邻元素的间距为 将translation }, "阵列元素"); return(Result.Succeeded); }