public static SAPITaperedSection GetITaperedSection(SAPITaperedSection section) { int NumberItems = 0; string[] StartSec = new string[1]; string[] EndSec = new string[1]; double[] MyLength = new double[1]; int[] MyType = new int[1]; int[] EI33 = new int[1]; int[] EI22 = new int[1]; int Color = 0; string Notes = string.Empty; string GUID = string.Empty; int flag = mySapModel.PropFrame.GetNonPrismatic(section.Name, ref NumberItems, ref StartSec, ref EndSec, ref MyLength, ref MyType, ref EI33, ref EI22, ref Color, ref Notes, ref GUID); if (flag != 0) { return(null); } else { //Updating the section with the new sections section.StartSection = GetISection(section.StartSection); section.EndSection = GetISection(section.EndSection); section.Length = MyLength[0]; section.LengthType = (LengthTypeEnum)MyType[0]; section.IsDefinedInSAP = true; } return(section); }
/// <summary> /// This function assumes that an IBuiltUpSection consists of a start and end section, further development to send an array of sections is recommended /// </summary> /// <param name="IBuiltUpSection"></param> /// <returns></returns> public static bool SetITaperedSection(SAPITaperedSection IBuiltUpSection) { string[] startSections = { IBuiltUpSection.StartSection.Name }; string[] endSections = { IBuiltUpSection.EndSection.Name }; double[] lengths = { IBuiltUpSection.Length }; int[] types = { (int)IBuiltUpSection.LengthType }; int[] EI33 = { 3 }; //Cubic change in inertia @ axis 3 -3 int[] EI22 = { 1 }; //Linear change in inertia @ axis 2-2 if (IBuiltUpSection.StartSection.IsDefinedInSAP == false) { SetISection(IBuiltUpSection.StartSection); } if (IBuiltUpSection.EndSection.IsDefinedInSAP == false) { SetISection(IBuiltUpSection.EndSection); } int flag = mySapModel.PropFrame.SetNonPrismatic(IBuiltUpSection.Name, 1, ref startSections, ref endSections, ref lengths, ref types, ref EI33, ref EI22); if (flag != 0) { IBuiltUpSection.IsDefinedInSAP = false; return(false); } IBuiltUpSection.IsDefinedInSAP = true; return(true); }
public static bool DeleteTaperedSection(SAPITaperedSection sec) { int flag = mySapModel.PropFrame.Delete(sec.Name); if (flag != 0) { return(false); } else { sec.IsDefinedInSAP = false; DeleteSection(sec.StartSection); DeleteSection(sec.EndSection); return(true); } }
public static SAPSection GetSection(SAPSection section) { if (section is SAPISection) { SAPISection temp = (SAPISection)section; temp = GetISection(temp); section = temp; } else if (section is SAPITaperedSection) { SAPITaperedSection temp = (SAPITaperedSection)section; temp = GetITaperedSection(temp); section = temp; } //TODO else if another section .. etc return(section); }
public void ConvertToHndzElement(HndzStructuralElement hndzElement) { SAPITaperedSection sapSec = (SAPITaperedSection)Section; //HndzStructuralElement hndzElement; SectionI startSec = new SectionI(sapSec.StartSection.Name, sapSec.StartSection.Height * 1000, sapSec.StartSection.BotFlangeWidth * 1000, sapSec.StartSection.BotFlangeThickness * 1000, sapSec.StartSection.WebThickness * 1000); SectionI endSec = new SectionI(sapSec.EndSection.Name, sapSec.EndSection.Height * 1000, sapSec.EndSection.BotFlangeWidth * 1000, sapSec.EndSection.BotFlangeThickness * 1000, sapSec.EndSection.WebThickness * 1000); if (hndzElement.Profile is HndzITaperedProfile) { HndzITaperedProfile profile = hndzElement.Profile as HndzITaperedProfile; hndzElement.Name = Name; hndzElement.Profile.Name = Name; profile.StartProfile.I_Section = startSec; profile.StartProfile.Name = sapSec.StartSection.Name; profile.EndProfile.I_Section = endSec; profile.EndProfile.Name = sapSec.EndSection.Name; } hndzElement.AnalysisResults = new HndzAnalysisResults[AnalysisResults.NumberResults]; hndzElement.AnalysisResultsEnvelope = new HndzAnalysisResults[AnalysisResultsEnvelope.NumberResults]; for (int i = 0; i < AnalysisResults.NumberResults; i++) { hndzElement.AnalysisResults[i] = new HndzAnalysisResults(AnalysisResults.Station[i], AnalysisResults.LoadCase[i], AnalysisResults.Axial[i], AnalysisResults.Shear2[i], AnalysisResults.Shear3[i], AnalysisResults.TortionalMoment[i] , AnalysisResults.Moment2[i], AnalysisResults.Moment3[i]); } for (int i = 0; i < AnalysisResultsEnvelope.NumberResults; i++) { hndzElement.AnalysisResultsEnvelope[i] = new HndzAnalysisResults(AnalysisResultsEnvelope.Station[i], AnalysisResultsEnvelope.LoadCase[i], AnalysisResultsEnvelope.Axial[i], AnalysisResultsEnvelope.Shear2[i], AnalysisResultsEnvelope.Shear3[i], AnalysisResultsEnvelope.TortionalMoment[i] , AnalysisResultsEnvelope.Moment2[i], AnalysisResultsEnvelope.Moment3[i]); } hndzElement.IsDesignPassed = IsDesignPassed; //TODO: Section and material //return hndzElement; }
private static SAPSection GetSectionByElement(string elementName) { //TODO : THIS FUNCTION IS TERRIBLE, REWRITE IT AGIAN SAPSection section = null; int flag; string propName = string.Empty; string SAlist = string.Empty; flag = mySapModel.FrameObj.GetSection(elementName, ref propName, ref SAlist); if (flag != 0) { return(null); } else { //Try to get this section as if it was a tapered section SAPITaperedSection tSec = new SAPITaperedSection(); tSec.Name = propName; tSec = GetITaperedSection(tSec); section = tSec; if (tSec == null) { //It's not tapered then it's I built up section SAPISection sec = new SAPISection(); sec.Name = propName; sec = GetISection(sec); section = sec; } if (section == null) { section = new SAPITaperedSection(); section.Name = propName; section.IsDefinedInSAP = true; } } return(section); }
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; } }