示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="view"></param>
        /// <param name="viewFamilyType"></param>
        /// <param name="extents"></param>
        /// <returns></returns>
        public static View CreateCallout(View view,
                                         Element viewFamilyType, Autodesk.DesignScript.Geometry.Rectangle extents)
        {
            var doc = DocumentManager.Instance.CurrentDBDocument;
            var v   = (Autodesk.Revit.DB.View)view.InternalElement;

            var pt1 = extents.BoundingBox.MinPoint.ToXyz();
            var pt2 = extents.BoundingBox.MaxPoint.ToXyz();

            Autodesk.Revit.DB.View newView;

            TransactionManager.Instance.EnsureInTransaction(doc);
            switch (v.ViewType)
            {
            case Autodesk.Revit.DB.ViewType.FloorPlan:
            case Autodesk.Revit.DB.ViewType.CeilingPlan:
            case Autodesk.Revit.DB.ViewType.Elevation:
            case Autodesk.Revit.DB.ViewType.Section:
            case Autodesk.Revit.DB.ViewType.Detail:
                newView = Autodesk.Revit.DB.ViewSection.CreateCallout(doc, v.Id,
                                                                      viewFamilyType.InternalElement.Id, pt1, pt2);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(view));
            }
            TransactionManager.Instance.TransactionTaskDone();

            return((View)newView.ToDSType(true));
        }
示例#2
0
        /// <summary>
        /// Create an Advance Steel Rectangular Polycut feature by Length and Width
        /// </summary>
        /// <param name="element"> Input Plate</param>
        /// <param name="rectangle"> Input Dynamo Rectangle</param>
        /// <param name="lengthVec"> Input vector in the length direction of rectangular polycut</param>
        /// <param name="corner">0 - TL, 1 - TR, 2 - BR, 3 - BL, else center</param>
        /// <param name="additionalBeamFeatureParameters"> Optional Input Beam Feature Build Properties </param>
        /// <returns name="polyCut">polyCut</returns>
        public static BeamPolycut ByRectangle(AdvanceSteel.Nodes.SteelDbObject element,
                                              Autodesk.DesignScript.Geometry.Rectangle rectangle,
                                              Autodesk.DesignScript.Geometry.Vector lengthVec,
                                              [DefaultArgument("-1")] int corner,
                                              [DefaultArgument("null")] List <Property> additionalBeamFeatureParameters)
        {
            Autodesk.DesignScript.Geometry.Point  rectangleInsertPoint = rectangle.Center();
            Autodesk.DesignScript.Geometry.Vector normal = rectangle.Normal;
            double length = rectangle.Width;
            double width  = rectangle.Height;

            additionalBeamFeatureParameters = PreSetDefaults(additionalBeamFeatureParameters, Utils.ToInternalDistanceUnits(length, true), Utils.ToInternalDistanceUnits(width, true));
            return(new BeamPolycut(element, 0, Utils.ToAstPoint(rectangleInsertPoint, true),
                                   Utils.ToAstVector3d(normal, true),
                                   Utils.ToAstVector3d(lengthVec, true),
                                   corner,
                                   additionalBeamFeatureParameters));
        }
        //[TestMethod]
        public void DefaultPageIsValid()
        {
            var p = Content.Page.PageBySize("A4", DynamoPDF.Content.Colors.White);

            Autodesk.DesignScript.Geometry.Rectangle rect = p.Values.Last() as Autodesk.DesignScript.Geometry.Rectangle;
            Content.Page page = p.Values.First() as Content.Page;

            Assert.AreEqual(210, rect.Width);
            Assert.AreEqual(297, rect.Height);


            var pdf = page.ToPDF();

            Assert.AreEqual(210, pdf.Width);
            Assert.AreEqual(297, pdf.Height);
            Assert.AreEqual(255, pdf.BackgroundColor.R);
            Assert.AreEqual(255, pdf.BackgroundColor.G);
            Assert.AreEqual(255, pdf.BackgroundColor.B);
        }