public ETABSElement1D LinkToSpeckle(string name) { string units = ModelUnits(); var speckleStructLink = new ETABSElement1D(); speckleStructLink.type = ElementType1D.Link; speckleStructLink.name = name; string pointI, pointJ; pointI = pointJ = null; _ = Model.LinkObj.GetPoints(name, ref pointI, ref pointJ); var pointINode = PointToSpeckle(pointI); var pointJNode = PointToSpeckle(pointJ); speckleStructLink.end1Node = pointINode; speckleStructLink.end2Node = pointJNode; var speckleLine = new Line(); if (units != null) { speckleLine = new Line(pointINode.basePoint, pointJNode.basePoint, units); } else { speckleLine = new Line(pointINode.basePoint, pointJNode.basePoint); } speckleStructLink.baseLine = speckleLine; double localAxis = 0; bool advanced = false; Model.LinkObj.GetLocalAxes(name, ref localAxis, ref advanced); speckleStructLink.orientationAngle = localAxis; speckleStructLink.type = ElementType1D.Link; string linkProp = null; Model.LinkObj.GetProperty(name, ref linkProp); speckleStructLink.property = LinkPropertyToSpeckle(linkProp); var GUID = ""; Model.LinkObj.GetGUID(name, ref GUID); speckleStructLink.applicationId = GUID; List <Base> elements = SpeckleModel.elements; List <string> application_Id = elements.Select(o => o.applicationId).ToList(); if (!application_Id.Contains(speckleStructLink.applicationId)) { SpeckleModel.elements.Add(speckleStructLink); } return(speckleStructLink); }
public void LinkToNative(ETABSElement1D link) { PointToNative((ETABSNode)link.end1Node); PointToNative((ETABSNode)link.end2Node); string linkName = null; int numberProps = 0; string[] listProp = null; Model.PropLink.GetNameList(ref numberProps, ref listProp); if (listProp.Contains(link.property.name)) { Model.LinkObj.AddByPoint(link.end1Node.name, link.end2Node.name, ref linkName, PropName: link.property.name); } else { LinkPropertyToNative((ETABSLinkProperty)link.property); Model.LinkObj.AddByPoint(link.end1Node.name, link.end2Node.name, ref linkName, PropName: link.property.name); } return; }
public ETABSElement1D FrameToSpeckle(string name) { string units = ModelUnits(); var speckleStructFrame = new ETABSElement1D(); speckleStructFrame.name = name; string pointI, pointJ; pointI = pointJ = null; _ = Model.FrameObj.GetPoints(name, ref pointI, ref pointJ); var pointINode = PointToSpeckle(pointI); var pointJNode = PointToSpeckle(pointJ); speckleStructFrame.end1Node = pointINode; speckleStructFrame.end2Node = pointJNode; var speckleLine = new Line(); if (units != null) { speckleLine = new Line(pointINode.basePoint, pointJNode.basePoint, units); } else { speckleLine = new Line(pointINode.basePoint, pointJNode.basePoint); } speckleStructFrame.baseLine = speckleLine; eFrameDesignOrientation frameDesignOrientation = eFrameDesignOrientation.Null; Model.FrameObj.GetDesignOrientation(name, ref frameDesignOrientation); switch (frameDesignOrientation) { case eFrameDesignOrientation.Column: { speckleStructFrame.type = ElementType1D.Column; break; } case eFrameDesignOrientation.Beam: { speckleStructFrame.type = ElementType1D.Beam; break; } case eFrameDesignOrientation.Brace: { speckleStructFrame.type = ElementType1D.Brace; break; } case eFrameDesignOrientation.Null: { speckleStructFrame.type = ElementType1D.Null; break; } case eFrameDesignOrientation.Other: { speckleStructFrame.type = ElementType1D.Other; break; } } bool[] iRelease, jRelease; iRelease = jRelease = null; double[] startV, endV; startV = endV = null; Model.FrameObj.GetReleases(name, ref iRelease, ref jRelease, ref startV, ref endV); speckleStructFrame.end1Releases = RestraintToSpeckle(iRelease); speckleStructFrame.end2Releases = RestraintToSpeckle(jRelease); SpeckleModel.restraints.Add(speckleStructFrame.end1Releases); SpeckleModel.restraints.Add(speckleStructFrame.end2Releases); double localAxis = 0; bool advanced = false; Model.FrameObj.GetLocalAxes(name, ref localAxis, ref advanced); speckleStructFrame.orientationAngle = localAxis; string property, SAuto; property = SAuto = null; Model.FrameObj.GetSection(name, ref property, ref SAuto); speckleStructFrame.property = Property1DToSpeckle(property); double offSetEnd1 = 0; double offSetEnd2 = 0; double RZ = 0; bool autoOffSet = true; Model.FrameObj.GetEndLengthOffset(name, ref autoOffSet, ref offSetEnd1, ref offSetEnd2, ref RZ); //Offset needs to be oriented wrt to 1-axis Vector end1Offset = new Vector(0, 0, offSetEnd1, ModelUnits()); Vector end2Offset = new Vector(0, 0, offSetEnd2, ModelUnits()); speckleStructFrame.end1Offset = end1Offset; speckleStructFrame.end2Offset = end2Offset; string springLineName = null; Model.FrameObj.GetSpringAssignment(name, ref springLineName); if (springLineName != null) { speckleStructFrame.ETABSLinearSpring = LinearSpringToSpeckle(springLineName); } string pierAssignment = null; Model.FrameObj.GetPier(name, ref pierAssignment); if (pierAssignment != null) { speckleStructFrame.PierAssignment = pierAssignment; } string spandrelAssignment = null; Model.FrameObj.GetSpandrel(name, ref spandrelAssignment); if (spandrelAssignment != null) { speckleStructFrame.SpandrelAssignment = spandrelAssignment; } int designProcedure = 9; Model.FrameObj.GetDesignProcedure(name, ref designProcedure); if (designProcedure != 9) { switch (designProcedure) { case 0: speckleStructFrame.DesignProcedure = DesignProcedure.ProgramDetermined; break; case 1: speckleStructFrame.DesignProcedure = DesignProcedure.SteelFrameDesign; break; case 2: speckleStructFrame.DesignProcedure = DesignProcedure.ConcreteFrameDesign; break; case 3: speckleStructFrame.DesignProcedure = DesignProcedure.CompositeBeamDesign; break; case 4: speckleStructFrame.DesignProcedure = DesignProcedure.SteelJoistDesign; break; case 7: speckleStructFrame.DesignProcedure = DesignProcedure.NoDesign; break; case 13: speckleStructFrame.DesignProcedure = DesignProcedure.CompositeColumnDesign; break; } } double[] modifiers = new double[] { }; int s = Model.FrameObj.GetModifiers(name, ref modifiers); if (s == 0) { speckleStructFrame.Modifiers = modifiers; } var GUID = ""; Model.FrameObj.GetGUID(name, ref GUID); speckleStructFrame.applicationId = GUID; List <Base> elements = SpeckleModel.elements; List <string> application_Id = elements.Select(o => o.applicationId).ToList(); if (!application_Id.Contains(speckleStructFrame.applicationId)) { SpeckleModel.elements.Add(speckleStructFrame); } return(speckleStructFrame); }