Ejemplo n.º 1
0
        public static Elements.Element RevitWallToHyparWall(Wall revitWall)
        {
            Polygon        outerPolygon = null;
            List <Polygon> voids        = new List <Polygon>();

            var polygons = revitWall.GetProfile();

            if (polygons == null)
            {
                return(null);
            }

            outerPolygon = polygons[0];
            if (polygons.Count > 1)
            {
                voids.AddRange(polygons.Skip(1));
            }

            //build our profile
            Profile prof = new Profile(outerPolygon, voids, Guid.NewGuid(), "revit Wall");
            //get the location curve as an Elements.Line
            Curve curve = (revitWall.Location as LocationCurve).Curve;
            Line  line  = new Line(curve.GetEndPoint(0).ToVector3(true), curve.GetEndPoint(1).ToVector3(true));

            //return a neat Hypar wall
            return(new WallByProfile(prof, revitWall.Width, line));
        }
Ejemplo n.º 2
0
        public static Elements.WallByProfile[] WallsFromRevitWall(ADSK.Wall wall, Document doc)
        {
            var side_faces = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Exterior);

            if (side_faces.Count != 1)
            {
                throw new InvalidOperationException($"This wall has ${(side_faces.Count < 1 ? "not enough" : "too many")} interior faces");
            }

            var wallFace = doc.GetElement(side_faces[0]).GetGeometryObjectFromReference(side_faces[0]);

            if (!(wallFace is PlanarFace))
            {
                throw new InvalidCastException("This wall does not have planar faces");
            }

            var wallPlane = wallFace as PlanarFace;
            var profiles  = wallPlane.GetProfiles(true);

            var centerline = (wall.Location as LocationCurve).Curve;

            var line = new ElemGeom.Line(centerline.GetEndPoint(0).ToVector3(true), centerline.GetEndPoint(1).ToVector3(true));

            var walls = profiles.Select(p => new WallByProfile(p.Reverse(),
                                                               Elements.Units.FeetToMeters(wall.Width),
                                                               line));

            return(walls.ToArray());
        }
Ejemplo n.º 3
0
        public WallByProfile(Profile @profile, double @thickness, Line @centerline, Transform @transform, Material @material, Representation @representation, bool @isElementDefinition, System.Guid @id, string @name)
            : base(transform, material, representation, isElementDefinition, id, name)
        {
            var validator = Validator.Instance.GetFirstValidatorForType <WallByProfile>();

            if (validator != null)
            {
                validator.Validate(new object[] { @profile, @thickness, @centerline, @transform, @material, @representation, @isElementDefinition, @id, @name });
            }

            this.Profile    = @profile;
            this.Thickness  = @thickness;
            this.Centerline = @centerline;
        }
Ejemplo n.º 4
0
        public VantageStreetsValue(Line @frontLotLine)
        {
            var validator = Validator.Instance.GetFirstValidatorForType <VantageStreetsValue>();

            if (validator != null)
            {
                validator.PreConstruct(new object[] { @frontLotLine });
            }

            this.FrontLotLine = @frontLotLine;

            if (validator != null)
            {
                validator.PostConstruct(this);
            }
        }
Ejemplo n.º 5
0
        public WallsOverrideAdditionValue(Line @centerLine)
        {
            var validator = Validator.Instance.GetFirstValidatorForType <WallsOverrideAdditionValue>();

            if (validator != null)
            {
                validator.PreConstruct(new object[] { @centerLine });
            }

            this.CenterLine = @centerLine;

            if (validator != null)
            {
                validator.PostConstruct(this);
            }
        }
Ejemplo n.º 6
0
        public ProfileIdentity(Line @curve)
        {
            var validator = Validator.Instance.GetFirstValidatorForType <ProfileIdentity>();

            if (validator != null)
            {
                validator.PreConstruct(new object[] { @curve });
            }

            this.Curve = @curve;

            if (validator != null)
            {
                validator.PostConstruct(this);
            }
        }
Ejemplo n.º 7
0
        public StaircaseFromLineInputs(double @width, Line @staircaseAxe, string bucketName, string uploadsBucket, Dictionary <string, string> modelInputKeys, string gltfKey, string elementsKey, string ifcKey) :
            base(bucketName, uploadsBucket, modelInputKeys, gltfKey, elementsKey, ifcKey)
        {
            var validator = Validator.Instance.GetFirstValidatorForType <StaircaseFromLineInputs>();

            if (validator != null)
            {
                validator.PreConstruct(new object[] { @width, @staircaseAxe });
            }

            this.Width        = @width;
            this.StaircaseAxe = @staircaseAxe;

            if (validator != null)
            {
                validator.PostConstruct(this);
            }
        }
Ejemplo n.º 8
0
        public VantageStreets(Line @line, double @blockDepthInFeet, bool @streetWallContinuity, VantageStreetsWidth @width, string @name)
        {
            var validator = Validator.Instance.GetFirstValidatorForType <VantageStreets>();

            if (validator != null)
            {
                validator.PreConstruct(new object[] { @line, @blockDepthInFeet, @streetWallContinuity, @width, @name });
            }

            this.Line                 = @line;
            this.BlockDepthInFeet     = @blockDepthInFeet;
            this.StreetWallContinuity = @streetWallContinuity;
            this.Width                = @width;
            this.Name                 = @name;

            if (validator != null)
            {
                validator.PostConstruct(this);
            }
        }
Ejemplo n.º 9
0
        public TrussBridgeInputs(Line @path, double @width, double @height, double @endElevation, IList <Vector3> @abutmentLocations, Overrides @overrides, string bucketName, string uploadsBucket, Dictionary <string, string> modelInputKeys, string gltfKey, string elementsKey, string ifcKey) :
            base(bucketName, uploadsBucket, modelInputKeys, gltfKey, elementsKey, ifcKey)
        {
            var validator = Validator.Instance.GetFirstValidatorForType <TrussBridgeInputs>();

            if (validator != null)
            {
                validator.PreConstruct(new object[] { @path, @width, @height, @endElevation, @abutmentLocations, @overrides });
            }

            this.Path              = @path;
            this.Width             = @width;
            this.Height            = @height;
            this.EndElevation      = @endElevation;
            this.AbutmentLocations = @abutmentLocations;
            this.Overrides         = @overrides;

            if (validator != null)
            {
                validator.PostConstruct(this);
            }
        }
Ejemplo n.º 10
0
 public static Autodesk.Revit.DB.Line ToRevitLine(this Elements.Geometry.Line line, Application app)
 {
     return(Autodesk.Revit.DB.Line.CreateBound(line.Start.ToXYZ(app), line.End.ToXYZ(app)));
 }
 public NYCDaylightEvaluationVantageStreet(double @score, double @centerlineDistance, Line @frontLotLine, Line @centerline, bool @streetWallContinuity, IList <Line> @lotLines, double @blockDepth, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null)
     : base(transform, material, representation, isElementDefinition, id, name)
 {
     this.Score = @score;
     this.CenterlineDistance   = @centerlineDistance;
     this.FrontLotLine         = @frontLotLine;
     this.Centerline           = @centerline;
     this.StreetWallContinuity = @streetWallContinuity;
     this.LotLines             = @lotLines;
     this.BlockDepth           = @blockDepth;
 }
Ejemplo n.º 12
0
 public static Elements.ModelCurve CurtainGridToHyparCurve(Autodesk.Revit.DB.CurtainGridLine gridLine)
 {
     Elements.Geometry.Curve curve = new Line(gridLine.FullCurve.GetEndPoint(0).ToVector3(), gridLine.FullCurve.GetEndPoint(1).ToVector3());
     return(new Elements.ModelCurve(curve, BuiltInMaterials.Edges));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Convert a line to a polyline
 /// </summary>
 /// <param name="l">The line to convert.</param>
 public static Polyline ToPolyline(this Line l) => new Polyline(new[] { l.Start, l.End });