/// <summary> /// Creates a Revit ViewSection by a specified corrdinate system, minPoint and maxPoint /// </summary> /// <param name="cs"></param> /// <param name="minPoint"></param> /// <param name="maxPoint"></param> /// <returns></returns> public static SectionView ByCoordinateSystemMinPointMaxPoint( Autodesk.DesignScript.Geometry.CoordinateSystem cs, Autodesk.DesignScript.Geometry.Point minPoint, Autodesk.DesignScript.Geometry.Point maxPoint) { return(new SectionView(GeometryPrimitiveConverter.ToRevitBoundingBox(cs, minPoint, maxPoint))); }
public void SetTransform(Autodesk.DesignScript.Geometry.CoordinateSystem from, Autodesk.DesignScript.Geometry.CoordinateSystem to) { var inverse = from.Inverse(); var final = inverse.PreMultiplyBy(to); this.SetTransform(final); }
/// <summary> /// Create an Advance Steel Beam Plane Cut by Coordinate System /// </summary> /// <param name="element"> Input Beam</param> /// <param name="coordinateSystem"> Input Dynamo CoordinateSytem</param> /// <param name="additionalBeamFeatureParameters"> Optional Input Beam Cut Build Properties </param> /// <returns name="planeCut">planeCut</returns> public static BeamPlaneCut ByCS(AdvanceSteel.Nodes.SteelDbObject element, Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, [DefaultArgument("null")] List <Property> additionalBeamFeatureParameters) { additionalBeamFeatureParameters = PreSetDefaults(additionalBeamFeatureParameters); return(new BeamPlaneCut(element, Utils.ToAstPoint(coordinateSystem.Origin, true), Utils.ToAstVector3d(coordinateSystem.ZAxis, true), additionalBeamFeatureParameters)); }
/// <summary> /// Create a rectangular Advance Steel Plate by using 2 points at opposite corners for extents, including setting the side and thickness /// </summary> /// <param name="cs">Input Dynamo Corrdinate System</param> /// <param name="cornerPoint1">Input Point of Lower Left of plate</param> /// <param name="cornerPoint2">Input Point of Upper right of plate</param> /// <param name="additionalPlateParameters"> Optional Input Plate Build Properties </param> /// <returns name="plate"> plate</returns> public static Plate ByTwoDiagonalPointsByCS(Autodesk.DesignScript.Geometry.CoordinateSystem cs, Autodesk.DesignScript.Geometry.Point cornerPoint1, Autodesk.DesignScript.Geometry.Point cornerPoint2, [DefaultArgument("null")] List <Property> additionalPlateParameters) { Point3d cpt1 = Utils.ToAstPoint(cornerPoint1, true); Point3d cpt2 = Utils.ToAstPoint(cornerPoint2, true); Plane ply1 = new Plane(cpt1, Utils.ToAstVector3d(cs.YAxis, true)); Plane plx2 = new Plane(cpt2, Utils.ToAstVector3d(cs.XAxis, true)); Point3d cpt1a = cpt1.OrthoProject(plx2); Point3d cpt2a = cpt2.OrthoProject(ply1); double width = cpt1a.DistanceTo(cpt1); if (width == 0) { throw new System.Exception("Width Cant be Zero"); } double length = cpt2a.DistanceTo(cpt2); if (length == 0) { throw new System.Exception("Length Cant be Zero"); } additionalPlateParameters = PreSetDefaults(additionalPlateParameters); Point3d[] astPoints = new Point3d[] { cpt1, cpt1a, cpt2, cpt2a }; return(new Plate(astPoints, Utils.ToAstVector3d(cs.ZAxis, true), additionalPlateParameters)); }
/// <summary> /// Create FdCoordinateSystem from Dynamo coordinate system of a Surface. /// No realignment neccessary. /// </summary> internal static FdCoordinateSystem FromDynamoCoordinateSystemSurface(Autodesk.DesignScript.Geometry.CoordinateSystem obj) { FdPoint3d origin = FdPoint3d.FromDynamo(obj.Origin); FdVector3d localX = FdVector3d.FromDynamo(obj.XAxis); FdVector3d localY = FdVector3d.FromDynamo(obj.YAxis); FdVector3d localZ = FdVector3d.FromDynamo(obj.ZAxis); return(new FdCoordinateSystem(origin, localX, localY, localZ)); }
/// <summary> /// /// Create FdCoordinateSystem from Dynamo coordinate system of a Arc or Circle. /// Dynamo Arcs and Circles follow left-hand rule. /// This method realignes the coordinate system. /// </summary> internal static FdCoordinateSystem FromDynamoCoordinateSystemArcOrCircle(Autodesk.DesignScript.Geometry.CoordinateSystem obj) { FdPoint3d origin = FdPoint3d.FromDynamo(obj.Origin); FdVector3d localX = FdVector3d.FromDynamo(obj.YAxis); FdVector3d localY = FdVector3d.FromDynamo(obj.XAxis); FdVector3d localZ = localX.Cross(localY).Normalize(); return(new FdCoordinateSystem(origin, localX, localY, localZ)); }
/// <summary> /// Create an Advance Steel Camera /// </summary> /// <param name="coordinateSystem">Input Dynamo Coordinate System</param> /// <param name="additionalCameraParameters"> Optional Input Camera Build Properties </param> /// <returns name="camera"> camera</returns> public static Camera ByCS(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, [DefaultArgument("null")] List <Property> additionalCameraParameters) { Matrix3d cameraMat = Utils.ToAstMatrix3d(coordinateSystem, true); additionalCameraParameters = PreSetDefaults(additionalCameraParameters, cameraMat); return(new Camera(additionalCameraParameters)); }
/// <summary> /// Create an Advance Steel Rectangular Wall by defining the extents of the face of the wall by Coordinate System /// </summary> /// <param name="coordinateSystem"> Input Dynamo Coordinate System</param> /// <param name="length"> Input Wall Length</param> /// <param name="height"> Input Wall Height</param> /// <param name="thickness"> Input Wall Thickness</param> /// <param name="additionalConcParameters"> Optional Input Build Properties </param> /// <returns name="walls"> walls</returns> public static Walls FaceByLengthHeightByCS(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, double length, double height, double thickness, [DefaultArgument("null")] List <Property> additionalConcParameters) { additionalConcParameters = PreSetDefaults(additionalConcParameters); return(new Walls(Utils.ToAstPoint(coordinateSystem.Origin, true), Utils.ToInternalDistanceUnits(length, true), Utils.ToInternalDistanceUnits(height, true), Utils.ToInternalDistanceUnits(thickness, true), Utils.ToAstVector3d(coordinateSystem.ZAxis, true), additionalConcParameters)); }
/// <summary> /// Create an Advance Steel Single Grid (Y Axis of CS) /// </summary> /// <param name="coordinateSystem">Input Dynamo Coordinate System - Bottom Left of grid system</param> /// <param name="length">Input Grid Length</param> /// <param name="additionalGridParameters"> Optional Input Grid Build Properties </param> /// <returns name="grid"> grid</returns> public static Grid ByCSByLength(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, double length, [DefaultArgument("null")] List <Property> additionalGridParameters) { Matrix3d gridMat = Utils.ToAstMatrix3d(coordinateSystem, true); additionalGridParameters = PreSetDefaults(additionalGridParameters, gridMat); return(new Grid(additionalGridParameters, length)); }
/// <summary> /// Create an Advance Steel Isolated Footing - Rectangular /// </summary> /// <param name="coordinateSystem"> Input Dynamo Coordinate System to Input location of footing</param> /// <param name="footingDepth"> Input Depth of Footing</param> /// <param name="footingWidth"> Input Width of Footing</param> /// <param name="footingLength"> Input Length of Footing</param> /// <param name="additionalConcParameters"> Optional Input Build Properties </param> /// <returns name="footings"> footings</returns> public static Footings ByLengthWidthOnCS(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, double footingDepth, double footingWidth, double footingLength, [DefaultArgument("null")] List <Property> additionalConcParameters) { additionalConcParameters = PreSetDefaults(additionalConcParameters); return(new Footings(Utils.ToAstPoint(coordinateSystem.Origin, true), Utils.ToAstVector3d(coordinateSystem.ZAxis, true), footingDepth, footingWidth, footingLength, additionalConcParameters)); }
public MeshFromElement() { AddPort(PortType.Input, new PortData("elems", "Revit Elements to extract meshes from"), 0); AddPort(PortType.Input, new PortData("curView", "Restrict extracted meshes to current view?", AstFactory.BuildBooleanNode(false)), 1); AddPort(PortType.Output, new PortData("meshes", "Revit Element Mesh(es)"), 2); // This transform is being used for IGraphicItem transform. I'm not sure exactly why a transform that does not change // the geometry is necessary, but it's left in place for now. transform = Autodesk.DesignScript.Geometry.CoordinateSystem.ByOrigin(0, 0, 0); }
/// <summary> /// Create an Advance Steel Radial Slab By Thickness and Radius /// </summary> /// <param name="coordinateSystem"> Input Dynamo Coordinate System</param> /// <param name="radius"> Slab Radius in Current Model Length Unit Settings</param> /// <param name="thickness"> Slab Thickness in Current Model Length Unit Settings</param> /// <param name="additionalConcParameters"> Optional Input Build Properties </param> /// <returns name="slabs"> slabs</returns> public static Slabs ByCircularByCS(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, double radius, double thickness, [DefaultArgument("null")] List <Property> additionalConcParameters) { additionalConcParameters = PreSetDefaults(additionalConcParameters); return(new Slabs(Utils.ToAstPoint(coordinateSystem.Origin, true), Utils.ToInternalDistanceUnits(radius, true), Utils.ToInternalDistanceUnits(thickness, true), Utils.ToAstVector3d(coordinateSystem.ZAxis, true), additionalConcParameters)); }
/// <summary> /// Create an Advance Steel Special Part /// </summary> /// <param name="coordinateSystem">Input Dynamo Coordinate System</param> /// <param name="blockName"> Input Blockname to be used by SpecialPart</param> /// <param name="scale"> Input Special Part Scale</param> /// <param name="additionalSpecialPartsParameters"> Optional Input Special Part Build Properties </param> /// <returns name="specialPart"> specialPart</returns> public static SpecialPart ByCSAndBlockName(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, string blockName, [DefaultArgument("1")] double scale, [DefaultArgument("null")] List <Property> additionalSpecialPartsParameters) { Matrix3d spMatrix = Utils.ToAstMatrix3d(coordinateSystem, true); additionalSpecialPartsParameters = PreSetDefaults(additionalSpecialPartsParameters, scale); return(new SpecialPart(spMatrix, blockName, additionalSpecialPartsParameters)); }
/// <summary> /// Create an Advance Steel Grid /// </summary> /// <param name="coordinateSystem">Input Dynamo Coordinate System - Bottom Left of grid system</param> /// <param name="length">Input Grid Length</param> /// <param name="width">Input Grid Width</param> /// <param name="noOfGrids">Input the number of Grids</param> /// <param name="additionalGridParameters"> Optional Input Grid Build Properties </param> /// <returns name="camera"> camera</returns> public static Grid ByCSLengthWidthNoOfAxis(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, double length, double width, int noOfGrids, [DefaultArgument("null")] List <Property> additionalGridParameters) { Matrix3d cameraMat = Utils.ToAstMatrix3d(coordinateSystem, true); additionalGridParameters = PreSetDefaults(additionalGridParameters, cameraMat); return(new Grid(additionalGridParameters, length, width, noOfGrids)); }
public void SetTransform(Autodesk.DesignScript.Geometry.CoordinateSystem transform) { var xaxis = transform.XAxis; var yaxis = transform.YAxis; var zaxis = transform.ZAxis; var org = transform.Origin; var csAsMat = new System.Windows.Media.Media3D.Matrix3D(xaxis.X, xaxis.Z, -xaxis.Y, 0, zaxis.X, zaxis.Z, -zaxis.Y, 0, -yaxis.X, -yaxis.Z, yaxis.Y, 0, org.X, org.Z, -org.Y, 1); this.Transform = csAsMat.ToArray(); }
/// <summary> /// Create a rectangular Advance Steel Plate at CS by length and width, including setting the side and thickness /// </summary> /// <param name="coordinateSystem">Input Dynamo CoordinateSytem</param> /// <param name="length">Input Plate Length</param> /// <param name="width">Input Plate Width</param> /// <param name="corner">0 - TL, 1 - TR, 2 - BR, 3 - BL, else center</param> /// <param name="additionalPlateParameters"> Optional Input Plate Build Properties </param> /// <returns name="plate"> plate</returns> public static Plate ByRectanglarByCS(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, double length, double width, [DefaultArgument("-1")] int corner, [DefaultArgument("null")] List <Property> additionalPlateParameters) { if (length == 0) { throw new System.Exception("Length Cant be Zero"); } if (width == 0) { throw new System.Exception("Width Cant be Zero"); } additionalPlateParameters = PreSetDefaults(additionalPlateParameters); return(new Plate(Utils.ToAstPoint(coordinateSystem.Origin, true), Utils.ToAstVector3d(coordinateSystem.ZAxis, true), Utils.ToInternalDistanceUnits(length, true), Utils.ToInternalDistanceUnits(width, true), corner, additionalPlateParameters)); }
/// <summary> /// Get Coordinate System at point on System line /// </summary> /// <param name="steelObject"> Advance Steel element</param> /// <param name="pointOnSystemLine"> Dynamo Point on System line</param> /// <returns name="coordinateSystem"> return coordinate system on beam at a specifc point</returns> public static Autodesk.DesignScript.Geometry.CoordinateSystem GetCoordinateSystemAtPoint(AdvanceSteel.Nodes.SteelDbObject steelObject, Autodesk.DesignScript.Geometry.Point pointOnSystemLine) { Autodesk.DesignScript.Geometry.CoordinateSystem ret = Autodesk.DesignScript.Geometry.CoordinateSystem.ByOrigin(0, 0, 0); Point3d point = Utils.ToAstPoint(pointOnSystemLine, true); using (var ctx = new SteelServices.DocContext()) { if (steelObject != null || point != null) { FilerObject filerObj = Utils.GetObject(steelObject.Handle); if (filerObj != null) { if (filerObj.IsKindOf(FilerObject.eObjectType.kBeam)) { Autodesk.AdvanceSteel.Modelling.Beam selectedObj = filerObj as Autodesk.AdvanceSteel.Modelling.Beam; Matrix3d cs = selectedObj.GetCSAtPoint(point); if (cs != null) { ret = Utils.ToDynCoordinateSys(cs, true); } else { throw new System.Exception("Not Cordinate System was returned from Point"); } } else { throw new System.Exception("Not a BEAM Object"); } } else { throw new System.Exception("AS Object is null"); } } else { throw new System.Exception("Steel Object or Point is null"); } } return(ret); }
/// <summary> /// Create FdCoordinateSystem from Dynamo coordinate system on curve mid u-point. /// </summary> internal static FdCoordinateSystem FromDynamoCurve(Autodesk.DesignScript.Geometry.Curve obj) { // CoordinateSystemAtParameter returns a coordinate system on curve // with origin at the point at the given parameter. // The XAxis is aligned with the curve normal, // the YAxis is aligned with the curve tangent at this point, // and the ZAxis is aligned with the up-vector or binormal at this point Autodesk.DesignScript.Geometry.CoordinateSystem cs = obj.CoordinateSystemAtParameter(0.5); // Note: Arcs and Circles in Dynamo are defined with left-hand rule while coordinate system is defined by right-hand rule if (obj.GetType() == typeof(Autodesk.DesignScript.Geometry.Arc) || obj.GetType() == typeof(Autodesk.DesignScript.Geometry.Circle)) { return(FdCoordinateSystem.FromDynamoCoordinateSystemArcOrCircle(cs)); } else { return(FromDynamoCoordinateSystemLine(cs)); } }
/// <summary> /// Initializes a new instance of the <see cref="SessionVariables"/> class. /// </summary> internal SessionVariables() { ParametersCreated = false; DocumentTotalTransform = null; }
/// <summary> /// Create FdCoordinateSystem from Dynamo coordinate system on surface mid u/v-point. /// </summary> internal static FdCoordinateSystem FromDynamoSurface(Autodesk.DesignScript.Geometry.Surface obj) { Autodesk.DesignScript.Geometry.CoordinateSystem cs = obj.CoordinateSystemAtParameter(0.5, 0.5); return(FdCoordinateSystem.FromDynamoCoordinateSystemSurface(cs)); }