public static bool AddFrameElement(HndzExtrudedElement element, HndzSectionTypeEnum type) { SAPFrameElement sapElement = new SAPFrameElement(); sapElement.ConvertFromHndzElement(element, type); return(SAP2000API.AddFrameElement(sapElement)); }
public void ConvertFromHndzElement(HndzExtrudedElement element, HndzSectionTypeEnum type) { switch (type) { case HndzSectionTypeEnum.HotRolledC: throw new NotImplementedException("HotRolled is not ready"); break; case HndzSectionTypeEnum.HotRolledI: throw new NotImplementedException("HotRolled is not ready"); break; case HndzSectionTypeEnum.BuiltUpI: HndzBeamStandardCase beam = null; HndzColumnStandardCase column = null; if (element is HndzBeamStandardCase) { beam = (HndzBeamStandardCase)element; Name = Label = beam.Name; SAPISection iSection = new SAPISection(); Section = iSection.ConvertFromHndzIProfile((HndzISectionProfile)beam.Profile, (HndzStructuralMaterial)beam.Material); Section = iSection; StartPoint.ConvertFromHndzNode(beam.ExtrusionLine.baseNode); EndPoint.ConvertFromHndzNode(beam.ExtrusionLine.EndNode); } else if (element is HndzColumnStandardCase) { column = (HndzColumnStandardCase)element; Name = Label = column.Name; SAPISection iSection = new SAPISection(); Section = iSection.ConvertFromHndzIProfile((HndzISectionProfile)column.Profile, (HndzStructuralMaterial)column.Material); Section = iSection; StartPoint.ConvertFromHndzNode(column.ExtrusionLine.baseNode); EndPoint.ConvertFromHndzNode(column.ExtrusionLine.EndNode); } break; case HndzSectionTypeEnum.TaperedI: HndzBeamStandardCase beamTapered = null; HndzBeamStandardCase columnTapered = null; if (element is HndzBeamStandardCase) { //beamTapered = (HndzBeamTapered)element; //Name = Label = beamTapered.Name; //SAPITaperedSection iSection = new SAPITaperedSection(); //iSection.ConvertFromHndzTaperedI(beamTapered.Profile, (HndzStructuralMaterial)beamTapered.Material); //Section = iSection; //StartPoint.ConvertFromHndzNode(beamTapered.ExtrusionLine.baseNode); //EndPoint.ConvertFromHndzNode(beamTapered.ExtrusionLine.EndNode); throw new NotImplementedException(); } else if (element is HndzBeamStandardCase) { columnTapered = (HndzBeamStandardCase)element; Name = Label = columnTapered.Name; if (columnTapered.Profile is HndzITaperedProfile) { HndzITaperedProfile columnTaperedProfile = columnTapered.Profile as HndzITaperedProfile; SAPITaperedSection iSection = new SAPITaperedSection(); iSection.ConvertFromHndzTaperedI(columnTaperedProfile, (HndzStructuralMaterial)columnTapered.Material); Section = iSection; StartPoint.ConvertFromHndzNode(columnTapered.ExtrusionLine.baseNode); EndPoint.ConvertFromHndzNode(columnTapered.ExtrusionLine.EndNode); } } break; default: break; } }
/// <summary> /// Send a list/array of elements with the same section types, /// if you are sending different types then you have to call this function more than one time /// </summary> /// <param name="elements">Elements to be drawn and defined in SAP2000 Model</param> /// <param name="type">The type of all these elements</param> /// <returns></returns> public static bool AddFrameElement(IEnumerable <HndzExtrudedElement> elements, HndzSectionTypeEnum type) { HndzExtrudedElement[] elementsArr = elements.ToArray(); SAPFrameElement[] sapElementsArr = new SAPFrameElement[elementsArr.Length]; for (int i = 0; i < elementsArr.Length; i++) { sapElementsArr[i].ConvertFromHndzElement(elementsArr[i], type); } return(SAP2000API.AddFrameElement(sapElementsArr)); }