diff --git a/AdSec/.NET/AdsToApi/AdsToApi.cs b/AdSec/.NET/AdsToApi/AdsToApi.cs index 379d2b0..4d0f44e 100644 --- a/AdSec/.NET/AdsToApi/AdsToApi.cs +++ b/AdSec/.NET/AdsToApi/AdsToApi.cs @@ -16,7 +16,8 @@ public static class AdsToApi public static void Main() { // Read the required .ads file as string - System.String path = "..\\..\\..\\..\\..\\..\\..\\DocumentationOnly\\.NET\\DotNetCodeSnippets\\api2section.ads"; + System.String path = + "..\\..\\..\\..\\..\\..\\..\\DocumentationOnly\\.NET\\DotNetCodeSnippets\\api2section.ads"; System.String json = System.IO.File.ReadAllText(path); // Use JsonParser's Deserialize method to convert from JSON to API objects @@ -26,14 +27,12 @@ public static void Main() System.Collections.Generic.IList api_sections = api.Sections; ISection section_one = api_sections[0]; - // Access and print warnings to check for warning messages while converting JSON to API + // Access and print warnings to check for warning messages while converting JSON to API System.Collections.Generic.IList api_warnings = api.Warnings; - for (int i = 0; i< api_warnings.Count; i++) + for (int i = 0; i < api_warnings.Count; i++) { Console.WriteLine(api_warnings[i].Description); } - } } } - diff --git a/AdSec/.NET/ApiToAds/ApiToAds.cs b/AdSec/.NET/ApiToAds/ApiToAds.cs index e31d583..a462435 100644 --- a/AdSec/.NET/ApiToAds/ApiToAds.cs +++ b/AdSec/.NET/ApiToAds/ApiToAds.cs @@ -8,7 +8,6 @@ using OasysUnits; using Oasys.AdSec.DesignCode; - namespace ApiToAds { /// @@ -21,28 +20,44 @@ public static class ApiToAds { public static void Main() { - // Create API section - IConcrete C30 = Concrete.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.PD6687.Edition_2010.C30_37; + // Create API section + IConcrete C30 = Concrete + .EN1992 + .Part1_1 + .Edition_2004 + .NationalAnnex + .GB + .PD6687 + .Edition_2010 + .C30_37; ICircleProfile circle_profile = ICircleProfile.Create(Length.FromMillimeters(1000)); ISection section = ISection.Create(circle_profile, C30); - // Use JsonConverter's SectionToJson method to obtain the JSON string - JsonConverter converter = new JsonConverter(EN1992.Part1_1.Edition_2004.NationalAnnex.GB.PD6687.Edition_2010); + // Use JsonConverter's SectionToJson method to obtain the JSON string + JsonConverter converter = new JsonConverter( + EN1992.Part1_1.Edition_2004.NationalAnnex.GB.PD6687.Edition_2010 + ); String json = converter.SectionToJson(section); - // Save this JSON string into .ads file + // Save this JSON string into .ads file System.IO.File.WriteAllText("adsec_section.ads", json); - // To save a section with loads (or deformation) - Oasys.AdSec.ILoad load_one = ILoad.Create(Force.FromKilonewtons(-10), Moment.Zero, Moment.Zero); - Oasys.AdSec.ILoad load_two = ILoad.Create(Force.FromKilonewtons(-15), Moment.Zero, Moment.Zero); + // To save a section with loads (or deformation) + Oasys.AdSec.ILoad load_one = ILoad.Create( + Force.FromKilonewtons(-10), + Moment.Zero, + Moment.Zero + ); + Oasys.AdSec.ILoad load_two = ILoad.Create( + Force.FromKilonewtons(-15), + Moment.Zero, + Moment.Zero + ); Oasys.Collections.IList load_list = Oasys.Collections.IList.Create(); load_list.Add(load_one); load_list.Add(load_two); String json_with_loads = converter.SectionToJson(section, load_list); System.IO.File.WriteAllText("adsec_section_with_loads.ads", json_with_loads); - } } } - diff --git a/AdSec/.NET/ApiVersion/ApiVersion.cs b/AdSec/.NET/ApiVersion/ApiVersion.cs index e789e6f..6c9a115 100644 --- a/AdSec/.NET/ApiVersion/ApiVersion.cs +++ b/AdSec/.NET/ApiVersion/ApiVersion.cs @@ -12,4 +12,4 @@ public static void Main() System.Console.WriteLine("The AdSec API version is " + IVersion.Api()); } } -} \ No newline at end of file +} diff --git a/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.cs b/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.cs index 0dc6248..bd54032 100644 --- a/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.cs +++ b/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.cs @@ -24,18 +24,45 @@ public static class ReinforcedConcreteAnalysis public static void Main() { // Create a rectangular section - var profile = IRectangleProfile.Create(Length.FromMillimeters(800), Length.FromMillimeters(400)); - IConcrete sectionMaterial = Concrete.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014.C40_50; + var profile = IRectangleProfile.Create( + Length.FromMillimeters(800), + Length.FromMillimeters(400) + ); + IConcrete sectionMaterial = Concrete + .EN1992 + .Part1_1 + .Edition_2004 + .NationalAnnex + .GB + .Edition_2014 + .C40_50; var section = ISection.Create(profile, sectionMaterial); // Set the cover section.Cover = ICover.Create(Length.FromMillimeters(40)); // Set some reinforcement - IReinforcement reinforcementMaterial = Reinforcement.Steel.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014.S500B; - IBarBundle bar20mm = IBarBundle.Create(reinforcementMaterial, Length.FromMillimeters(20)); - IBarBundle bar16mm = IBarBundle.Create(reinforcementMaterial, Length.FromMillimeters(16)); - IBarBundle bar12mm = IBarBundle.Create(reinforcementMaterial, Length.FromMillimeters(12)); + IReinforcement reinforcementMaterial = Reinforcement + .Steel + .EN1992 + .Part1_1 + .Edition_2004 + .NationalAnnex + .GB + .Edition_2014 + .S500B; + IBarBundle bar20mm = IBarBundle.Create( + reinforcementMaterial, + Length.FromMillimeters(20) + ); + IBarBundle bar16mm = IBarBundle.Create( + reinforcementMaterial, + Length.FromMillimeters(16) + ); + IBarBundle bar12mm = IBarBundle.Create( + reinforcementMaterial, + Length.FromMillimeters(12) + ); // Define top reinforcement ILayer topLayer = ILayerByBarCount.Create(4, bar16mm); @@ -76,7 +103,10 @@ public static void Main() IServiceabilityResult serviceabilityResult = solution.Serviceability.Check(load); // Display the crack width in mm - double crackWidth = Math.Round(serviceabilityResult.MaximumWidthCrack.Width.Millimeters, 2); + double crackWidth = Math.Round( + serviceabilityResult.MaximumWidthCrack.Width.Millimeters, + 2 + ); Console.WriteLine($"The maximum crack width is: {crackWidth}mm"); } } diff --git a/AdSec/.NET/SampleProgram/SampleProgram.cs b/AdSec/.NET/SampleProgram/SampleProgram.cs index 96bb6d3..47bba29 100644 --- a/AdSec/.NET/SampleProgram/SampleProgram.cs +++ b/AdSec/.NET/SampleProgram/SampleProgram.cs @@ -28,16 +28,35 @@ private static void Main() { // Create a circular section var profile = ICircleProfile.Create(Length.FromMillimeters(500)); - IConcrete sectionMaterial = Concrete.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014.C40_50; + IConcrete sectionMaterial = Concrete + .EN1992 + .Part1_1 + .Edition_2004 + .NationalAnnex + .GB + .Edition_2014 + .C40_50; var section = ISection.Create(profile, sectionMaterial); - IReinforcement reinforcementMaterial = Reinforcement.Steel.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014.S500B; - ILayer layer = ILayerByBarCount.Create(4, IBarBundle.Create(reinforcementMaterial, Length.FromMillimeters(32))); + IReinforcement reinforcementMaterial = Reinforcement + .Steel + .EN1992 + .Part1_1 + .Edition_2004 + .NationalAnnex + .GB + .Edition_2014 + .S500B; + ILayer layer = ILayerByBarCount.Create( + 4, + IBarBundle.Create(reinforcementMaterial, Length.FromMillimeters(32)) + ); // Set some reinforcement IGroup group = ILineGroup.Create( IPoint.Create(Length.Zero, Length.Zero), IPoint.Create(Length.FromMillimeters(150), Length.FromMillimeters(150)), - layer); + layer + ); section.ReinforcementGroups.Add(group); diff --git a/AdSec/.NET/SampleProgramTestsUsingMocking/ApiMock.cs b/AdSec/.NET/SampleProgramTestsUsingMocking/ApiMock.cs index 5dfd295..7606357 100644 --- a/AdSec/.NET/SampleProgramTestsUsingMocking/ApiMock.cs +++ b/AdSec/.NET/SampleProgramTestsUsingMocking/ApiMock.cs @@ -18,7 +18,8 @@ public void MockSample() // GIVEN a serviceability result Length length = Length.FromMillimeters(0.5); Mock mockCrack = new Mock(); - Mock mockServiceabilityResult = new Mock(); + Mock mockServiceabilityResult = + new Mock(); mockServiceabilityResult.Setup(_ => _.MaximumWidthCrack).Returns(mockCrack.Object); mockCrack.Setup(_ => _.Width).Returns(length); @@ -30,4 +31,4 @@ public void MockSample() Assert.Equal(someExpectedValue, crackWidth); } } -} \ No newline at end of file +} diff --git a/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.cs b/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.cs index b0f6dbf..5c15020 100644 --- a/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.cs +++ b/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.cs @@ -24,21 +24,27 @@ public void IsCrackWidthSatisfactory_True_ForSmallCrack() Length length = Length.FromMillimeters(1); Mock crackMock = new Mock(); Mock loadMock = new Mock(); - Mock serviceabilityResultMock = new Mock(); + Mock serviceabilityResultMock = + new Mock(); Mock serviceability = new Mock(); Mock solutionMock = new Mock(); serviceabilityResultMock.SetupGet(_ => _.MaximumWidthCrack).Returns(crackMock.Object); serviceabilityResultMock.SetupGet(_ => _.MaximumWidthCrack.Width).Returns(length); - serviceability.Setup(_ => _.Check(loadMock.Object)).Returns(serviceabilityResultMock.Object); + serviceability + .Setup(_ => _.Check(loadMock.Object)) + .Returns(serviceabilityResultMock.Object); solutionMock.SetupGet(_ => _.Serviceability).Returns(serviceability.Object); // WHEN we check that the crack width is within our expectations - bool actualResult = SampleProgram.SampleProgram.IsCrackWidthSatisfactory(solutionMock.Object, loadMock.Object); + bool actualResult = SampleProgram.SampleProgram.IsCrackWidthSatisfactory( + solutionMock.Object, + loadMock.Object + ); // THEN IsCrackWidthSatisfactory() uses the mock objects bool expectedResult = true; Assert.Equal(expectedResult, actualResult); } } -} \ No newline at end of file +} diff --git a/AdSec/.NET/SaveSectionImage/SaveSectionImage.cs b/AdSec/.NET/SaveSectionImage/SaveSectionImage.cs index 536eb65..4142da8 100644 --- a/AdSec/.NET/SaveSectionImage/SaveSectionImage.cs +++ b/AdSec/.NET/SaveSectionImage/SaveSectionImage.cs @@ -15,7 +15,7 @@ namespace SaveSectionImage /// /// This example shows how to save the XML to a file to create an SVG file. /// It also shows how you can use a third party library to convert the SVG into a PNG file. - /// + /// /// You might like to run the 'ApiVersion' example first, just to check /// that the API is installed correctly. /// @@ -23,50 +23,74 @@ public static class SaveSectionImage { static void Main() { - // We're going to create a rectangular section with a sub-component. + // We're going to create a rectangular section with a sub-component. // Create the rectangular section - IProfile profile = IRectangleProfile.Create(Length.FromMillimeters(500), Length.FromMillimeters(300)); + IProfile profile = IRectangleProfile.Create( + Length.FromMillimeters(500), + Length.FromMillimeters(300) + ); IConcrete sectionMaterial = Concrete.IS456.Edition_2000.M30; ISection section = ISection.Create(profile, sectionMaterial); // Set the cover section.Cover = ICover.Create(Length.FromMillimeters(30)); - // Assign reinforcements to the main section + // Assign reinforcements to the main section IReinforcement reinforcementMaterial = Reinforcement.Steel.IS456.Edition_2000.S415; - IBarBundle bar16mm = IBarBundle.Create(reinforcementMaterial, Length.FromMillimeters(16)); - ILayer layerWithPitch125mm = ILayerByBarPitch.Create(bar16mm, Length.FromMillimeters(125)); + IBarBundle bar16mm = IBarBundle.Create( + reinforcementMaterial, + Length.FromMillimeters(16) + ); + ILayer layerWithPitch125mm = ILayerByBarPitch.Create( + bar16mm, + Length.FromMillimeters(125) + ); IPerimeterGroup mainSectionReinforcement = IPerimeterGroup.Create(); mainSectionReinforcement.Layers.Add(layerWithPitch125mm); - IBarBundle link10mm = IBarBundle.Create(reinforcementMaterial, Length.FromMillimeters(10)); + IBarBundle link10mm = IBarBundle.Create( + reinforcementMaterial, + Length.FromMillimeters(10) + ); ILinkGroup mainSectionLink = ILinkGroup.Create(link10mm); section.ReinforcementGroups.Add(mainSectionReinforcement); section.ReinforcementGroups.Add(mainSectionLink); // Create another rectangular section which we'll use as a sub-component. - IProfile subcomponentProfile = IRectangleProfile.Create(Length.FromMillimeters(250), Length.FromMillimeters(700)); + IProfile subcomponentProfile = IRectangleProfile.Create( + Length.FromMillimeters(250), + Length.FromMillimeters(700) + ); ISection subcomponentSection = ISection.Create(subcomponentProfile, sectionMaterial); subcomponentSection.Cover = ICover.Create(Length.FromMillimeters(30)); - // Assign reinforcements to the sub-component section - ILayer layerWithPitch120mm = ILayerByBarPitch.Create(bar16mm, Length.FromMillimeters(120)); + // Assign reinforcements to the sub-component section + ILayer layerWithPitch120mm = ILayerByBarPitch.Create( + bar16mm, + Length.FromMillimeters(120) + ); IPerimeterGroup subcomponentReinforcement = IPerimeterGroup.Create(); subcomponentReinforcement.Layers.Add(layerWithPitch120mm); ILinkGroup subcomponentLink = ILinkGroup.Create(link10mm); subcomponentSection.ReinforcementGroups.Add(subcomponentReinforcement); subcomponentSection.ReinforcementGroups.Add(subcomponentLink); - // Add this sub-component section to the main section - IPoint subcomponentOffset = IPoint.Create(Length.FromMillimeters(-200), Length.FromMillimeters(125)); - ISubComponent subcomponent = ISubComponent.Create(subcomponentSection, subcomponentOffset); + // Add this sub-component section to the main section + IPoint subcomponentOffset = IPoint.Create( + Length.FromMillimeters(-200), + Length.FromMillimeters(125) + ); + ISubComponent subcomponent = ISubComponent.Create( + subcomponentSection, + subcomponentOffset + ); section.SubComponents.Add(subcomponent); - // Flatten the section + // Flatten the section IAdSec adsecApp = IAdSec.Create(IS456.Edition_2000); ISection flattenedSection = adsecApp.Flatten(section); - // Get SVG XML body as a string + // Get SVG XML body as a string string svgStr = new SectionImageBuilder(flattenedSection).Svg(); // This string can be written into SVG format file diff --git a/GSA/.NET API/GsaConsoleApplication/GsaConsoleApplication/ModelExporter.cs b/GSA/.NET API/GsaConsoleApplication/GsaConsoleApplication/ModelExporter.cs index c7b5030..e98893d 100644 --- a/GSA/.NET API/GsaConsoleApplication/GsaConsoleApplication/ModelExporter.cs +++ b/GSA/.NET API/GsaConsoleApplication/GsaConsoleApplication/ModelExporter.cs @@ -12,15 +12,24 @@ internal static void Export(Model model, string outputDirectory) // We can use the default data exporter to export all fields in simple data types DefaultDataExporter.Export(model.Nodes(), Path.Combine(outputDirectory, "Nodes.csv")); - DefaultDataExporter.Export(model.Elements(), Path.Combine(outputDirectory, "Elements.csv")); - DefaultDataExporter.Export(model.Members(), Path.Combine(outputDirectory, "Members.csv")); + DefaultDataExporter.Export( + model.Elements(), + Path.Combine(outputDirectory, "Elements.csv") + ); + DefaultDataExporter.Export( + model.Members(), + Path.Combine(outputDirectory, "Members.csv") + ); // Analyse Task 1 in advance of exporting some results model.Analyse(1); // we can create a custom exporter for more complex data, or to customise the fields // here we export the force at both ends of each beam using our Element1DResultExporter - BeamScheduleExporter.Export(model.Results(), Path.Combine(outputDirectory, "BeamSchedule.csv")); + BeamScheduleExporter.Export( + model.Results(), + Path.Combine(outputDirectory, "BeamSchedule.csv") + ); } } } diff --git a/GSA/.NET API/GsaConsoleApplication/GsaConsoleApplication/Program.cs b/GSA/.NET API/GsaConsoleApplication/GsaConsoleApplication/Program.cs index 5d7e7ae..bfab47d 100644 --- a/GSA/.NET API/GsaConsoleApplication/GsaConsoleApplication/Program.cs +++ b/GSA/.NET API/GsaConsoleApplication/GsaConsoleApplication/Program.cs @@ -9,10 +9,12 @@ public static void Main(string[] args) { // this is the entry point for the application // parse the command line options and call the relevant export function(s) - Parser.Default.ParseArguments(args).WithParsed(options => - { - ModelExporter.Export(new Model(options.InputFile), options.OutputDirectory); - }); + Parser.Default + .ParseArguments(args) + .WithParsed(options => + { + ModelExporter.Export(new Model(options.InputFile), options.OutputDirectory); + }); } } } diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof/Program.cs b/GSA/COM API/.NET/demo_sinosoidal_roof/Program.cs index 40fe19a..394e77e 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof/Program.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof/Program.cs @@ -18,14 +18,14 @@ static void Main(string[] args) double pi_by_32 = Math.PI / 32; double scale = 5; double tol = 0.01; - + double[] offset1 = { 0, 0, 0 }; double[] offset2 = { 0, 0, 0 }; int n1_previous = 0; int n2_previous = 0; string strEnt = "EL"; - string filePath = Utils.DownloadExampleFile("Env.gwb","sinosoidal_roof.gwb"); + string filePath = Utils.DownloadExampleFile("Env.gwb", "sinosoidal_roof.gwb"); string SavefilePath = @"C:\temp\updated_sinosoidal_roof.gwb"; GsaComUtil m_gsaObj = new GsaComUtil(); @@ -51,39 +51,76 @@ static void Main(string[] args) _topo.Add(n1); _topo.Add(n2); - List _Release = new List(); List _Offset = new List(); _Offset.Add(offset1); _Offset.Add(offset1); - m_gsaObj.SetElem1d(elem, "", 1, "", _topo, 0, 0, _Release, _Offset, GsaComUtil.ElemType.EL_BAR); + m_gsaObj.SetElem1d( + elem, + "", + 1, + "", + _topo, + 0, + 0, + _Release, + _Offset, + GsaComUtil.ElemType.EL_BAR + ); elem = m_gsaObj.HighestEnt(ref strEnt) + 1; if ((n1_previous != 0)) { - _topo = new List();_topo.Add(n1);_topo.Add(n1_previous); - - m_gsaObj.SetElem1d(elem, "", 1, "", _topo, 0, 0, _Release, _Offset, GsaComUtil.ElemType.EL_BAR); + _topo = new List(); + _topo.Add(n1); + _topo.Add(n1_previous); + + m_gsaObj.SetElem1d( + elem, + "", + 1, + "", + _topo, + 0, + 0, + _Release, + _Offset, + GsaComUtil.ElemType.EL_BAR + ); } elem = m_gsaObj.HighestEnt(ref strEnt) + 1; if ((n2_previous != 0)) { - _topo = new List(); _topo.Add(n2); _topo.Add(n2_previous); - m_gsaObj.SetElem1d(elem, "", 1, "", _topo, 0, 0, _Release, _Offset, GsaComUtil.ElemType.EL_BAR); + _topo = new List(); + _topo.Add(n2); + _topo.Add(n2_previous); + m_gsaObj.SetElem1d( + elem, + "", + 1, + "", + _topo, + 0, + 0, + _Release, + _Offset, + GsaComUtil.ElemType.EL_BAR + ); } n1_previous = n1; n2_previous = n2; - } #endregion Node & Element operatopn(Old method) #region Node & Element operatopn(New method) - strEnt = "NODE"; int nodeHigh = m_gsaObj.HighestEnt(ref strEnt); - strEnt = "EL"; int elemHigh = m_gsaObj.HighestEnt(ref strEnt); + strEnt = "NODE"; + int nodeHigh = m_gsaObj.HighestEnt(ref strEnt); + strEnt = "EL"; + int elemHigh = m_gsaObj.HighestEnt(ref strEnt); List lstElem = new List(); List lstNode = new List(); double[] Stiff = { 0, 0, 0, 0, 0, 0 }; @@ -91,7 +128,6 @@ static void Main(string[] args) for (int i = 51; i <= 100; i++) { - double x = pi_by_32 * i * scale; double z = Math.Sin(x) * scale / 4; double y = 0; @@ -104,7 +140,6 @@ static void Main(string[] args) gNode0.Restraint = restraint; gNode0.Ref = ++nodeHigh; lstNode.Add(gNode0); - //end node y += 10; @@ -115,10 +150,8 @@ static void Main(string[] args) gNode1.Restraint = restraint; gNode1.Ref = ++nodeHigh; lstNode.Add(gNode1); - - - int[] iTop ={gNode0.Ref, gNode1.Ref}; + int[] iTop = { gNode0.Ref, gNode1.Ref }; GsaElement gElem = new GsaElement(); gElem.eType = (int)ElementType.BAR; gElem.Ref = ++elemHigh; @@ -160,16 +193,16 @@ static void Main(string[] args) #region Node Manipulation - + int[] nodeRefs = null; GsaNode[] nodes = null; GsaEntity Ent = GsaEntity.NODE; - short s = m_gsaObj.GsaObj().EntitiesInList("all", ref Ent, out nodeRefs); + short s = m_gsaObj.GsaObj().EntitiesInList("all", ref Ent, out nodeRefs); Debug.Assert(s.Equals(0) && (nodeRefs != null)); - s = m_gsaObj.GsaObj().Nodes(nodeRefs, out nodes); + s = m_gsaObj.GsaObj().Nodes(nodeRefs, out nodes); for (Int32 i = 0; i <= nodes.GetUpperBound(0); i++) { @@ -178,8 +211,8 @@ static void Main(string[] args) node.Coor.SetValue(-z, 2); nodes.SetValue(node, i); } - s = m_gsaObj.GsaObj().SetNodes(nodes, true); - m_gsaObj.GsaObj().SaveAs(SavefilePath); + s = m_gsaObj.GsaObj().SetNodes(nodes, true); + m_gsaObj.GsaObj().SaveAs(SavefilePath); #endregion Node Manipulation @@ -189,24 +222,24 @@ static void Main(string[] args) cNewSec.SectDesc = "STD R 500 500"; cNewSec.Name = "New Rectangular Section"; cNewSec.Material = -1; - int iNewSec = Convert.ToInt32( m_gsaObj.GsaObj().GwaCommand("HIGHEST,PROP_SEC")); + int iNewSec = Convert.ToInt32(m_gsaObj.GsaObj().GwaCommand("HIGHEST,PROP_SEC")); cNewSec.Ref = iNewSec + 1; GsaSection[] cArrNewSec = { cNewSec }; - s = m_gsaObj.GsaObj().SetSections(cArrNewSec, true); + s = m_gsaObj.GsaObj().SetSections(cArrNewSec, true); Debug.Assert(s.Equals(0)); - m_gsaObj.GsaObj().SaveAs(SavefilePath); + m_gsaObj.GsaObj().SaveAs(SavefilePath); #endregion Adding new section #region Element Manipulation - s = m_gsaObj.GsaObj().Delete("RESULTS"); + s = m_gsaObj.GsaObj().Delete("RESULTS"); int[] ElemRefs = null; GsaElement[] elements = null; Ent = GsaEntity.ELEMENT; - s = m_gsaObj.GsaObj().EntitiesInList("all", ref Ent, out ElemRefs); + s = m_gsaObj.GsaObj().EntitiesInList("all", ref Ent, out ElemRefs); Debug.Assert(s.Equals(0) && (ElemRefs != null)); - s = m_gsaObj.GsaObj().Elements(ElemRefs, out elements); + s = m_gsaObj.GsaObj().Elements(ElemRefs, out elements); for (int i = 0; i <= elements.GetUpperBound(0); i++) { GsaElement elem = (GsaElement)elements.GetValue(i); @@ -214,7 +247,7 @@ static void Main(string[] args) elem.eType = (int)ElementType.BAR; elements.SetValue(elem, i); } - s = m_gsaObj.GsaObj().SetElements(elements, true); + s = m_gsaObj.GsaObj().SetElements(elements, true); #endregion Node Manipulation @@ -222,6 +255,5 @@ static void Main(string[] args) m_gsaObj.GsaSaveFile(SavefilePath); m_gsaObj.GsaCloseFile(); } - } } diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof/Properties/AssemblyInfo.cs b/GSA/COM API/.NET/demo_sinosoidal_roof/Properties/AssemblyInfo.cs index 733e761..bad2447 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof/Properties/AssemblyInfo.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("demo_sinosoidal_roof")] @@ -14,8 +14,8 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.cs b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.cs index 547d397..a2d7805 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.cs @@ -19,14 +19,13 @@ public partial class Form1 : Form private int iResPos = 2; private List EleArrayList = new List(); DataTable table = new DataTable(); - - + public Form1() { InitializeComponent(); table.Columns.Add("Element", typeof(string)); table.Columns.Add("Position", typeof(string)); - table.Columns.Add("FX(kN)", typeof(string )); + table.Columns.Add("FX(kN)", typeof(string)); table.Columns.Add("FY(kN)", typeof(string)); table.Columns.Add("FZ(kN)", typeof(string)); table.Columns.Add("FRC(kN)", typeof(string)); @@ -40,21 +39,23 @@ private void btnResult_Click(object sender, EventArgs e) { GetResult(); } + enum Flag - { - LCL_2D_BOTTOM = 0x00000001, // output 2D stresses at bottom layer - LCL_2D_MIDDLE = 0x00000002, // output 2D stresses at middle layer - LCL_2D_TOP = 0x00000004, // output 2D stresses at top layer - LCL_2D_BENDING = 0x00000008, // output 2D stresses at bending layer - LCL_2D_AVGE = 0x00000010, // average 2D element stresses at nodes - LCL_1D_AUTO_PTS = 0x00000020, // calculate 1D results at interesting points - LCL_INFINITY = 0x00000040, // report infinity and NaN as that, else as 0 - LCL_1D_WALL_RES_SECONDARY = 0x00000080, // output secondary stick of wall element 1D results - }; + { + LCL_2D_BOTTOM = 0x00000001, // output 2D stresses at bottom layer + LCL_2D_MIDDLE = 0x00000002, // output 2D stresses at middle layer + LCL_2D_TOP = 0x00000004, // output 2D stresses at top layer + LCL_2D_BENDING = 0x00000008, // output 2D stresses at bending layer + LCL_2D_AVGE = 0x00000010, // average 2D element stresses at nodes + LCL_1D_AUTO_PTS = 0x00000020, // calculate 1D results at interesting points + LCL_INFINITY = 0x00000040, // report infinity and NaN as that, else as 0 + LCL_1D_WALL_RES_SECONDARY = 0x00000080, // output secondary stick of wall element 1D results + }; + public void GetResult() { string filePath = txtFilePath.Text.ToString(); - int nComponent =0; + int nComponent = 0; int Highest = 0; m_gsaObj = new GsaComUtil(); m_gsaObj.GsaOpenFile(ref filePath); @@ -80,14 +81,27 @@ public void GetResult() } } Flag eOutFlag = (chkInter.Checked) ? Flag.LCL_1D_AUTO_PTS : 0; - int iStat = m_gsaObj.GsaObj().Output_Init_Arr((int)eOutFlag, "default", strLoadcase, ResHeader.REF_DISP_EL1D, iResPos); + int iStat = m_gsaObj + .GsaObj() + .Output_Init_Arr( + (int)eOutFlag, + "default", + strLoadcase, + ResHeader.REF_DISP_EL1D, + iResPos + ); if (iStat == 0) { foreach (int element_id in exist_element) { GsaResults[] gsResult = null; { - if (m_gsaObj.GsaObj().Output_Extract_Arr(element_id, out gsResult, out nComponent) == 0) + if ( + m_gsaObj + .GsaObj() + .Output_Extract_Arr(element_id, out gsResult, out nComponent) + == 0 + ) { for (int j = 0; j < gsResult.Count(); j++) { @@ -125,8 +139,6 @@ private void txtLoadCase_TextChanged(object sender, EventArgs e) { strLoadcase = ""; } - - } private void txtElementNumber_TextChanged(object sender, EventArgs e) @@ -150,7 +162,6 @@ private void txtElementNumber_TextChanged(object sender, EventArgs e) strElemenNo = ""; } } - } } @@ -178,7 +189,6 @@ private void btnBrowse_Click(object sender, EventArgs e) string file = flgOpen.FileName; txtFilePath.Text = file; } - } } } diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/AssemblyInfo.cs b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/AssemblyInfo.cs index ae20449..1817f80 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/AssemblyInfo.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("demo_sinosoidal_roof_Forces")] @@ -14,8 +14,8 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,11 +25,11 @@ // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")]