示例#1
0
        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"));
        }
示例#2
0
        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"));
        }
示例#3
0
        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"));
        }
示例#4
0
        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"));
        }
示例#5
0
        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"));
        }
示例#6
0
        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"));
        }
示例#7
0
    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"));
    }
示例#8
0
        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"));
        }
示例#9
0
        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);
        }