public static SurfaceSupport SurfaceSupportDefine(Autodesk.DesignScript.Geometry.Surface surface, Motions motions, [DefaultArgument("MotionsPlasticLimits.Default()")] MotionsPlasticLimits motionsPlasticLimits, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localX, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localZ, [DefaultArgument("S")] string identifier) { // convert geometry Geometry.Region region = Geometry.Region.FromDynamo(surface); // create new surface support SurfaceSupport obj = new SurfaceSupport(region, motions, motionsPlasticLimits, identifier); // set local x-axis if (!localX.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { obj.CoordinateSystem.SetXAroundZ(FemDesign.Geometry.FdVector3d.FromDynamo(localX)); } // set local z-axis if (!localZ.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { obj.CoordinateSystem.SetZAroundX(FemDesign.Geometry.FdVector3d.FromDynamo(localZ)); } return(obj); }
/// <summary> /// Compares a single curve to a list of curves to find any curves that have the same normalised vector. /// </summary> /// <param name="curve"></param> /// <param name="curves"></param> /// <search></search> public static List <Autodesk.DesignScript.Geometry.Curve> FindMatchingVectorCurves(this Autodesk.DesignScript.Geometry.Curve curve, List <Autodesk.DesignScript.Geometry.Curve> curves) { Autodesk.DesignScript.Geometry.Point stPt1 = curve.StartPoint; Autodesk.DesignScript.Geometry.Point endPt1 = curve.EndPoint; Autodesk.DesignScript.Geometry.Vector vec1 = Autodesk.DesignScript.Geometry.Vector.ByTwoPoints(stPt1, endPt1).Normalized(); string str1 = vec1.ToString(); List <string> curveList = new List <string>(); foreach (var c in curves) { Autodesk.DesignScript.Geometry.Point stPt2 = c.StartPoint; Autodesk.DesignScript.Geometry.Point endPt2 = c.EndPoint; Autodesk.DesignScript.Geometry.Vector vec2 = Autodesk.DesignScript.Geometry.Vector.ByTwoPoints(stPt2, endPt2).Normalized(); string str2 = vec2.ToString(); curveList.Add(str2); //Dispose redundant geometry stPt2.Dispose(); endPt2.Dispose(); vec2.Dispose(); } List <Autodesk.DesignScript.Geometry.Curve> matchingCurves = new List <Autodesk.DesignScript.Geometry.Curve>(); for (int i = 0; i < curveList.Count; i++) { if (str1 == curveList[i]) { matchingCurves.Add(curves[i]); } } if (matchingCurves.Count == 0) { List <string> revCurveList = new List <string>(); foreach (var c in curves) { Autodesk.DesignScript.Geometry.Point stPt2 = c.StartPoint; Autodesk.DesignScript.Geometry.Point endPt2 = c.EndPoint; Autodesk.DesignScript.Geometry.Vector vec2 = Autodesk.DesignScript.Geometry.Vector.ByTwoPoints(endPt2, stPt2).Normalized(); string str2 = vec2.ToString(); revCurveList.Add(str2); //Dispose redundant geometry stPt2.Dispose(); endPt2.Dispose(); vec2.Dispose(); } for (int i = 0; i < revCurveList.Count; i++) { if (str1 == revCurveList[i]) { matchingCurves.Add(curves[i]); } } } //Dispose redundant geometry stPt1.Dispose(); endPt1.Dispose(); vec1.Dispose(); return(matchingCurves); }
public static PressureLoad Define(Autodesk.DesignScript.Geometry.Surface surface, Autodesk.DesignScript.Geometry.Vector direction, double z0, double q0, double qh, LoadCase loadCase, string comment = "") { // get fdGeometry Geometry.Region region = Geometry.Region.FromDynamo(surface); // normalize direction Geometry.FdVector3d _loadDirection = Geometry.FdVector3d.FromDynamo(direction).Normalize(); // create SurfaceLoad PressureLoad _pressureLoad = new PressureLoad(region, _loadDirection, z0, q0, qh, loadCase, comment, false, ForceLoadType.Force); return(_pressureLoad); }
public static Slab Plate(Autodesk.DesignScript.Geometry.Surface surface, double thickness, Materials.Material material, [DefaultArgument("ShellEccentricity.Default()")] ShellEccentricity shellEccentricity, [DefaultArgument("ShellOrthotropy.Default()")] ShellOrthotropy shellOrthotropy, [DefaultArgument("EdgeConnection.Default()")] EdgeConnection shellEdgeConnection, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localX, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localZ, string identifier = "P") { // create FlatSurface Geometry.Region region = Geometry.Region.FromDynamo(surface); // create Thickness object List <Thickness> _thickness = new List <Thickness>(); _thickness.Add(new Thickness(region.CoordinateSystem.Origin, thickness)); // create shell Slab slab = Slab.Plate(identifier, material, region, shellEdgeConnection, shellEccentricity, shellOrthotropy, _thickness); // set local x-axis if (!localX.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { slab.SlabPart.LocalX = FemDesign.Geometry.FdVector3d.FromDynamo(localX); } // set local z-axis if (!localZ.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { slab.SlabPart.LocalZ = FemDesign.Geometry.FdVector3d.FromDynamo(localZ); } return(slab); }
internal StraightBeam(Autodesk.DesignScript.Geometry.Point ptStart, Autodesk.DesignScript.Geometry.Point ptEnd, Autodesk.DesignScript.Geometry.Vector vOrientation) { lock (access_obj) { using (var ctx = new SteelServices.DocContext()) { string handle = SteelServices.ElementBinder.GetHandleFromTrace(); Point3d beamStart = Utils.ToAstPoint(ptStart, true); Point3d beamEnd = Utils.ToAstPoint(ptEnd, true); Autodesk.AdvanceSteel.Modelling.StraightBeam beam = null; if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) { ProfileName profName = new ProfileName(); ProfilesManager.GetProfTypeAsDefault("I", out profName); beam = new Autodesk.AdvanceSteel.Modelling.StraightBeam(profName.Name, beamStart, beamEnd, Vector3d.kXAxis); beam.WriteToDb(); } else { beam = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.StraightBeam; if (beam != null && beam.IsKindOf(FilerObject.eObjectType.kStraightBeam)) { Utils.AdjustBeamEnd(beam, beamStart); beam.SetSysStart(beamStart); beam.SetSysEnd(beamEnd); Utils.SetOrientation(beam, Utils.ToAstVector3d(vOrientation, true)); } else { throw new System.Exception("Not a straight Beam"); } } Handle = beam.Handle; SteelServices.ElementBinder.CleanupAndSetElementForTrace(beam); } } }
internal PolyBeam(Polyline3d poly, Autodesk.DesignScript.Geometry.Vector vOrientation, List <Property> beamProperties) { lock (access_obj) { using (var ctx = new SteelServices.DocContext()) { List <Property> defaultData = beamProperties.Where(x => x.Level == ".").ToList <Property>(); List <Property> postWriteDBData = beamProperties.Where(x => x.Level == "Z_PostWriteDB").ToList <Property>(); Property foundProfName = beamProperties.FirstOrDefault <Property>(x => x.Name == "ProfName"); string sectionName = ""; if (foundProfName != null) { sectionName = (string)foundProfName.InternalValue; } string handle = SteelServices.ElementBinder.GetHandleFromTrace(); if (string.IsNullOrEmpty(sectionName)) { ProfileName profName = new ProfileName(); ProfilesManager.GetProfTypeAsDefault("I", out profName); sectionName = profName.Name; } Vector3d refVect = Utils.ToAstVector3d(vOrientation, true); Autodesk.AdvanceSteel.Modelling.PolyBeam beam = null; if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) { beam = new Autodesk.AdvanceSteel.Modelling.PolyBeam(sectionName, poly, refVect); if (defaultData != null) { Utils.SetParameters(beam, defaultData); } beam.WriteToDb(); if (postWriteDBData != null) { Utils.SetParameters(beam, postWriteDBData); } } else { beam = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.PolyBeam; if (beam != null && beam.IsKindOf(FilerObject.eObjectType.kPolyBeam)) { beam.SetPolyline(poly); if (defaultData != null) { Utils.SetParameters(beam, defaultData); } Utils.SetOrientation(beam, refVect); if (postWriteDBData != null) { Utils.SetParameters(beam, postWriteDBData); } } else { throw new System.Exception("Not an UnFolded Straight Beam"); } } Handle = beam.Handle; SteelServices.ElementBinder.CleanupAndSetElementForTrace(beam); } } }
internal ConcreteStraightBeam(string concName, Autodesk.DesignScript.Geometry.Point ptStart, Autodesk.DesignScript.Geometry.Point ptEnd, Autodesk.DesignScript.Geometry.Vector vOrientation, List <Property> concreteProperties) { lock (access_obj) { using (var ctx = new SteelServices.DocContext()) { List <Property> defaultData = concreteProperties.Where(x => x.Level == ".").ToList <Property>(); List <Property> postWriteDBData = concreteProperties.Where(x => x.Level == "Z_PostWriteDB").ToList <Property>(); string handle = SteelServices.ElementBinder.GetHandleFromTrace(); Point3d beamStart = Utils.ToAstPoint(ptStart, true); Point3d beamEnd = Utils.ToAstPoint(ptEnd, true); Vector3d refVect = Utils.ToAstVector3d(vOrientation, true); Autodesk.AdvanceSteel.Modelling.ConcreteBeam concBeam = null; if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) { concBeam = new Autodesk.AdvanceSteel.Modelling.ConcreteBeam(concName, beamStart, beamEnd, refVect); if (defaultData != null) { Utils.SetParameters(concBeam, defaultData); } concBeam.WriteToDb(); if (postWriteDBData != null) { Utils.SetParameters(concBeam, postWriteDBData); } } else { concBeam = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.ConcreteBeam; if (concBeam != null && concBeam.IsKindOf(FilerObject.eObjectType.kConcreteBeam)) { Utils.AdjustBeamEnd(concBeam, beamStart); concBeam.SetSysStart(beamStart); concBeam.SetSysEnd(beamEnd); concBeam.ProfName = concName; Utils.SetOrientation(concBeam, refVect); if (defaultData != null) { Utils.SetParameters(concBeam, defaultData); } if (postWriteDBData != null) { Utils.SetParameters(concBeam, postWriteDBData); } } else { throw new System.Exception("Not a Concrete Straight Beam"); } } Handle = concBeam.Handle; SteelServices.ElementBinder.CleanupAndSetElementForTrace(concBeam); } } }
public abstract Vector GetOffset(Point newPosition, Vector viewDirection);
public abstract bool HitTest(Point source, Vector direction, out object hitObject);
/// <summary> /// Create a Revit Tag for a Revit Element at an offset location /// from the element's view extents /// </summary> /// <param name="view">View to tag in</param> /// <param name="element">Element to tag</param> /// <param name="horizontal">Optional: Place tag horizontal, /// defaults to true</param> /// <param name="addLeader">Optional: Add a leader, defaults to false</param> /// <param name="offset">Optional: Offset Vector, defaults to 0,0,0</param> /// <param name="horizontalAlignment">Optional: Horizontal Alignment /// within the element's extents, defaults to Center</param> /// <param name="verticalAlignment">Optional: Vertical Alignment /// within the element's extents, defaults to Middle</param> /// <returns></returns> /// <search> /// tagelement,annotate,documentation,tagoffset,movetag /// </search> public static Tag ByElementAndOffset(Revit.Elements.Views.View view, Element element, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector offset, string horizontalAlignment = "Center", string verticalAlignment = "Middle", bool horizontal = true, bool addLeader = false) { Autodesk.Revit.DB.HorizontalAlignmentStyle horizontalAlignmentStyle = HorizontalAlignmentStyle.Center; if (!Enum.TryParse <Autodesk.Revit.DB.HorizontalAlignmentStyle>(horizontalAlignment, out horizontalAlignmentStyle)) { horizontalAlignmentStyle = HorizontalAlignmentStyle.Center; } Autodesk.Revit.DB.VerticalAlignmentStyle verticalAlignmentStyle = VerticalAlignmentStyle.Middle; if (!Enum.TryParse <Autodesk.Revit.DB.VerticalAlignmentStyle>(verticalAlignment, out verticalAlignmentStyle)) { verticalAlignmentStyle = VerticalAlignmentStyle.Middle; } Autodesk.Revit.DB.View revitView = (Autodesk.Revit.DB.View)view.InternalElement; // Tagging elements by element category Autodesk.Revit.DB.TagMode tagMode = TagMode.TM_ADDBY_CATEGORY; Autodesk.Revit.DB.TagOrientation orientation = (horizontal) ? TagOrientation.Horizontal : TagOrientation.Vertical; if (!view.IsAnnotationView()) { throw new Exception(Properties.Resources.ViewDoesNotSupportAnnotations); } XYZ location = GetExtentsWithOffset(element, revitView, offset.ToRevitType(true), verticalAlignmentStyle, horizontalAlignmentStyle); return(new Tag(revitView, element.InternalElement, orientation, tagMode, addLeader, location)); }
public abstract bool HitTest(Point source, Vector direction, out object hitObject);
/// <summary> /// Converts a Dynamo Vector into a Revit XYZ object /// </summary> /// <param name="Vector"></param> /// <returns></returns> public static revitXYZ ConvertVectorToXYZ(dynaVector Vector) { return(new revitXYZ(Vector.X, Vector.Y, Vector.Z)); }
/// <summary> /// Create a Dimension for an Element in the specified direction and view. /// </summary> /// <param name="view">View to place dimension in</param> /// <param name="element">The element of generated Dimension</param> /// <param name="direction">The direction to create Dimension</param> /// <param name="line">location of the dimension</param> /// <param name="suffix">Suffix</param> /// <param name="prefix">Prefix</param> /// <returns></returns> public static Dimension ByElementDirection(Revit.Elements.Views.View view, Revit.Elements.Element element, Autodesk.DesignScript.Geometry.Vector direction, [DefaultArgument("null")] Autodesk.DesignScript.Geometry.Line line, string suffix = "", string prefix = "") { var revitDirection = direction.ToRevitType(); List <Autodesk.Revit.DB.PlanarFace> planars = new List <PlanarFace>(); ReferenceArray array = new ReferenceArray(); var opt = new Options(); opt.ComputeReferences = true; var faces = element.InternalGeometry(false).OfType <Autodesk.Revit.DB.Solid>().SelectMany(x => x.Faces.OfType <Autodesk.Revit.DB.PlanarFace>()); var references = faces.Select(x => x.Reference); Line revitLine = null; foreach (var face in faces) { var isParallel = direction.IsParallel(face.FaceNormal.ToVector()); if (isParallel) { array.Append(face.Reference); planars.Add(face); } } if (planars.Count < 2) { throw new Exception(string.Format(Properties.Resources.NotEnoughDataError, "Surface on this Direction")); } if (line == null) { revitLine = Line.CreateBound(planars[0].Origin, planars[0].Origin.Add(direction.ToXyz())); } else { revitLine = (Line)line.ToRevitType(true); } return(new Dimension(view.InternalView, revitLine, array, suffix, prefix)); }
internal BentBeam(Autodesk.DesignScript.Geometry.Point ptStart, Autodesk.DesignScript.Geometry.Point ptEnd, Autodesk.DesignScript.Geometry.Point ptOnArc, Autodesk.DesignScript.Geometry.Vector vOrientation) { //use lock just to be safe //AutoCAD does not support multithreaded access lock (myLock) { //lock the document and start transaction using (var _CADAccess = new AdvanceSteel.Services.ObjectAccess.CADContext()) { string handle = AdvanceSteel.Services.ElementBinder.GetHandleFromTrace(); var beamStart = (ptStart == null ? new Point3d() : Utils.ToAstPoint(ptStart, true)); var beamEnd = (ptEnd == null ? new Point3d() : Utils.ToAstPoint(ptEnd, true)); _ptOnArc = Utils.ToAstPoint(ptOnArc, true); if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) { ProfileName profName = new ProfileName(); ProfilesManager.GetProfTypeAsDefault("I", out profName); var myBeam = new Autodesk.AdvanceSteel.Modelling.BentBeam(profName.Name, Vector3d.kZAxis, beamStart, _ptOnArc, beamEnd); myBeam.WriteToDb(); handle = myBeam.Handle; } var beam = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.BentBeam; if (beam != null && beam.IsKindOf(FilerObject.eObjectType.kBentBeam)) { beam.SetSystemline(beamStart, _ptOnArc, beamEnd); Utils.SetOrientation(beam, Utils.ToAstVector3d(vOrientation, true)); } else { throw new System.Exception("Not a bent Beam"); } Handle = handle; AdvanceSteel.Services.ElementBinder.CleanupAndSetElementForTrace(beam); } } }
public static LineSupport Define(Autodesk.DesignScript.Geometry.Curve curve, Motions motions, [DefaultArgument("MotionsPlasticLimits.Default()")] MotionsPlasticLimits motionsPlasticLimits, Rotations rotations, [DefaultArgument("RotationsPlasticLimits.Default()")] RotationsPlasticLimits rotationsPlasticLimits, [DefaultArgument("false")] bool movingLocal, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localY, [DefaultArgument("true")] bool orientLCS, [DefaultArgument("S")] string identifier) { Geometry.Edge edge = Geometry.Edge.FromDynamoLineOrArc1(curve); FemDesign.Supports.LineSupport obj = new LineSupport(edge, motions, motionsPlasticLimits, rotations, rotationsPlasticLimits, movingLocal, identifier); // set local y-axis if (!localY.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { obj.Group.LocalY = FemDesign.Geometry.FdVector3d.FromDynamo(localY); } // else orient coordinate system to GCS else { if (orientLCS) { obj.Group.OrientCoordinateSystemToGCS(); } } return(obj); }
public abstract Vector GetOffset(Point newPosition, Vector viewDirection);
/// <summary> /// Create an Advance Steel compound beam /// </summary> /// <param name="start">Start point</param> /// <param name="end">End point</param> /// <param name="vOrientation">Section orientation</param> /// <param name="sectionName">Section name</param> /// <returns></returns> public static CompoundBeam ByStartPointEndPoint(Autodesk.DesignScript.Geometry.Point start, Autodesk.DesignScript.Geometry.Point end, Autodesk.DesignScript.Geometry.Vector vOrientation, string sectionName) { return(new CompoundBeam(start, end, vOrientation, sectionName)); }
public static Vector Duplicate(this Triple vector) => Vector.ByCoordinates(vector.X, vector.Y, vector.Z);
public static FictitiousShell Define(Autodesk.DesignScript.Geometry.Surface surface, StiffnessMatrix4Type d, StiffnessMatrix4Type k, StiffnessMatrix2Type h, double density, double t1, double t2, double alpha1, double alpha2, bool ignoreInStImpCalc, [DefaultArgument("EdgeConnection.Default()")] Shells.EdgeConnection edgeConnection, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localX, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localZ, double avgSrfElemSize = 0, string identifier = "FS") { // convert geometry Geometry.Region region = Geometry.Region.FromDynamo(surface); Geometry.FdVector3d x = Geometry.FdVector3d.FromDynamo(localX); Geometry.FdVector3d z = Geometry.FdVector3d.FromDynamo(localZ); // add edge connections to region region.SetEdgeConnections(edgeConnection); // FictitiousShell obj = new FictitiousShell(region, d, k, h, density, t1, t2, alpha1, alpha2, ignoreInStImpCalc, avgSrfElemSize, identifier); // set local x-axis if (!localX.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { obj.LocalX = FemDesign.Geometry.FdVector3d.FromDynamo(localX); } // set local z-axis if (!localZ.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { obj.LocalZ = FemDesign.Geometry.FdVector3d.FromDynamo(localZ); } // return return(obj); }
public static Triple ToTriple(this Vector vector) => new Triple(vector.X, vector.Y, vector.Z);
public static Slab Wall(Autodesk.DesignScript.Geometry.Surface surface, double thickness, Materials.Material material, [DefaultArgument("ShellEccentricity.Default()")] ShellEccentricity shellEccentricity, [DefaultArgument("ShellOrthotropy.Default()")] ShellOrthotropy shellOrthotropy, [DefaultArgument("EdgeConnection.Default()")] EdgeConnection shellEdgeConnection, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localX, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localZ, string identifier = "W") { // create FlatSurface Geometry.Region region = Geometry.Region.FromDynamo(surface); // create Thickness object List <Thickness> _thickness = new List <Thickness>(); _thickness.Add(new Thickness(region.CoordinateSystem.Origin, thickness)); // check if surface is vertical if (Math.Abs(region.CoordinateSystem.LocalZ.Z) > FemDesign.Tolerance.Point3d) { throw new System.ArgumentException("Wall is not vertical! Create plate instead."); } // create shell Slab slab = Slab.Wall(identifier, material, region, shellEdgeConnection, shellEccentricity, shellOrthotropy, _thickness); // set local x-axis if (!localX.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { slab.SlabPart.LocalX = FemDesign.Geometry.FdVector3d.FromDynamo(localX); } // set local z-axis if (!localZ.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { slab.SlabPart.LocalZ = FemDesign.Geometry.FdVector3d.FromDynamo(localZ); } return(slab); }
public static Cover OneWayCover(Autodesk.DesignScript.Geometry.Surface surface, [DefaultArgument("[]")] List <object> supportingStructures, Autodesk.DesignScript.Geometry.Vector loadBearingDirection = null, string identifier = "CO") { // create FlatSurface Geometry.Region region = Geometry.Region.FromDynamo(surface); // get loadBearingDirection Geometry.FdVector3d _loadBearingDirection = Geometry.FdVector3d.FromDynamo(loadBearingDirection).Normalize(); // return return(Cover.OneWayCover(region, supportingStructures, _loadBearingDirection, identifier)); }
public static Slab PlateVariableThickness(Autodesk.DesignScript.Geometry.Surface surface, List <Thickness> thickness, Materials.Material material, [DefaultArgument("ShellEccentricity.Default()")] ShellEccentricity shellEccentricity, [DefaultArgument("ShellOrthotropy.Default()")] ShellOrthotropy shellOrthotropy, [DefaultArgument("EdgeConnection.Default()")] EdgeConnection shellEdgeConnection, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localX, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localZ, string identifier = "P") { // create FlatSurface Geometry.Region region = Geometry.Region.FromDynamo(surface); // check length of thickness if (thickness.Count != 3) { throw new System.ArgumentException("Thickness must contain exactly 3 items."); } // create shell Slab slab = Slab.Plate(identifier, material, region, shellEdgeConnection, shellEccentricity, shellOrthotropy, thickness); // set local x-axis if (!localX.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { slab.SlabPart.LocalX = FemDesign.Geometry.FdVector3d.FromDynamo(localX); } // set local z-axis if (!localZ.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { slab.SlabPart.LocalZ = FemDesign.Geometry.FdVector3d.FromDynamo(localZ); } return(slab); }
internal CompoundBeam(Autodesk.DesignScript.Geometry.Point ptStart, Autodesk.DesignScript.Geometry.Point ptEnd, Autodesk.DesignScript.Geometry.Vector vOrientation, string beamSection) { //use lock just to be safe //AutoCAD does not support multithreaded access lock (myLock) { //lock the document and start transaction using (var _CADAccess = new AdvanceSteel.Services.ObjectAccess.CADContext()) { string handle = AdvanceSteel.Services.ElementBinder.GetHandleFromTrace(); Point3d beamStart = Utils.ToAstPoint(ptStart, true); Point3d beamEnd = Utils.ToAstPoint(ptEnd, true); string sectionType = Utils.SplitSectionName(beamSection)[0]; string sectionName = Utils.SplitSectionName(beamSection)[1]; if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) { var myBeam = new Autodesk.AdvanceSteel.Modelling.CompoundStraightBeam(beamStart, beamEnd, Vector3d.kXAxis); myBeam.CreateComponents(sectionType, sectionName); myBeam.WriteToDb(); handle = myBeam.Handle; } CompoundStraightBeam beamCompound = Utils.GetObject(handle) as CompoundStraightBeam; if (beamCompound != null && beamCompound.IsKindOf(FilerObject.eObjectType.kCompoundStraightBeam)) { Utils.AdjustBeamEnd(beamCompound, beamStart); beamCompound.SetSysStart(beamStart); beamCompound.SetSysEnd(beamEnd); Utils.SetOrientation(beamCompound, Utils.ToAstVector3d(vOrientation, true)); if (Utils.CompareCompoundSectionTypes(sectionType, beamCompound.ProfSectionType)) { if (beamCompound.ProfSectionName != sectionName) { beamCompound.ChangeProfile(sectionType, sectionName); } } else { throw new System.Exception("Failed to change section as compound section type is different than the one created the beam was created with"); } } else { throw new System.Exception("Not a compound beam"); } this.Handle = handle; AdvanceSteel.Services.ElementBinder.CleanupAndSetElementForTrace(beamCompound); } } }
/// <summary> /// Create an Advance Steel straight beam between two points /// </summary> /// <param name="start">Start point</param> /// <param name="end">End point</param> /// <param name="vOrientation">Section orientation</param> /// <returns></returns> public static StraightBeam ByStartPointEndPoint(Autodesk.DesignScript.Geometry.Point start, Autodesk.DesignScript.Geometry.Point end, Autodesk.DesignScript.Geometry.Vector vOrientation) { return(new StraightBeam(start, end, vOrientation)); }
internal TaperedBeam(Autodesk.DesignScript.Geometry.Point ptStart, Autodesk.DesignScript.Geometry.Point ptEnd, Autodesk.DesignScript.Geometry.Vector vOrientation, double startHeight, double endHeight, double webThickness, List <Property> beamProperties) { lock (access_obj) { using (var ctx = new SteelServices.DocContext()) { List <Property> defaultData = beamProperties.Where(x => x.Level == ".").ToList <Property>(); List <Property> postWriteDBData = beamProperties.Where(x => x.Level == "Z_PostWriteDB").ToList <Property>(); string handle = SteelServices.ElementBinder.GetHandleFromTrace(); Point3d beamStart = Utils.ToAstPoint(ptStart, true); Point3d beamEnd = Utils.ToAstPoint(ptEnd, true); Vector3d refVect = Utils.ToAstVector3d(vOrientation, true); Autodesk.AdvanceSteel.Modelling.BeamTapered beam = null; if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) { beam = new Autodesk.AdvanceSteel.Modelling.BeamTapered(beamStart, beamEnd, refVect, startHeight, endHeight, webThickness); beam.CreateComponents(); if (defaultData != null) { Utils.SetParameters(beam, defaultData); } beam.WriteToDb(); if (postWriteDBData != null) { Utils.SetParameters(beam, postWriteDBData); } } else { beam = Utils.GetObject(handle) as BeamTapered; if (beam != null && beam.IsKindOf(FilerObject.eObjectType.kBeamTapered)) { Utils.AdjustBeamEnd(beam, beamStart); beam.SetSysStart(beamStart); beam.SetSysEnd(beamEnd); if (defaultData != null) { Utils.SetParameters(beam, defaultData); } Utils.SetOrientation(beam, refVect); if (postWriteDBData != null) { Utils.SetParameters(beam, postWriteDBData); } } else { throw new System.Exception("Not a tapered beam"); } } Handle = beam.Handle; SteelServices.ElementBinder.CleanupAndSetElementForTrace(beam); } } }
/// <summary> /// Create FdVector3d from Dynamo vector. /// </summary> public static FdVector3d FromDynamo(Autodesk.DesignScript.Geometry.Vector vector) { FdVector3d newVector = new FdVector3d(vector.X, vector.Y, vector.Z); return(newVector); }
/// <summary> /// Create an Advance Steel bent beam between two points and a point on arc /// </summary> /// <param name="start">Start point</param> /// <param name="end">End point</param> /// <param name="ptOnArc">Point on arc</param> /// <param name="vOrientation">Section orientation</param> /// <returns></returns> public static BentBeam ByStartPointEndPoint(Autodesk.DesignScript.Geometry.Point start, Autodesk.DesignScript.Geometry.Point end, Autodesk.DesignScript.Geometry.Point ptOnArc, Autodesk.DesignScript.Geometry.Vector vOrientation) { return(new BentBeam(start, end, ptOnArc, vOrientation)); }
internal CompoundBeam(Autodesk.DesignScript.Geometry.Point ptStart, Autodesk.DesignScript.Geometry.Point ptEnd, Autodesk.DesignScript.Geometry.Vector vOrientation, List <Property> beamProperties) { lock (access_obj) { using (var ctx = new SteelServices.DocContext()) { List <Property> defaultData = beamProperties.Where(x => x.Level == ".").ToList <Property>(); List <Property> postWriteDBData = beamProperties.Where(x => x.Level == "Z_PostWriteDB").ToList <Property>(); Property foundProfName = beamProperties.FirstOrDefault <Property>(x => x.Name == "ProfName"); string sectionProfileName = ""; if (foundProfName != null) { sectionProfileName = (string)foundProfName.InternalValue; } string handle = SteelServices.ElementBinder.GetHandleFromTrace(); Point3d beamStart = Utils.ToAstPoint(ptStart, true); Point3d beamEnd = Utils.ToAstPoint(ptEnd, true); Vector3d refVect = Utils.ToAstVector3d(vOrientation, true); string sectionType = Utils.SplitSectionName(sectionProfileName)[0]; string sectionName = Utils.SplitSectionName(sectionProfileName)[1]; Autodesk.AdvanceSteel.Modelling.CompoundStraightBeam beam = null; if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) { beam = new Autodesk.AdvanceSteel.Modelling.CompoundStraightBeam(beamStart, beamEnd, refVect); beam.CreateComponents(sectionType, sectionName); if (defaultData != null) { Utils.SetParameters(beam, defaultData); } beam.WriteToDb(); if (postWriteDBData != null) { Utils.SetParameters(beam, postWriteDBData); } } else { beam = Utils.GetObject(handle) as CompoundStraightBeam; if (beam != null && beam.IsKindOf(FilerObject.eObjectType.kCompoundStraightBeam)) { Utils.AdjustBeamEnd(beam, beamStart); beam.SetSysStart(beamStart); beam.SetSysEnd(beamEnd); if (defaultData != null) { Utils.SetParameters(beam, defaultData); } Utils.SetOrientation(beam, refVect); if (postWriteDBData != null) { Utils.SetParameters(beam, postWriteDBData); } if (Utils.CompareCompoundSectionTypes(sectionType, beam.ProfSectionType)) { if (beam.ProfSectionName != sectionName) { beam.ChangeProfile(sectionType, sectionName); } } else { throw new System.Exception("Failed to change section as compound section type is different than the one created the beam was created with"); } } else { throw new System.Exception("Not a compound beam"); } } Handle = beam.Handle; SteelServices.ElementBinder.CleanupAndSetElementForTrace(beam); } } }
internal CompoundBeam(Autodesk.DesignScript.Geometry.Point ptStart, Autodesk.DesignScript.Geometry.Point ptEnd, Autodesk.DesignScript.Geometry.Vector vOrientation, string beamSection) { lock (access_obj) { using (var ctx = new SteelServices.DocContext()) { string handle = SteelServices.ElementBinder.GetHandleFromTrace(); Point3d beamStart = Utils.ToAstPoint(ptStart, true); Point3d beamEnd = Utils.ToAstPoint(ptEnd, true); string sectionType = Utils.SplitSectionName(beamSection)[0]; string sectionName = Utils.SplitSectionName(beamSection)[1]; Autodesk.AdvanceSteel.Modelling.CompoundStraightBeam beam = null; if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) { beam = new Autodesk.AdvanceSteel.Modelling.CompoundStraightBeam(beamStart, beamEnd, Vector3d.kXAxis); beam.CreateComponents(sectionType, sectionName); Utils.SetOrientation(beam, Utils.ToAstVector3d(vOrientation, true)); beam.WriteToDb(); } else { beam = Utils.GetObject(handle) as CompoundStraightBeam; if (beam != null && beam.IsKindOf(FilerObject.eObjectType.kCompoundStraightBeam)) { Utils.AdjustBeamEnd(beam, beamStart); beam.SetSysStart(beamStart); beam.SetSysEnd(beamEnd); Utils.SetOrientation(beam, Utils.ToAstVector3d(vOrientation, true)); if (Utils.CompareCompoundSectionTypes(sectionType, beam.ProfSectionType)) { if (beam.ProfSectionName != sectionName) { beam.ChangeProfile(sectionType, sectionName); } } else { throw new System.Exception("Failed to change section as compound section type is different than the one created the beam was created with"); } } else { throw new System.Exception("Not a compound beam"); } } Handle = beam.Handle; SteelServices.ElementBinder.CleanupAndSetElementForTrace(beam); } } }
public static LineTemperatureLoad Define(Autodesk.DesignScript.Geometry.Curve curve, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,1)")] Autodesk.DesignScript.Geometry.Vector direction, List <TopBotLocationValue> topBottomLocationValues, LoadCase loadCase, string comments = "") { // convert geometry Geometry.Edge edge = Geometry.Edge.FromDynamoLineOrArc1(curve); Geometry.FdVector3d v = Geometry.FdVector3d.FromDynamo(direction); // return return(new LineTemperatureLoad(edge, v, topBottomLocationValues, loadCase, comments)); }
public static Bar Column(Autodesk.DesignScript.Geometry.Line line, Materials.Material material, Sections.Section[] section, [DefaultArgument("Connectivity.Default()")] Connectivity[] connectivity, [DefaultArgument("Eccentricity.Default()")] Eccentricity[] eccentricity, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localY, [DefaultArgument("true")] bool orientLCS, string identifier = "C") { // convert class Geometry.Edge edge = Geometry.Edge.FromDynamoLine(line); // create bar var type = BarType.Column; Bar bar = new Bar(edge, type, material, section, eccentricity, connectivity, identifier); // set local y-axis if (!localY.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0))) { bar.BarPart.LocalY = FemDesign.Geometry.FdVector3d.FromDynamo(localY); } // else orient coordinate system to GCS else { if (orientLCS) { bar.BarPart.OrientCoordinateSystemToGCS(); } } // return return(bar); }