diff --git a/.clang-format b/.clang-format index 3be4f13..f15fc46 100644 --- a/.clang-format +++ b/.clang-format @@ -1,90 +1,90 @@ -# This file defines the Oasys formatting style -# The configuration options can be found at: -# https://clang.llvm.org/docs/ClangFormatStyleOptions.html - -# We use Google style as a basis and modify where needed -BasedOnStyle: Google - -# We group and sort includes based on the Google style... -IncludeCategories: - # We currently need precompiled headers to come before other headers. - # This is because some headers are not properly self-contained and rely - # on the things included/defined in the precompiled header. - # TODO: GSA-6242 - make headers self-contained and remove this include category - - Regex: 'stdafx.h' - Priority: -1 - - Regex: 'pch.h' - Priority: -1 - - # C system headers (more precisely: headers in angle brackets with the .h extension), e.g., , . - - Regex: '^<[^/]*\.h>' - Priority: 2 - - # C++ standard library headers (without file extension), e.g., , . - - Regex: '^<[a-z_]*>' - Priority: 3 - - # Other libraries' .h files. - - Regex: '^<.*' - Priority: 4 - - # Your project's .h files. - - Regex: '.*' - Priority: 5 - -# We enforce Windows line endings throughout as historically we've had a mix across files -UseCRLF: true -DeriveLineEnding: false - -# We use tabs instead of spaces for indentation to minimise change to -# existing code and to allow IDE display flexibility. -IndentWidth: 4 - -## We maintain access modifier offset as half a full indentation -AccessModifierOffset: -2 - -# We allow an increased colunm limit as we have 4-character indentation -ColumnLimit: 110 - -# We use braces on a new line as it better suits our existing code -BreakBeforeBraces: Allman - -# We prefer statements to be on a new line so we can easily add break points -AllowShortFunctionsOnASingleLine: Empty -AllowShortLambdasOnASingleLine: Empty -AllowShortIfStatementsOnASingleLine: Never -AllowShortLoopsOnASingleLine: false - -# We always use consistent pointer alignment -DerivePointerAlignment: false - -# We always use consistent qualifier alignment -QualifierAlignment: Left - -# We put requires clauses on their own line, indented for readability purposes -# (not set by Google config as it predates the feature) -RequiresClausePosition: OwnLine -IndentRequiresClause: true - -# We do not want to 'reflow comments' - it tends to make a mess of it -# (especially for commentator documentation, ASCII art, table layouts etc) -ReflowComments: false - -# We separate definition blocks to avoid stylistic changes -# coming in amongst other changes in PRs -SeparateDefinitionBlocks: Always - -# We include a new line at the end of files for consistency -# and to remove GitHub warning markers -InsertNewlineAtEOF: true - -# We always use braces after control statements to avoid -# accidental scope errors and to maintain code consistency -InsertBraces: true - -# We remove superfluous semicolons because less code is better -RemoveSemicolon: true - -# All our C++ code is compiled with C++20, so we can make -# this assumption here to get more appropriate formatting -Standard: c++20 +# This file defines the Oasys formatting style +# The configuration options can be found at: +# https://clang.llvm.org/docs/ClangFormatStyleOptions.html + +# We use Google style as a basis and modify where needed +BasedOnStyle: Google + +# We group and sort includes based on the Google style... +IncludeCategories: + # We currently need precompiled headers to come before other headers. + # This is because some headers are not properly self-contained and rely + # on the things included/defined in the precompiled header. + # TODO: GSA-6242 - make headers self-contained and remove this include category + - Regex: 'stdafx.h' + Priority: -1 + - Regex: 'pch.h' + Priority: -1 + + # C system headers (more precisely: headers in angle brackets with the .h extension), e.g., , . + - Regex: '^<[^/]*\.h>' + Priority: 2 + + # C++ standard library headers (without file extension), e.g., , . + - Regex: '^<[a-z_]*>' + Priority: 3 + + # Other libraries' .h files. + - Regex: '^<.*' + Priority: 4 + + # Your project's .h files. + - Regex: '.*' + Priority: 5 + +# We enforce Windows line endings throughout as historically we've had a mix across files +UseCRLF: true +DeriveLineEnding: false + +# We use tabs instead of spaces for indentation to minimise change to +# existing code and to allow IDE display flexibility. +IndentWidth: 4 + +## We maintain access modifier offset as half a full indentation +AccessModifierOffset: -2 + +# We allow an increased colunm limit as we have 4-character indentation +ColumnLimit: 110 + +# We use braces on a new line as it better suits our existing code +BreakBeforeBraces: Allman + +# We prefer statements to be on a new line so we can easily add break points +AllowShortFunctionsOnASingleLine: Empty +AllowShortLambdasOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false + +# We always use consistent pointer alignment +DerivePointerAlignment: false + +# We always use consistent qualifier alignment +QualifierAlignment: Left + +# We put requires clauses on their own line, indented for readability purposes +# (not set by Google config as it predates the feature) +RequiresClausePosition: OwnLine +IndentRequiresClause: true + +# We do not want to 'reflow comments' - it tends to make a mess of it +# (especially for commentator documentation, ASCII art, table layouts etc) +ReflowComments: false + +# We separate definition blocks to avoid stylistic changes +# coming in amongst other changes in PRs +SeparateDefinitionBlocks: Always + +# We include a new line at the end of files for consistency +# and to remove GitHub warning markers +InsertNewlineAtEOF: true + +# We always use braces after control statements to avoid +# accidental scope errors and to maintain code consistency +InsertBraces: true + +# We remove superfluous semicolons because less code is better +RemoveSemicolon: true + +# All our C++ code is compiled with C++20, so we can make +# this assumption here to get more appropriate formatting +Standard: c++20 diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 536b138..614f241 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -1,12 +1,12 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "CSharpier": { - "version": "0.22.1", - "commands": [ - "dotnet-csharpier" - ] - } - } -} +{ + "version": 1, + "isRoot": true, + "tools": { + "CSharpier": { + "version": "0.22.1", + "commands": [ + "dotnet-csharpier" + ] + } + } +} diff --git a/AdSec/.NET/AdsToApi/AdsToApi.cs b/AdSec/.NET/AdsToApi/AdsToApi.cs index 4d0f44e..3d7a993 100644 --- a/AdSec/.NET/AdsToApi/AdsToApi.cs +++ b/AdSec/.NET/AdsToApi/AdsToApi.cs @@ -1,38 +1,38 @@ -using System; -using Oasys.AdSec; -using Oasys.AdSec.IO.Serialization; -using Oasys.Collections; - -namespace AdsToApi -{ - /// - /// This example shows how to convert an .ads file into API objects. - /// - /// You might like to run the 'ApiVersion' example first, just to check - /// that the API is installed correctly. - /// - 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 json = System.IO.File.ReadAllText(path); - - // Use JsonParser's Deserialize method to convert from JSON to API objects - ParsedResult api = JsonParser.Deserialize(json); - - // Access the ISection - 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 - System.Collections.Generic.IList api_warnings = api.Warnings; - for (int i = 0; i < api_warnings.Count; i++) - { - Console.WriteLine(api_warnings[i].Description); - } - } - } -} +using System; +using Oasys.AdSec; +using Oasys.AdSec.IO.Serialization; +using Oasys.Collections; + +namespace AdsToApi +{ + /// + /// This example shows how to convert an .ads file into API objects. + /// + /// You might like to run the 'ApiVersion' example first, just to check + /// that the API is installed correctly. + /// + 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 json = System.IO.File.ReadAllText(path); + + // Use JsonParser's Deserialize method to convert from JSON to API objects + ParsedResult api = JsonParser.Deserialize(json); + + // Access the ISection + 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 + System.Collections.Generic.IList api_warnings = api.Warnings; + for (int i = 0; i < api_warnings.Count; i++) + { + Console.WriteLine(api_warnings[i].Description); + } + } + } +} diff --git a/AdSec/.NET/AdsToApi/AdsToApi.csproj b/AdSec/.NET/AdsToApi/AdsToApi.csproj index 40983af..6ceb6fd 100644 --- a/AdSec/.NET/AdsToApi/AdsToApi.csproj +++ b/AdSec/.NET/AdsToApi/AdsToApi.csproj @@ -1,16 +1,16 @@ - - - - Exe - net6.0 - enable - enable - x64 - x64 - - - - - - - + + + + Exe + net6.0 + enable + enable + x64 + x64 + + + + + + + diff --git a/AdSec/.NET/AdsToApi/Properties/Resources.Designer.cs b/AdSec/.NET/AdsToApi/Properties/Resources.Designer.cs index 099e615..da5d610 100644 --- a/AdSec/.NET/AdsToApi/Properties/Resources.Designer.cs +++ b/AdSec/.NET/AdsToApi/Properties/Resources.Designer.cs @@ -1,63 +1,63 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace AdsToApi.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AdsToApi.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AdsToApi.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AdsToApi.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/AdSec/.NET/ApiToAds/ApiToAds.cs b/AdSec/.NET/ApiToAds/ApiToAds.cs index a462435..e93c7f2 100644 --- a/AdSec/.NET/ApiToAds/ApiToAds.cs +++ b/AdSec/.NET/ApiToAds/ApiToAds.cs @@ -1,63 +1,63 @@ -using System; -using Oasys.AdSec; -using Oasys.AdSec.IO.Serialization; -using Oasys.Collections; -using Oasys.AdSec.Materials; -using Oasys.AdSec.StandardMaterials; -using Oasys.Profiles; -using OasysUnits; -using Oasys.AdSec.DesignCode; - -namespace ApiToAds -{ - /// - /// This example shows how to convert an API object into .ads file - /// - /// You might like to run the 'ApiVersion' example first, just to check - /// that the API is installed correctly. - /// - 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; - 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 - ); - String json = converter.SectionToJson(section); - - // 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 - ); - 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); - } - } -} +using System; +using Oasys.AdSec; +using Oasys.AdSec.IO.Serialization; +using Oasys.Collections; +using Oasys.AdSec.Materials; +using Oasys.AdSec.StandardMaterials; +using Oasys.Profiles; +using OasysUnits; +using Oasys.AdSec.DesignCode; + +namespace ApiToAds +{ + /// + /// This example shows how to convert an API object into .ads file + /// + /// You might like to run the 'ApiVersion' example first, just to check + /// that the API is installed correctly. + /// + 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; + 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 + ); + String json = converter.SectionToJson(section); + + // 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 + ); + 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/ApiToAds/ApiToAds.csproj b/AdSec/.NET/ApiToAds/ApiToAds.csproj index bdcb6de..89da59e 100644 --- a/AdSec/.NET/ApiToAds/ApiToAds.csproj +++ b/AdSec/.NET/ApiToAds/ApiToAds.csproj @@ -1,16 +1,16 @@ - - - - Exe - net6.0 - enable - enable - x64 - x64 - - - - - - - + + + + Exe + net6.0 + enable + enable + x64 + x64 + + + + + + + diff --git a/AdSec/.NET/ApiVersion/ApiVersion.cs b/AdSec/.NET/ApiVersion/ApiVersion.cs index 6c9a115..cda4b25 100644 --- a/AdSec/.NET/ApiVersion/ApiVersion.cs +++ b/AdSec/.NET/ApiVersion/ApiVersion.cs @@ -1,15 +1,15 @@ -using Oasys.AdSec; - -namespace ApiVersion -{ - // This is the simplest possible example. - // - // If you can compile and run it then you've installed the API successfully. - public static class ApiVersion - { - public static void Main() - { - System.Console.WriteLine("The AdSec API version is " + IVersion.Api()); - } - } -} +using Oasys.AdSec; + +namespace ApiVersion +{ + // This is the simplest possible example. + // + // If you can compile and run it then you've installed the API successfully. + public static class ApiVersion + { + public static void Main() + { + System.Console.WriteLine("The AdSec API version is " + IVersion.Api()); + } + } +} diff --git a/AdSec/.NET/ApiVersion/ApiVersion.csproj b/AdSec/.NET/ApiVersion/ApiVersion.csproj index 092371e..a685213 100644 --- a/AdSec/.NET/ApiVersion/ApiVersion.csproj +++ b/AdSec/.NET/ApiVersion/ApiVersion.csproj @@ -1,13 +1,13 @@ - - - - Exe - netcoreapp3.1 - x64 - - - - - - - + + + + Exe + netcoreapp3.1 + x64 + + + + + + + diff --git a/AdSec/.NET/DotNetSamples.sln b/AdSec/.NET/DotNetSamples.sln index 82fb1a6..858f86f 100644 --- a/AdSec/.NET/DotNetSamples.sln +++ b/AdSec/.NET/DotNetSamples.sln @@ -1,61 +1,61 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.2.32616.157 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReinforcedConcreteAnalysis", "ReinforcedConcreteAnalysis\ReinforcedConcreteAnalysis.csproj", "{F63AD60B-8359-4CD4-AF57-1EA25E122D97}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiVersion", "ApiVersion\ApiVersion.csproj", "{E5565520-5CD3-4533-8909-EDDC39BAC438}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleProgram", "SampleProgram\SampleProgram.csproj", "{5FA72AA2-55EF-400F-9F48-3651668A5A58}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleProgramTestsUsingMocking", "SampleProgramTestsUsingMocking\SampleProgramTestsUsingMocking.csproj", "{FD8700CF-D79A-4D8D-8540-5F762D538E1A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdsToApi", "AdsToApi\AdsToApi.csproj", "{78C48E48-E70A-4CE9-8C38-0885C293F648}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiToAds", "ApiToAds\ApiToAds.csproj", "{8C6CFBE0-F16B-432D-BC55-BEBF9E6B601D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaveSectionImage", "SaveSectionImage\SaveSectionImage.csproj", "{783B4A2C-477D-4C05-9AC5-EE1644BE5245}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F63AD60B-8359-4CD4-AF57-1EA25E122D97}.Debug|x64.ActiveCfg = Debug|x64 - {F63AD60B-8359-4CD4-AF57-1EA25E122D97}.Debug|x64.Build.0 = Debug|x64 - {F63AD60B-8359-4CD4-AF57-1EA25E122D97}.Release|x64.ActiveCfg = Release|x64 - {F63AD60B-8359-4CD4-AF57-1EA25E122D97}.Release|x64.Build.0 = Release|x64 - {E5565520-5CD3-4533-8909-EDDC39BAC438}.Debug|x64.ActiveCfg = Debug|x64 - {E5565520-5CD3-4533-8909-EDDC39BAC438}.Debug|x64.Build.0 = Debug|x64 - {E5565520-5CD3-4533-8909-EDDC39BAC438}.Release|x64.ActiveCfg = Release|x64 - {E5565520-5CD3-4533-8909-EDDC39BAC438}.Release|x64.Build.0 = Release|x64 - {5FA72AA2-55EF-400F-9F48-3651668A5A58}.Debug|x64.ActiveCfg = Debug|x64 - {5FA72AA2-55EF-400F-9F48-3651668A5A58}.Debug|x64.Build.0 = Debug|x64 - {5FA72AA2-55EF-400F-9F48-3651668A5A58}.Release|x64.ActiveCfg = Release|x64 - {5FA72AA2-55EF-400F-9F48-3651668A5A58}.Release|x64.Build.0 = Release|x64 - {FD8700CF-D79A-4D8D-8540-5F762D538E1A}.Debug|x64.ActiveCfg = Debug|x64 - {FD8700CF-D79A-4D8D-8540-5F762D538E1A}.Debug|x64.Build.0 = Debug|x64 - {FD8700CF-D79A-4D8D-8540-5F762D538E1A}.Release|x64.ActiveCfg = Release|x64 - {FD8700CF-D79A-4D8D-8540-5F762D538E1A}.Release|x64.Build.0 = Release|x64 - {78C48E48-E70A-4CE9-8C38-0885C293F648}.Debug|x64.ActiveCfg = Debug|x64 - {78C48E48-E70A-4CE9-8C38-0885C293F648}.Debug|x64.Build.0 = Debug|x64 - {78C48E48-E70A-4CE9-8C38-0885C293F648}.Release|x64.ActiveCfg = Release|x64 - {78C48E48-E70A-4CE9-8C38-0885C293F648}.Release|x64.Build.0 = Release|x64 - {8C6CFBE0-F16B-432D-BC55-BEBF9E6B601D}.Debug|x64.ActiveCfg = Debug|x64 - {8C6CFBE0-F16B-432D-BC55-BEBF9E6B601D}.Debug|x64.Build.0 = Debug|x64 - {8C6CFBE0-F16B-432D-BC55-BEBF9E6B601D}.Release|x64.ActiveCfg = Release|x64 - {8C6CFBE0-F16B-432D-BC55-BEBF9E6B601D}.Release|x64.Build.0 = Release|x64 - {783B4A2C-477D-4C05-9AC5-EE1644BE5245}.Debug|x64.ActiveCfg = Debug|x64 - {783B4A2C-477D-4C05-9AC5-EE1644BE5245}.Debug|x64.Build.0 = Debug|x64 - {783B4A2C-477D-4C05-9AC5-EE1644BE5245}.Release|x64.ActiveCfg = Release|x64 - {783B4A2C-477D-4C05-9AC5-EE1644BE5245}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1B5D35C9-37F4-432D-B188-4B2C7BDF9CCF} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32616.157 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReinforcedConcreteAnalysis", "ReinforcedConcreteAnalysis\ReinforcedConcreteAnalysis.csproj", "{F63AD60B-8359-4CD4-AF57-1EA25E122D97}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiVersion", "ApiVersion\ApiVersion.csproj", "{E5565520-5CD3-4533-8909-EDDC39BAC438}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleProgram", "SampleProgram\SampleProgram.csproj", "{5FA72AA2-55EF-400F-9F48-3651668A5A58}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleProgramTestsUsingMocking", "SampleProgramTestsUsingMocking\SampleProgramTestsUsingMocking.csproj", "{FD8700CF-D79A-4D8D-8540-5F762D538E1A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdsToApi", "AdsToApi\AdsToApi.csproj", "{78C48E48-E70A-4CE9-8C38-0885C293F648}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiToAds", "ApiToAds\ApiToAds.csproj", "{8C6CFBE0-F16B-432D-BC55-BEBF9E6B601D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaveSectionImage", "SaveSectionImage\SaveSectionImage.csproj", "{783B4A2C-477D-4C05-9AC5-EE1644BE5245}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F63AD60B-8359-4CD4-AF57-1EA25E122D97}.Debug|x64.ActiveCfg = Debug|x64 + {F63AD60B-8359-4CD4-AF57-1EA25E122D97}.Debug|x64.Build.0 = Debug|x64 + {F63AD60B-8359-4CD4-AF57-1EA25E122D97}.Release|x64.ActiveCfg = Release|x64 + {F63AD60B-8359-4CD4-AF57-1EA25E122D97}.Release|x64.Build.0 = Release|x64 + {E5565520-5CD3-4533-8909-EDDC39BAC438}.Debug|x64.ActiveCfg = Debug|x64 + {E5565520-5CD3-4533-8909-EDDC39BAC438}.Debug|x64.Build.0 = Debug|x64 + {E5565520-5CD3-4533-8909-EDDC39BAC438}.Release|x64.ActiveCfg = Release|x64 + {E5565520-5CD3-4533-8909-EDDC39BAC438}.Release|x64.Build.0 = Release|x64 + {5FA72AA2-55EF-400F-9F48-3651668A5A58}.Debug|x64.ActiveCfg = Debug|x64 + {5FA72AA2-55EF-400F-9F48-3651668A5A58}.Debug|x64.Build.0 = Debug|x64 + {5FA72AA2-55EF-400F-9F48-3651668A5A58}.Release|x64.ActiveCfg = Release|x64 + {5FA72AA2-55EF-400F-9F48-3651668A5A58}.Release|x64.Build.0 = Release|x64 + {FD8700CF-D79A-4D8D-8540-5F762D538E1A}.Debug|x64.ActiveCfg = Debug|x64 + {FD8700CF-D79A-4D8D-8540-5F762D538E1A}.Debug|x64.Build.0 = Debug|x64 + {FD8700CF-D79A-4D8D-8540-5F762D538E1A}.Release|x64.ActiveCfg = Release|x64 + {FD8700CF-D79A-4D8D-8540-5F762D538E1A}.Release|x64.Build.0 = Release|x64 + {78C48E48-E70A-4CE9-8C38-0885C293F648}.Debug|x64.ActiveCfg = Debug|x64 + {78C48E48-E70A-4CE9-8C38-0885C293F648}.Debug|x64.Build.0 = Debug|x64 + {78C48E48-E70A-4CE9-8C38-0885C293F648}.Release|x64.ActiveCfg = Release|x64 + {78C48E48-E70A-4CE9-8C38-0885C293F648}.Release|x64.Build.0 = Release|x64 + {8C6CFBE0-F16B-432D-BC55-BEBF9E6B601D}.Debug|x64.ActiveCfg = Debug|x64 + {8C6CFBE0-F16B-432D-BC55-BEBF9E6B601D}.Debug|x64.Build.0 = Debug|x64 + {8C6CFBE0-F16B-432D-BC55-BEBF9E6B601D}.Release|x64.ActiveCfg = Release|x64 + {8C6CFBE0-F16B-432D-BC55-BEBF9E6B601D}.Release|x64.Build.0 = Release|x64 + {783B4A2C-477D-4C05-9AC5-EE1644BE5245}.Debug|x64.ActiveCfg = Debug|x64 + {783B4A2C-477D-4C05-9AC5-EE1644BE5245}.Debug|x64.Build.0 = Debug|x64 + {783B4A2C-477D-4C05-9AC5-EE1644BE5245}.Release|x64.ActiveCfg = Release|x64 + {783B4A2C-477D-4C05-9AC5-EE1644BE5245}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1B5D35C9-37F4-432D-B188-4B2C7BDF9CCF} + EndGlobalSection +EndGlobal diff --git a/AdSec/.NET/README.md b/AdSec/.NET/README.md index 2098820..816a74a 100644 --- a/AdSec/.NET/README.md +++ b/AdSec/.NET/README.md @@ -1,6 +1,6 @@ -# AdSec .NET Examples -Please see the [AdSec API](https://arup-group.github.io/oasys-combined/adsec-api/index.html) -for general information about the AdSec API. - -## Getting Started -Please see [Getting Started With C# and .NET](https://arup-group.github.io/oasys-combined/adsec-api/common/creating_applications/dotnet_clients.html) for information about creating an API Client with C# and .NET. +# AdSec .NET Examples +Please see the [AdSec API](https://arup-group.github.io/oasys-combined/adsec-api/index.html) +for general information about the AdSec API. + +## Getting Started +Please see [Getting Started With C# and .NET](https://arup-group.github.io/oasys-combined/adsec-api/common/creating_applications/dotnet_clients.html) for information about creating an API Client with C# and .NET. diff --git a/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.cs b/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.cs index bd54032..2a6e88c 100644 --- a/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.cs +++ b/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.cs @@ -1,113 +1,113 @@ -using System; -using Oasys.AdSec; -using Oasys.AdSec.DesignCode; -using Oasys.AdSec.Materials; -using Oasys.AdSec.StandardMaterials; -using Oasys.Profiles; -using Oasys.AdSec.Reinforcement; -using Oasys.AdSec.Reinforcement.Groups; -using Oasys.AdSec.Reinforcement.Layers; -using OasysUnits; - -namespace ReinforcedConcreteAnalysis -{ - /// - /// This example shows how to define a reinforced section and analyse it. - /// The example goes on to apply a load and check the utilisation and - /// maximum crack width. - /// - /// You might like to run the 'ApiVersion' example first, just to check - /// that the API is installed correctly. - /// - 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 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) - ); - - // Define top reinforcement - ILayer topLayer = ILayerByBarCount.Create(4, bar16mm); - ITemplateGroup topReinforcement = ITemplateGroup.Create(ITemplateGroup.Face.Top); - topReinforcement.Layers.Add(topLayer); - - // Define bottom reinforcement - ILayer bottomLayerOne = ILayerByBarCount.Create(4, bar20mm); - ILayer bottomLayerTwo = ILayerByBarCount.Create(4, bar16mm); - ITemplateGroup bottomReinforcement = ITemplateGroup.Create(ITemplateGroup.Face.Bottom); - bottomReinforcement.Layers.Add(bottomLayerOne); - bottomReinforcement.Layers.Add(bottomLayerTwo); - - // Define link (stirrup) - ILinkGroup link = ILinkGroup.Create(bar12mm); - - // Add defined reinforcement groups to section - section.ReinforcementGroups.Add(topReinforcement); - section.ReinforcementGroups.Add(bottomReinforcement); - section.ReinforcementGroups.Add(link); - - // Analyse the section to create a solution - var adSec = IAdSec.Create(EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014); - ISolution solution = adSec.Analyse(section); - - // Calculate utilisation for a particular load - var axialForce = Force.FromKilonewtons(-100); - var majorAxisBending = Moment.FromKilonewtonMeters(-500); - var minorAxisBending = Moment.Zero; - var load = ILoad.Create(axialForce, majorAxisBending, minorAxisBending); - IStrengthResult strengthResult = solution.Strength.Check(load); - - // Display utilisation as a percentage - double utilisation = Math.Round(strengthResult.LoadUtilisation.Percent, 1); - Console.WriteLine($"The utilisation is: {utilisation}%"); - - // Calculate the serviceability crack width under the same load - IServiceabilityResult serviceabilityResult = solution.Serviceability.Check(load); - - // Display the crack width in mm - double crackWidth = Math.Round( - serviceabilityResult.MaximumWidthCrack.Width.Millimeters, - 2 - ); - Console.WriteLine($"The maximum crack width is: {crackWidth}mm"); - } - } -} +using System; +using Oasys.AdSec; +using Oasys.AdSec.DesignCode; +using Oasys.AdSec.Materials; +using Oasys.AdSec.StandardMaterials; +using Oasys.Profiles; +using Oasys.AdSec.Reinforcement; +using Oasys.AdSec.Reinforcement.Groups; +using Oasys.AdSec.Reinforcement.Layers; +using OasysUnits; + +namespace ReinforcedConcreteAnalysis +{ + /// + /// This example shows how to define a reinforced section and analyse it. + /// The example goes on to apply a load and check the utilisation and + /// maximum crack width. + /// + /// You might like to run the 'ApiVersion' example first, just to check + /// that the API is installed correctly. + /// + 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 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) + ); + + // Define top reinforcement + ILayer topLayer = ILayerByBarCount.Create(4, bar16mm); + ITemplateGroup topReinforcement = ITemplateGroup.Create(ITemplateGroup.Face.Top); + topReinforcement.Layers.Add(topLayer); + + // Define bottom reinforcement + ILayer bottomLayerOne = ILayerByBarCount.Create(4, bar20mm); + ILayer bottomLayerTwo = ILayerByBarCount.Create(4, bar16mm); + ITemplateGroup bottomReinforcement = ITemplateGroup.Create(ITemplateGroup.Face.Bottom); + bottomReinforcement.Layers.Add(bottomLayerOne); + bottomReinforcement.Layers.Add(bottomLayerTwo); + + // Define link (stirrup) + ILinkGroup link = ILinkGroup.Create(bar12mm); + + // Add defined reinforcement groups to section + section.ReinforcementGroups.Add(topReinforcement); + section.ReinforcementGroups.Add(bottomReinforcement); + section.ReinforcementGroups.Add(link); + + // Analyse the section to create a solution + var adSec = IAdSec.Create(EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014); + ISolution solution = adSec.Analyse(section); + + // Calculate utilisation for a particular load + var axialForce = Force.FromKilonewtons(-100); + var majorAxisBending = Moment.FromKilonewtonMeters(-500); + var minorAxisBending = Moment.Zero; + var load = ILoad.Create(axialForce, majorAxisBending, minorAxisBending); + IStrengthResult strengthResult = solution.Strength.Check(load); + + // Display utilisation as a percentage + double utilisation = Math.Round(strengthResult.LoadUtilisation.Percent, 1); + Console.WriteLine($"The utilisation is: {utilisation}%"); + + // Calculate the serviceability crack width under the same load + IServiceabilityResult serviceabilityResult = solution.Serviceability.Check(load); + + // Display the crack width in mm + double crackWidth = Math.Round( + serviceabilityResult.MaximumWidthCrack.Width.Millimeters, + 2 + ); + Console.WriteLine($"The maximum crack width is: {crackWidth}mm"); + } + } +} diff --git a/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.csproj b/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.csproj index 092371e..a685213 100644 --- a/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.csproj +++ b/AdSec/.NET/ReinforcedConcreteAnalysis/ReinforcedConcreteAnalysis.csproj @@ -1,13 +1,13 @@ - - - - Exe - netcoreapp3.1 - x64 - - - - - - - + + + + Exe + netcoreapp3.1 + x64 + + + + + + + diff --git a/AdSec/.NET/SampleProgram/SampleProgram.cs b/AdSec/.NET/SampleProgram/SampleProgram.cs index 47bba29..2b3187e 100644 --- a/AdSec/.NET/SampleProgram/SampleProgram.cs +++ b/AdSec/.NET/SampleProgram/SampleProgram.cs @@ -1,88 +1,88 @@ -using System; -using Oasys.AdSec; -using Oasys.AdSec.DesignCode; -using Oasys.AdSec.Materials; -using Oasys.AdSec.StandardMaterials; -using Oasys.Profiles; -using Oasys.AdSec.Reinforcement; -using Oasys.AdSec.Reinforcement.Groups; -using Oasys.AdSec.Reinforcement.Layers; -using OasysUnits; - -namespace SampleProgram -{ - /// - /// This example is part of the 'SampleProgramTestsUsingMocking' example. - /// The application calls to - /// check that a section meets a serviceability requirement for a load. - /// - /// 'SampleProgramTestsUsingMocking' shows how to unit test - /// by mocking API objects. - /// - /// You might like to run the 'ApiVersion' example first, just to check - /// that the API is installed correctly. - /// - public static class SampleProgram - { - 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; - 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)) - ); - // Set some reinforcement - IGroup group = ILineGroup.Create( - IPoint.Create(Length.Zero, Length.Zero), - IPoint.Create(Length.FromMillimeters(150), Length.FromMillimeters(150)), - layer - ); - - section.ReinforcementGroups.Add(group); - - // Analyse the section to create a solution - var adSec = IAdSec.Create(EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014); - ISolution solution = adSec.Analyse(section); - - // define load - var axialForce = Force.FromKilonewtons(-100); - var majorAxisBending = Moment.FromKilonewtonMeters(60); - var minorAxisBending = Moment.Zero; - var load = ILoad.Create(axialForce, majorAxisBending, minorAxisBending); - - // Check and Display whether the crack width is adequate - bool result = IsCrackWidthSatisfactory(solution, load); - Console.WriteLine($"Crack width acceptable: {result}"); - } - - public static bool IsCrackWidthSatisfactory(ISolution solution, ILoad load) - { - // Calculate the serviceability crack width under the same load - IServiceabilityResult serviceabilityResult = solution.Serviceability.Check(load); - - // Return true if the crack width is acceptable - double crackWidth = serviceabilityResult.MaximumWidthCrack.Width.Millimeters; - return crackWidth < Length.FromMillimeters(2).Value; - } - } -} +using System; +using Oasys.AdSec; +using Oasys.AdSec.DesignCode; +using Oasys.AdSec.Materials; +using Oasys.AdSec.StandardMaterials; +using Oasys.Profiles; +using Oasys.AdSec.Reinforcement; +using Oasys.AdSec.Reinforcement.Groups; +using Oasys.AdSec.Reinforcement.Layers; +using OasysUnits; + +namespace SampleProgram +{ + /// + /// This example is part of the 'SampleProgramTestsUsingMocking' example. + /// The application calls to + /// check that a section meets a serviceability requirement for a load. + /// + /// 'SampleProgramTestsUsingMocking' shows how to unit test + /// by mocking API objects. + /// + /// You might like to run the 'ApiVersion' example first, just to check + /// that the API is installed correctly. + /// + public static class SampleProgram + { + 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; + 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)) + ); + // Set some reinforcement + IGroup group = ILineGroup.Create( + IPoint.Create(Length.Zero, Length.Zero), + IPoint.Create(Length.FromMillimeters(150), Length.FromMillimeters(150)), + layer + ); + + section.ReinforcementGroups.Add(group); + + // Analyse the section to create a solution + var adSec = IAdSec.Create(EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014); + ISolution solution = adSec.Analyse(section); + + // define load + var axialForce = Force.FromKilonewtons(-100); + var majorAxisBending = Moment.FromKilonewtonMeters(60); + var minorAxisBending = Moment.Zero; + var load = ILoad.Create(axialForce, majorAxisBending, minorAxisBending); + + // Check and Display whether the crack width is adequate + bool result = IsCrackWidthSatisfactory(solution, load); + Console.WriteLine($"Crack width acceptable: {result}"); + } + + public static bool IsCrackWidthSatisfactory(ISolution solution, ILoad load) + { + // Calculate the serviceability crack width under the same load + IServiceabilityResult serviceabilityResult = solution.Serviceability.Check(load); + + // Return true if the crack width is acceptable + double crackWidth = serviceabilityResult.MaximumWidthCrack.Width.Millimeters; + return crackWidth < Length.FromMillimeters(2).Value; + } + } +} diff --git a/AdSec/.NET/SampleProgram/SampleProgram.csproj b/AdSec/.NET/SampleProgram/SampleProgram.csproj index 8530930..f9ced32 100644 --- a/AdSec/.NET/SampleProgram/SampleProgram.csproj +++ b/AdSec/.NET/SampleProgram/SampleProgram.csproj @@ -1,13 +1,13 @@ - - - - Exe - netcoreapp3.1 - x64 - - - - - - - + + + + Exe + netcoreapp3.1 + x64 + + + + + + + diff --git a/AdSec/.NET/SampleProgramTestsUsingMocking/ApiMock.cs b/AdSec/.NET/SampleProgramTestsUsingMocking/ApiMock.cs index 7606357..a5a29d9 100644 --- a/AdSec/.NET/SampleProgramTestsUsingMocking/ApiMock.cs +++ b/AdSec/.NET/SampleProgramTestsUsingMocking/ApiMock.cs @@ -1,34 +1,34 @@ -using Moq; -using Oasys.AdSec; -using OasysUnits; -using Xunit; - -namespace SampleProgramTestsUsingMocking -{ - /// - /// This is a very simple example of a mock object. - /// It shows how we can create a fake - /// and then get fake crack information from it. - /// - public class ApiMock - { - [Fact] - public void MockSample() - { - // GIVEN a serviceability result - Length length = Length.FromMillimeters(0.5); - Mock mockCrack = new Mock(); - Mock mockServiceabilityResult = - new Mock(); - mockServiceabilityResult.Setup(_ => _.MaximumWidthCrack).Returns(mockCrack.Object); - mockCrack.Setup(_ => _.Width).Returns(length); - - // WHEN we can read the maximum crack width - double crackWidth = mockServiceabilityResult.Object.MaximumWidthCrack.Width.Millimeters; - double someExpectedValue = length.Value; - - // THEN we get the expected value - Assert.Equal(someExpectedValue, crackWidth); - } - } -} +using Moq; +using Oasys.AdSec; +using OasysUnits; +using Xunit; + +namespace SampleProgramTestsUsingMocking +{ + /// + /// This is a very simple example of a mock object. + /// It shows how we can create a fake + /// and then get fake crack information from it. + /// + public class ApiMock + { + [Fact] + public void MockSample() + { + // GIVEN a serviceability result + Length length = Length.FromMillimeters(0.5); + Mock mockCrack = new Mock(); + Mock mockServiceabilityResult = + new Mock(); + mockServiceabilityResult.Setup(_ => _.MaximumWidthCrack).Returns(mockCrack.Object); + mockCrack.Setup(_ => _.Width).Returns(length); + + // WHEN we can read the maximum crack width + double crackWidth = mockServiceabilityResult.Object.MaximumWidthCrack.Width.Millimeters; + double someExpectedValue = length.Value; + + // THEN we get the expected value + Assert.Equal(someExpectedValue, crackWidth); + } + } +} diff --git a/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.cs b/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.cs index 5c15020..baa6030 100644 --- a/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.cs +++ b/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.cs @@ -1,50 +1,50 @@ -using Moq; -using Oasys.AdSec; -using OasysUnits; -using Xunit; - -namespace SampleProgramTestsUsingMocking -{ - /// - /// This example shows how to mock API objects so you can - /// unit test part of your application. - /// - /// It tests - /// by mocking , etc. - /// - /// You might like to run the 'ApiVersion' example first, just to check - /// that the API is installed correctly. - /// - public class SampleProgramTestsUsingMocking - { - [Fact] - public void IsCrackWidthSatisfactory_True_ForSmallCrack() - { - // GIVEN we've mocked the AdSec API - Length length = Length.FromMillimeters(1); - Mock crackMock = new Mock(); - Mock loadMock = 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); - 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 - ); - - // THEN IsCrackWidthSatisfactory() uses the mock objects - bool expectedResult = true; - Assert.Equal(expectedResult, actualResult); - } - } -} +using Moq; +using Oasys.AdSec; +using OasysUnits; +using Xunit; + +namespace SampleProgramTestsUsingMocking +{ + /// + /// This example shows how to mock API objects so you can + /// unit test part of your application. + /// + /// It tests + /// by mocking , etc. + /// + /// You might like to run the 'ApiVersion' example first, just to check + /// that the API is installed correctly. + /// + public class SampleProgramTestsUsingMocking + { + [Fact] + public void IsCrackWidthSatisfactory_True_ForSmallCrack() + { + // GIVEN we've mocked the AdSec API + Length length = Length.FromMillimeters(1); + Mock crackMock = new Mock(); + Mock loadMock = 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); + 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 + ); + + // THEN IsCrackWidthSatisfactory() uses the mock objects + bool expectedResult = true; + Assert.Equal(expectedResult, actualResult); + } + } +} diff --git a/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.csproj b/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.csproj index bb63c17..ebf3968 100644 --- a/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.csproj +++ b/AdSec/.NET/SampleProgramTestsUsingMocking/SampleProgramTestsUsingMocking.csproj @@ -1,24 +1,24 @@ - - - - netcoreapp3.1 - x64 - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - + + + + netcoreapp3.1 + x64 + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/AdSec/.NET/SaveSectionImage/SaveSectionImage.cs b/AdSec/.NET/SaveSectionImage/SaveSectionImage.cs index 4142da8..52bd9ce 100644 --- a/AdSec/.NET/SaveSectionImage/SaveSectionImage.cs +++ b/AdSec/.NET/SaveSectionImage/SaveSectionImage.cs @@ -1,103 +1,103 @@ -using System; -using Oasys.AdSec; -using Oasys.AdSec.DesignCode; -using Oasys.AdSec.Materials; -using Oasys.AdSec.StandardMaterials; -using Oasys.Profiles; -using Oasys.AdSec.Reinforcement; -using Oasys.AdSec.Reinforcement.Groups; -using Oasys.AdSec.Reinforcement.Layers; -using Oasys.AdSec.IO.Graphics.Section; -using OasysUnits; - -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. - /// - public static class SaveSectionImage - { - static void Main() - { - // 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) - ); - 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 - IReinforcement reinforcementMaterial = Reinforcement.Steel.IS456.Edition_2000.S415; - 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) - ); - 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) - ); - 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) - ); - 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 - ); - section.SubComponents.Add(subcomponent); - - // Flatten the section - IAdSec adsecApp = IAdSec.Create(IS456.Edition_2000); - ISection flattenedSection = adsecApp.Flatten(section); - - // Get SVG XML body as a string - string svgStr = new SectionImageBuilder(flattenedSection).Svg(); - - // This string can be written into SVG format file - System.IO.File.WriteAllText("example.svg", svgStr); - - // This string can be converted into PNG format file with a third party library like https://www.nuget.org/packages/Svg - Svg.SvgDocument.FromSvg(svgStr).Draw().Save("example.png"); - } - } -} +using System; +using Oasys.AdSec; +using Oasys.AdSec.DesignCode; +using Oasys.AdSec.Materials; +using Oasys.AdSec.StandardMaterials; +using Oasys.Profiles; +using Oasys.AdSec.Reinforcement; +using Oasys.AdSec.Reinforcement.Groups; +using Oasys.AdSec.Reinforcement.Layers; +using Oasys.AdSec.IO.Graphics.Section; +using OasysUnits; + +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. + /// + public static class SaveSectionImage + { + static void Main() + { + // 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) + ); + 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 + IReinforcement reinforcementMaterial = Reinforcement.Steel.IS456.Edition_2000.S415; + 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) + ); + 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) + ); + 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) + ); + 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 + ); + section.SubComponents.Add(subcomponent); + + // Flatten the section + IAdSec adsecApp = IAdSec.Create(IS456.Edition_2000); + ISection flattenedSection = adsecApp.Flatten(section); + + // Get SVG XML body as a string + string svgStr = new SectionImageBuilder(flattenedSection).Svg(); + + // This string can be written into SVG format file + System.IO.File.WriteAllText("example.svg", svgStr); + + // This string can be converted into PNG format file with a third party library like https://www.nuget.org/packages/Svg + Svg.SvgDocument.FromSvg(svgStr).Draw().Save("example.png"); + } + } +} diff --git a/AdSec/.NET/SaveSectionImage/SaveSectionImage.csproj b/AdSec/.NET/SaveSectionImage/SaveSectionImage.csproj index 3a886e1..2ba653c 100644 --- a/AdSec/.NET/SaveSectionImage/SaveSectionImage.csproj +++ b/AdSec/.NET/SaveSectionImage/SaveSectionImage.csproj @@ -1,18 +1,18 @@ - - - - Exe - netcoreapp3.1 - x64 - - - - - - - - - - - - + + + + Exe + netcoreapp3.1 + x64 + + + + + + + + + + + + diff --git a/AdSec/Python/AdsToApi.py b/AdSec/Python/AdsToApi.py index 3dabc07..527eda3 100644 --- a/AdSec/Python/AdsToApi.py +++ b/AdSec/Python/AdsToApi.py @@ -1,42 +1,42 @@ -import os -from pathlib import Path - -# Import modules from namespace -from Oasys.AdSec.IO.Serialization import JsonParser - -# This example shows how to convert a .ads file into API objects. -# -# You might like to run the 'version.py' example first, just to check -# that the API is installed correctly. - - -def ads_to_api(): - # Get the path of the .ads file. - dirname = os.path.dirname(__file__) - common_directory = Path(dirname).parents[ - 1 - ] # Third party library 'pathlib' is used to access required directory level - ads_file_path = os.path.join( - common_directory, "DocumentationOnly", "Python", "PythonCodeSnippets", "api2section.ads" - ) - - # Read the .ads file - with open(ads_file_path) as file: - json = file.read() - - # Use JsonParser's Deserialize method to convert from JSON to API objects - api = JsonParser.Deserialize(json) - # Access the ISection - api_sections = api.Sections - section_one = api_sections[0] - # Access and print warnings to check for warning messages while converting JSON to API - api_warnings = api.Warnings - for i in range(api_warnings.Count): - print(api_warnings[i].Description) - - -if __name__ == "__main__": - ads_to_api() - - # Note: This feature works for Standard Materials - # Note: Tasks are ignored +import os +from pathlib import Path + +# Import modules from namespace +from Oasys.AdSec.IO.Serialization import JsonParser + +# This example shows how to convert a .ads file into API objects. +# +# You might like to run the 'version.py' example first, just to check +# that the API is installed correctly. + + +def ads_to_api(): + # Get the path of the .ads file. + dirname = os.path.dirname(__file__) + common_directory = Path(dirname).parents[ + 1 + ] # Third party library 'pathlib' is used to access required directory level + ads_file_path = os.path.join( + common_directory, "DocumentationOnly", "Python", "PythonCodeSnippets", "api2section.ads" + ) + + # Read the .ads file + with open(ads_file_path) as file: + json = file.read() + + # Use JsonParser's Deserialize method to convert from JSON to API objects + api = JsonParser.Deserialize(json) + # Access the ISection + api_sections = api.Sections + section_one = api_sections[0] + # Access and print warnings to check for warning messages while converting JSON to API + api_warnings = api.Warnings + for i in range(api_warnings.Count): + print(api_warnings[i].Description) + + +if __name__ == "__main__": + ads_to_api() + + # Note: This feature works for Standard Materials + # Note: Tasks are ignored diff --git a/AdSec/Python/ApiToAds.py b/AdSec/Python/ApiToAds.py index c3eeaee..ec6d168 100644 --- a/AdSec/Python/ApiToAds.py +++ b/AdSec/Python/ApiToAds.py @@ -1,45 +1,45 @@ -from Oasys.AdSec import ILoad, ISection -from Oasys.AdSec.DesignCode import EN1992 -from Oasys.AdSec.IO.Serialization import JsonConverter -from Oasys.AdSec.StandardMaterials import Concrete -from Oasys.Collections import IList -from Oasys.Profiles import ICircleProfile -from OasysUnits import Force, Length, Moment -from OasysUnits.Units import ForceUnit, LengthUnit - -# This example shows how to convert an API object into .ads file -# -# You might like to run the 'version.py' example first, just to check -# that the API is installed correctly. - - -def api_to_ads(): - # Create API section - circle_profile = ICircleProfile.Create(Length(float(1000), LengthUnit.Millimeter)) - C30 = Concrete.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.PD6687.Edition_2010.C30_37 - section = ISection.Create(circle_profile, C30) - - # Use JsonConverter's SectionToJson method to obtain JSON string - converter = JsonConverter(EN1992.Part1_1.Edition_2004.NationalAnnex.GB.PD6687.Edition_2010) - json = converter.SectionToJson(section) - - # Save this JSON string into a file - with open("adsec_section.ads", mode="w", encoding="utf-8") as file: - file.write(json) - - # To save a section with load (or deformation) - load_one = ILoad.Create(Force(float(-10), ForceUnit.Kilonewton), Moment.Zero, Moment.Zero) - load_two = ILoad.Create(Force(float(-15), ForceUnit.Kilonewton), Moment.Zero, Moment.Zero) - load_list = IList[ILoad].Create() - load_list.Add(load_one) - load_list.Add(load_two) - json_with_loads = converter.SectionToJson(section, load_list) - with open("adsec_section_with_loads.ads", mode="w", encoding="utf-8") as file: - file.write(json_with_loads) - - -if __name__ == "__main__": - api_to_ads() - - # Note: This feature works for Standard Materials - # Note: Tasks are ignored +from Oasys.AdSec import ILoad, ISection +from Oasys.AdSec.DesignCode import EN1992 +from Oasys.AdSec.IO.Serialization import JsonConverter +from Oasys.AdSec.StandardMaterials import Concrete +from Oasys.Collections import IList +from Oasys.Profiles import ICircleProfile +from OasysUnits import Force, Length, Moment +from OasysUnits.Units import ForceUnit, LengthUnit + +# This example shows how to convert an API object into .ads file +# +# You might like to run the 'version.py' example first, just to check +# that the API is installed correctly. + + +def api_to_ads(): + # Create API section + circle_profile = ICircleProfile.Create(Length(float(1000), LengthUnit.Millimeter)) + C30 = Concrete.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.PD6687.Edition_2010.C30_37 + section = ISection.Create(circle_profile, C30) + + # Use JsonConverter's SectionToJson method to obtain JSON string + converter = JsonConverter(EN1992.Part1_1.Edition_2004.NationalAnnex.GB.PD6687.Edition_2010) + json = converter.SectionToJson(section) + + # Save this JSON string into a file + with open("adsec_section.ads", mode="w", encoding="utf-8") as file: + file.write(json) + + # To save a section with load (or deformation) + load_one = ILoad.Create(Force(float(-10), ForceUnit.Kilonewton), Moment.Zero, Moment.Zero) + load_two = ILoad.Create(Force(float(-15), ForceUnit.Kilonewton), Moment.Zero, Moment.Zero) + load_list = IList[ILoad].Create() + load_list.Add(load_one) + load_list.Add(load_two) + json_with_loads = converter.SectionToJson(section, load_list) + with open("adsec_section_with_loads.ads", mode="w", encoding="utf-8") as file: + file.write(json_with_loads) + + +if __name__ == "__main__": + api_to_ads() + + # Note: This feature works for Standard Materials + # Note: Tasks are ignored diff --git a/AdSec/Python/ApiVersion.py b/AdSec/Python/ApiVersion.py index a4b0fc1..19ef884 100644 --- a/AdSec/Python/ApiVersion.py +++ b/AdSec/Python/ApiVersion.py @@ -1,10 +1,10 @@ -# Load the AdSec API - -# Import modules -from Oasys.AdSec import IVersion - -# This is the simplest possible example. -# -# If you can run this then you've installed the API successfully. -if __name__ == "__main__": - print("This AdSec API version is " + IVersion.Api()) +# Load the AdSec API + +# Import modules +from Oasys.AdSec import IVersion + +# This is the simplest possible example. +# +# If you can run this then you've installed the API successfully. +if __name__ == "__main__": + print("This AdSec API version is " + IVersion.Api()) diff --git a/AdSec/Python/README.md b/AdSec/Python/README.md index 698285d..4d4cf11 100644 --- a/AdSec/Python/README.md +++ b/AdSec/Python/README.md @@ -1,7 +1,7 @@ -# AdSec Python Examples -Please see the [AdSec API](https://arup-group.github.io/oasys-combined/adsec-api/index.html) -for general information about the AdSec API. - -## Getting Started -Please see the [Getting Started With Python](https://arup-group.github.io/oasys-combined/adsec-api/common/creating_applications/python_clients.html) -for information creating an API Client in Python. \ No newline at end of file +# AdSec Python Examples +Please see the [AdSec API](https://arup-group.github.io/oasys-combined/adsec-api/index.html) +for general information about the AdSec API. + +## Getting Started +Please see the [Getting Started With Python](https://arup-group.github.io/oasys-combined/adsec-api/common/creating_applications/python_clients.html) +for information creating an API Client in Python. diff --git a/AdSec/Python/ReinforcedConcreteAnalysis.py b/AdSec/Python/ReinforcedConcreteAnalysis.py index 932ceb6..0fc8c36 100644 --- a/AdSec/Python/ReinforcedConcreteAnalysis.py +++ b/AdSec/Python/ReinforcedConcreteAnalysis.py @@ -1,82 +1,82 @@ -# Load the AdSec API - -# Import modules from namespace -from Oasys.AdSec import IAdSec, ILoad, ISection -from Oasys.AdSec.DesignCode import EN1992 -from Oasys.AdSec.Reinforcement import IBarBundle, ICover -from Oasys.AdSec.Reinforcement.Groups import ILinkGroup, ITemplateGroup -from Oasys.AdSec.Reinforcement.Layers import ILayerByBarCount -from Oasys.AdSec.StandardMaterials import Concrete, Reinforcement -from Oasys.Profiles import IRectangleProfile -from OasysUnits import Force, Length, Moment -from OasysUnits.Units import ForceUnit, LengthUnit, MomentUnit - - -# This example shows how to define a reinforced section and analyse it. -# The example goes on to apply a load and check the utilisation and -# maximum crack width. -# -# You might like to run the 'version.py' example first, just to check -# that the API is installed correctly. -def strength_analysis(): - # Create a rectangular section - depth = Length(float(800), LengthUnit.Millimeter) - width = Length(float(400), LengthUnit.Millimeter) - profile = IRectangleProfile.Create(depth, width) - sectionMaterial = Concrete.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014.C40_50 - section = ISection.Create(profile, sectionMaterial) - - # Set the cover - section.Cover = ICover.Create(Length(float(40), LengthUnit.Millimeter)) - - # Set some reinforcement - reinforcementMaterial = Reinforcement.Steel.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014.S500B - bar20mm = IBarBundle.Create(reinforcementMaterial, Length(float(20), LengthUnit.Millimeter)) - bar16mm = IBarBundle.Create(reinforcementMaterial, Length(float(16), LengthUnit.Millimeter)) - bar12mm = IBarBundle.Create(reinforcementMaterial, Length(float(12), LengthUnit.Millimeter)) - - # Define top reinforcement - layerForTopGroup = ILayerByBarCount.Create(4, bar16mm) - topGroup = ITemplateGroup.Create(ITemplateGroup.Face.Top) - topGroup.Layers.Add(layerForTopGroup) - - # Define bottom reinforcement - layerOneForBottomGroup = ILayerByBarCount.Create(4, bar20mm) - layerTwoForBottomGroup = ILayerByBarCount.Create(4, bar16mm) - bottomGroup = ITemplateGroup.Create(ITemplateGroup.Face.Bottom) - bottomGroup.Layers.Add(layerOneForBottomGroup) - bottomGroup.Layers.Add(layerTwoForBottomGroup) - - # Define link (stirrup) - link = ILinkGroup.Create(bar12mm) - - # Add defined reinforcement groups to section - section.ReinforcementGroups.Add(topGroup) - section.ReinforcementGroups.Add(bottomGroup) - section.ReinforcementGroups.Add(link) - - # Analyse the section to create a solution - adSec = IAdSec.Create(EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014) - solution = adSec.Analyse(section) - - # Calculate utilisation for a particular load - axialForce = Force(float(-100), ForceUnit.Kilonewton) - majorAxisBending = Moment(float(-500), MomentUnit.KilonewtonMeter) - minorAxisBending = Moment.Zero - load = ILoad.Create(axialForce, majorAxisBending, minorAxisBending) - strengthResult = solution.Strength.Check(load) - - # Display utilisation as a percentage - utilisation = round(strengthResult.LoadUtilisation.Percent, 1) - print("The utilisation is: " + str(utilisation) + "%") - - # Calculate the serviceability crack width under the same load - serviceabilityResult = solution.Serviceability.Check(load) - - # Display the crack width in mm - crackWidth = round(serviceabilityResult.MaximumWidthCrack.Width.Millimeters, 2) - print("The maximum crack width is: " + str(crackWidth) + " mm") - - -if __name__ == "__main__": - strength_analysis() +# Load the AdSec API + +# Import modules from namespace +from Oasys.AdSec import IAdSec, ILoad, ISection +from Oasys.AdSec.DesignCode import EN1992 +from Oasys.AdSec.Reinforcement import IBarBundle, ICover +from Oasys.AdSec.Reinforcement.Groups import ILinkGroup, ITemplateGroup +from Oasys.AdSec.Reinforcement.Layers import ILayerByBarCount +from Oasys.AdSec.StandardMaterials import Concrete, Reinforcement +from Oasys.Profiles import IRectangleProfile +from OasysUnits import Force, Length, Moment +from OasysUnits.Units import ForceUnit, LengthUnit, MomentUnit + + +# This example shows how to define a reinforced section and analyse it. +# The example goes on to apply a load and check the utilisation and +# maximum crack width. +# +# You might like to run the 'version.py' example first, just to check +# that the API is installed correctly. +def strength_analysis(): + # Create a rectangular section + depth = Length(float(800), LengthUnit.Millimeter) + width = Length(float(400), LengthUnit.Millimeter) + profile = IRectangleProfile.Create(depth, width) + sectionMaterial = Concrete.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014.C40_50 + section = ISection.Create(profile, sectionMaterial) + + # Set the cover + section.Cover = ICover.Create(Length(float(40), LengthUnit.Millimeter)) + + # Set some reinforcement + reinforcementMaterial = Reinforcement.Steel.EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014.S500B + bar20mm = IBarBundle.Create(reinforcementMaterial, Length(float(20), LengthUnit.Millimeter)) + bar16mm = IBarBundle.Create(reinforcementMaterial, Length(float(16), LengthUnit.Millimeter)) + bar12mm = IBarBundle.Create(reinforcementMaterial, Length(float(12), LengthUnit.Millimeter)) + + # Define top reinforcement + layerForTopGroup = ILayerByBarCount.Create(4, bar16mm) + topGroup = ITemplateGroup.Create(ITemplateGroup.Face.Top) + topGroup.Layers.Add(layerForTopGroup) + + # Define bottom reinforcement + layerOneForBottomGroup = ILayerByBarCount.Create(4, bar20mm) + layerTwoForBottomGroup = ILayerByBarCount.Create(4, bar16mm) + bottomGroup = ITemplateGroup.Create(ITemplateGroup.Face.Bottom) + bottomGroup.Layers.Add(layerOneForBottomGroup) + bottomGroup.Layers.Add(layerTwoForBottomGroup) + + # Define link (stirrup) + link = ILinkGroup.Create(bar12mm) + + # Add defined reinforcement groups to section + section.ReinforcementGroups.Add(topGroup) + section.ReinforcementGroups.Add(bottomGroup) + section.ReinforcementGroups.Add(link) + + # Analyse the section to create a solution + adSec = IAdSec.Create(EN1992.Part1_1.Edition_2004.NationalAnnex.GB.Edition_2014) + solution = adSec.Analyse(section) + + # Calculate utilisation for a particular load + axialForce = Force(float(-100), ForceUnit.Kilonewton) + majorAxisBending = Moment(float(-500), MomentUnit.KilonewtonMeter) + minorAxisBending = Moment.Zero + load = ILoad.Create(axialForce, majorAxisBending, minorAxisBending) + strengthResult = solution.Strength.Check(load) + + # Display utilisation as a percentage + utilisation = round(strengthResult.LoadUtilisation.Percent, 1) + print("The utilisation is: " + str(utilisation) + "%") + + # Calculate the serviceability crack width under the same load + serviceabilityResult = solution.Serviceability.Check(load) + + # Display the crack width in mm + crackWidth = round(serviceabilityResult.MaximumWidthCrack.Width.Millimeters, 2) + print("The maximum crack width is: " + str(crackWidth) + " mm") + + +if __name__ == "__main__": + strength_analysis() diff --git a/AdSec/Python/SaveSectionImage.py b/AdSec/Python/SaveSectionImage.py index 2659192..749aef9 100644 --- a/AdSec/Python/SaveSectionImage.py +++ b/AdSec/Python/SaveSectionImage.py @@ -1,87 +1,87 @@ -# Load the AdSec API - -# Import modules from namespace -from Oasys.AdSec import IAdSec, ISection, ISubComponent -from Oasys.AdSec.DesignCode import IS456 -from Oasys.AdSec.IO.Graphics.Section import SectionImageBuilder -from Oasys.AdSec.Reinforcement import IBarBundle, ICover -from Oasys.AdSec.Reinforcement.Groups import ILinkGroup, IPerimeterGroup -from Oasys.AdSec.Reinforcement.Layers import ILayerByBarPitch -from Oasys.AdSec.StandardMaterials import Concrete, Reinforcement -from Oasys.Profiles import IPoint, IRectangleProfile -from OasysUnits import Length -from OasysUnits.Units import LengthUnit -from reportlab.graphics import renderPM -from svglib.svglib import svg2rlg - -# 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. - - -def save_section_image(): - # We're going to create a rectangular section with a sub-component. - - # Create the rectangular section - depth = Length(float(500), LengthUnit.Millimeter) - width = Length(float(300), LengthUnit.Millimeter) - profile = IRectangleProfile.Create(depth, width) - section_material = Concrete.IS456.Edition_2000.M30 - section = ISection.Create(profile, section_material) - - # Set cover - section.Cover = ICover.Create(Length(float(30), LengthUnit.Millimeter)) - - # Assign reinforcements to the main section - reinforcement_material = Reinforcement.Steel.IS456.Edition_2000.S415 - bar16mm = IBarBundle.Create(reinforcement_material, Length(float(16), LengthUnit.Millimeter)) - layer_pitch_125mm = ILayerByBarPitch.Create(bar16mm, Length(float(125), LengthUnit.Millimeter)) - main_reinforcement = IPerimeterGroup.Create() - main_reinforcement.Layers.Add(layer_pitch_125mm) - link10mm = IBarBundle.Create(reinforcement_material, Length(float(10), LengthUnit.Millimeter)) - link = ILinkGroup.Create(link10mm) - section.ReinforcementGroups.Add(main_reinforcement) - section.ReinforcementGroups.Add(link) - - # Create another rectangular section which we'll use as a sub-component. - subcomponent_depth = Length(float(250), LengthUnit.Millimeter) - subcomponent_width = Length(float(700), LengthUnit.Millimeter) - subcomponent_profile = IRectangleProfile.Create(subcomponent_depth, subcomponent_width) - subcomponent_section = ISection.Create(subcomponent_profile, section_material) - subcomponent_section.Cover = ICover.Create(Length(float(30), LengthUnit.Millimeter)) - - # Assign reinforcements to sub-component section - layer_pitch_120mm = ILayerByBarPitch.Create(bar16mm, Length(float(120), LengthUnit.Millimeter)) - subcomponent_reinforcement = IPerimeterGroup.Create() - subcomponent_reinforcement.Layers.Add(layer_pitch_120mm) - subcomponent_link = ILinkGroup.Create(link10mm) - subcomponent_section.ReinforcementGroups.Add(subcomponent_reinforcement) - subcomponent_section.ReinforcementGroups.Add(subcomponent_link) - - # Add this sub-component to the main section - y = Length(float(-200), LengthUnit.Millimeter) - z = Length(float(125), LengthUnit.Millimeter) - subcomponent_offset = IPoint.Create(y, z) - subcomponent = ISubComponent.Create(subcomponent_section, subcomponent_offset) - section.SubComponents.Add(subcomponent) - - # Flatten the section - app = IAdSec.Create(IS456.Edition_2000) - flattened_section = app.Flatten(section) - - # Get SVG XML body as a string - svg_str = SectionImageBuilder(flattened_section).Svg() - - # This string can be written into SVG format file - with open("examplepy.svg", "w") as file: - file.write(svg_str) - - # This string can be converted into PNG format file with a third party library like https://pypi.org/project/svglib - drawing = svg2rlg("examplepy.svg") - renderPM.drawToFile(drawing, "examplepy.png", fmt="PNG") - - -if __name__ == "__main__": - save_section_image() +# Load the AdSec API + +# Import modules from namespace +from Oasys.AdSec import IAdSec, ISection, ISubComponent +from Oasys.AdSec.DesignCode import IS456 +from Oasys.AdSec.IO.Graphics.Section import SectionImageBuilder +from Oasys.AdSec.Reinforcement import IBarBundle, ICover +from Oasys.AdSec.Reinforcement.Groups import ILinkGroup, IPerimeterGroup +from Oasys.AdSec.Reinforcement.Layers import ILayerByBarPitch +from Oasys.AdSec.StandardMaterials import Concrete, Reinforcement +from Oasys.Profiles import IPoint, IRectangleProfile +from OasysUnits import Length +from OasysUnits.Units import LengthUnit +from reportlab.graphics import renderPM +from svglib.svglib import svg2rlg + +# 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. + + +def save_section_image(): + # We're going to create a rectangular section with a sub-component. + + # Create the rectangular section + depth = Length(float(500), LengthUnit.Millimeter) + width = Length(float(300), LengthUnit.Millimeter) + profile = IRectangleProfile.Create(depth, width) + section_material = Concrete.IS456.Edition_2000.M30 + section = ISection.Create(profile, section_material) + + # Set cover + section.Cover = ICover.Create(Length(float(30), LengthUnit.Millimeter)) + + # Assign reinforcements to the main section + reinforcement_material = Reinforcement.Steel.IS456.Edition_2000.S415 + bar16mm = IBarBundle.Create(reinforcement_material, Length(float(16), LengthUnit.Millimeter)) + layer_pitch_125mm = ILayerByBarPitch.Create(bar16mm, Length(float(125), LengthUnit.Millimeter)) + main_reinforcement = IPerimeterGroup.Create() + main_reinforcement.Layers.Add(layer_pitch_125mm) + link10mm = IBarBundle.Create(reinforcement_material, Length(float(10), LengthUnit.Millimeter)) + link = ILinkGroup.Create(link10mm) + section.ReinforcementGroups.Add(main_reinforcement) + section.ReinforcementGroups.Add(link) + + # Create another rectangular section which we'll use as a sub-component. + subcomponent_depth = Length(float(250), LengthUnit.Millimeter) + subcomponent_width = Length(float(700), LengthUnit.Millimeter) + subcomponent_profile = IRectangleProfile.Create(subcomponent_depth, subcomponent_width) + subcomponent_section = ISection.Create(subcomponent_profile, section_material) + subcomponent_section.Cover = ICover.Create(Length(float(30), LengthUnit.Millimeter)) + + # Assign reinforcements to sub-component section + layer_pitch_120mm = ILayerByBarPitch.Create(bar16mm, Length(float(120), LengthUnit.Millimeter)) + subcomponent_reinforcement = IPerimeterGroup.Create() + subcomponent_reinforcement.Layers.Add(layer_pitch_120mm) + subcomponent_link = ILinkGroup.Create(link10mm) + subcomponent_section.ReinforcementGroups.Add(subcomponent_reinforcement) + subcomponent_section.ReinforcementGroups.Add(subcomponent_link) + + # Add this sub-component to the main section + y = Length(float(-200), LengthUnit.Millimeter) + z = Length(float(125), LengthUnit.Millimeter) + subcomponent_offset = IPoint.Create(y, z) + subcomponent = ISubComponent.Create(subcomponent_section, subcomponent_offset) + section.SubComponents.Add(subcomponent) + + # Flatten the section + app = IAdSec.Create(IS456.Edition_2000) + flattened_section = app.Flatten(section) + + # Get SVG XML body as a string + svg_str = SectionImageBuilder(flattened_section).Svg() + + # This string can be written into SVG format file + with open("examplepy.svg", "w") as file: + file.write(svg_str) + + # This string can be converted into PNG format file with a third party library like https://pypi.org/project/svglib + drawing = svg2rlg("examplepy.svg") + renderPM.drawToFile(drawing, "examplepy.png", fmt="PNG") + + +if __name__ == "__main__": + save_section_image() diff --git a/AdSec/Python/requirements.txt b/AdSec/Python/requirements.txt index d7999d5..d4b833f 100644 --- a/AdSec/Python/requirements.txt +++ b/AdSec/Python/requirements.txt @@ -1,3 +1,3 @@ -oasys.adsec -svglib==1.3.0 -pathlib +oasys.adsec +svglib==1.3.0 +pathlib diff --git a/GSA/COM API/.NET/GsaComHelper/DotNetHelpers.vbproj b/GSA/COM API/.NET/GsaComHelper/DotNetHelpers.vbproj index 9548ad7..4abf293 100644 --- a/GSA/COM API/.NET/GsaComHelper/DotNetHelpers.vbproj +++ b/GSA/COM API/.NET/GsaComHelper/DotNetHelpers.vbproj @@ -1,180 +1,180 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {544A079C-AAB4-4DB4-91B8-77FA245167AA} - Library - Oasys.Gsa.DotNetHelpers - DotNetHelpers - Windows - On - - - 3.5 - - - false - v4.6.1 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - - true - true - true - .\ - DotNetHelpers.xml - true - 42353,42354,42355 - full - x64 - 41999,42016,42017,42018,42019,42020,42021,42022,42024,42032,42036,42099 - 1 - - - true - ..\..\programs64\ - DotNetHelpers.xml - true - true - 42353,42354,42355 - pdbonly - x64 - 41999,42016,42017,42018,42019,42020,42021,42022,42024,42032,42036,42099 - 1 - - - true - true - true - bin\Debug\ - DotNetHelpers.xml - true - 42353,42354,42355 - full - AnyCPU - 41999,42016,42017,42018,42019,42020,42021,42022,42024,42032,42036,42099 - 1 - - - true - bin\Release\ - DotNetHelpers.xml - true - true - 42353,42354,42355 - pdbonly - AnyCPU - 41999,42016,42017,42018,42019,42020,42021,42022,42024,42032,42036,42099 - 1 - - - - C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll - False - - - C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll - False - - - - - - - - - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - false - - - - \ No newline at end of file + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {544A079C-AAB4-4DB4-91B8-77FA245167AA} + Library + Oasys.Gsa.DotNetHelpers + DotNetHelpers + Windows + On + + + 3.5 + + + false + v4.6.1 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + true + true + true + .\ + DotNetHelpers.xml + true + 42353,42354,42355 + full + x64 + 41999,42016,42017,42018,42019,42020,42021,42022,42024,42032,42036,42099 + 1 + + + true + ..\..\programs64\ + DotNetHelpers.xml + true + true + 42353,42354,42355 + pdbonly + x64 + 41999,42016,42017,42018,42019,42020,42021,42022,42024,42032,42036,42099 + 1 + + + true + true + true + bin\Debug\ + DotNetHelpers.xml + true + 42353,42354,42355 + full + AnyCPU + 41999,42016,42017,42018,42019,42020,42021,42022,42024,42032,42036,42099 + 1 + + + true + bin\Release\ + DotNetHelpers.xml + true + true + 42353,42354,42355 + pdbonly + AnyCPU + 41999,42016,42017,42018,42019,42020,42021,42022,42024,42032,42036,42099 + 1 + + + + C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll + False + + + C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll + False + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + + diff --git a/GSA/COM API/.NET/GsaComHelper/DotNetHelpers.xml b/GSA/COM API/.NET/GsaComHelper/DotNetHelpers.xml index 6f84b11..a741e3e 100644 --- a/GSA/COM API/.NET/GsaComHelper/DotNetHelpers.xml +++ b/GSA/COM API/.NET/GsaComHelper/DotNetHelpers.xml @@ -1,146 +1,146 @@ - - - - -DotNetHelpers - - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - - calls Gen_MatchDesc. Options include bSuperSeded, bAttemptStd - - - - - - - - - CAUTION: Special function for use ONLY for setting material units - - - - - - - Given a descriptionm, return a map of dimension name to dimension value - - - - - - - - - Fetches value associated with the RVT key from the sid of the record - - - - - - - - - Highest record number for a given module - - - - - - - - Does record exist for keyword - - - - - - - - - gets revit id for the material record - - - - No need to extract RevitID again when using this - - - - gets revit id for the grid plane record - - - - No need to extract RevitID again when using this - - - - gets revit id for the grid line record - - - - No need to extract RevitID again when using this - - - - gets revit id for a member or element - - - - - - - - - returns sid from string {RVT:sid} - - - - sid can be of form {tag1:{subtag1:data}{subtag2:data}}{tag2:data} - - - - Class to store one CSV row - - - - - Class to write data to a CSV file - - - - - Writes a single row to a CSV file. - - The row to be written - - - - Class to read data from a CSV file - - - - - Reads a row of data from a CSV file - - - - - - + + + + +DotNetHelpers + + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + calls Gen_MatchDesc. Options include bSuperSeded, bAttemptStd + + + + + + + + + CAUTION: Special function for use ONLY for setting material units + + + + + + + Given a descriptionm, return a map of dimension name to dimension value + + + + + + + + + Fetches value associated with the RVT key from the sid of the record + + + + + + + + + Highest record number for a given module + + + + + + + + Does record exist for keyword + + + + + + + + + gets revit id for the material record + + + + No need to extract RevitID again when using this + + + + gets revit id for the grid plane record + + + + No need to extract RevitID again when using this + + + + gets revit id for the grid line record + + + + No need to extract RevitID again when using this + + + + gets revit id for a member or element + + + + + + + + + returns sid from string {RVT:sid} + + + + sid can be of form {tag1:{subtag1:data}{subtag2:data}}{tag2:data} + + + + Class to store one CSV row + + + + + Class to write data to a CSV file + + + + + Writes a single row to a CSV file. + + The row to be written + + + + Class to read data from a CSV file + + + + + Reads a row of data from a CSV file + + + + + + diff --git a/GSA/COM API/.NET/GsaComHelper/GsaComUtil.vb b/GSA/COM API/.NET/GsaComHelper/GsaComUtil.vb index 290beba..bb6a357 100644 --- a/GSA/COM API/.NET/GsaComHelper/GsaComUtil.vb +++ b/GSA/COM API/.NET/GsaComHelper/GsaComUtil.vb @@ -1,3211 +1,3211 @@ -' -' © 2008 Oasys Ltd. -' -Imports System.IO -Imports System.Math -Imports System.Reflection -Imports System.Collections.Generic -Imports System.Drawing -Imports System.Linq -Imports System.Text.RegularExpressions -Public Class GsaComUtil - - Const RoundPrecision As Integer = 6 'precision for rounding real numbers - Const SectionSid_Usage As String = "usage" - Const SectionSid_Symbol As String = "symbol" - Private _MemList As Dictionary(Of Integer, MemberElement) - Private _EleList As Dictionary(Of Integer, MemberElement) - Private _EleListExist As Dictionary(Of Integer, Boolean) - Private _MemListExist As Dictionary(Of Integer, Boolean) - Private _IsHoz As Dictionary(Of Integer, Boolean) - Private _IsVet As Dictionary(Of Integer, Boolean) - Private _SecList As Dictionary(Of Integer, GSASection) - Private _SecListExist As Dictionary(Of Integer, Boolean) - Private _Connection As Dictionary(Of Integer, String) - Enum RefPt - CENTROID = 0 - TOP_LEFT - TOP_CENTRE - TOP_RIGHT - MIDDLE_LEFT - DUMMY - MIDDLE_RIGHT - BOTTOM_LEFT - BOTTOM_CENTRE - BOTTOM_RIGHT - End Enum - Enum AreaType - VOID = 1 - TWO_WAY = 2 - End Enum - Enum LineType - ARC_THIRD_PT - ARC_RADIUS - LINEAR - End Enum - Enum GridPlaneType - UNDEF = -1 - STOREY = 0 - GENERAL = 1 - End Enum - Enum EntType - SEL_ELEM = 2 - SEL_MEMBER = 3 - SEL_AREA = 7 - SEL_REGION = 8 - End Enum - Enum GridLoadType - UNDEF = -1 - AREA = 0 - LINE = 1 - POINT = 3 - End Enum - Enum ElemType - EL_UNDEF = 0 - EL_BEAM = 201 - EL_BAR = 202 - EL_TIE = 203 - EL_STRUT = 204 - EL_SPRING = 205 - EL_LINK = 206 - EL_CABLE = 207 - EL_SPACER = 208 - EL_GROUND = 101 - EL_MASS = 102 - EL_QUAD4 = 401 - EL_QUAD8 = 801 - EL_TRI3 = 301 - EL_TRI6 = 601 - EL_PLANESTRESS = 901 - EL_FLATPLATE = 902 - End Enum - Public Enum MembType - UNDEF = -1 - GENERIC_1D = 0 - GENERIC_2D = 1 - BEAM = 2 - COLUMN = 3 - SLAB = 4 - WALL = 5 - CANTILEVER = 6 - RIBSLAB = 7 - COMPOS = 8 - PILE = 9 - EXPLICIT = 10 - VOID_CUTTER_1D = 11 - VOID_CUTTER_2D = 12 - GENERIC_3D = 13 - End Enum - Public Enum Type2D - UNDEF = 0 - PL_STRESS = 1 - PL_STRAIN = 2 - AXISYMMETRIC = 3 - FABRIC = 4 - PLATE = 5 - SHELL = 6 - CURVED_SHELL = 7 - TORSION = 8 - WALL = 9 - LOAD = 10 - End Enum - Public Function Type2DFromStr(ByVal mType As String) As Type2D - mType = mType.ToUpper() - Select Case mType - Case "UNDEF" - Return Type2D.UNDEF - Case "PL_STRESS" - Return Type2D.PL_STRESS - Case "PL_STRAIN" - Return Type2D.PL_STRAIN - Case "AXISYMMETRIC" - Return Type2D.AXISYMMETRIC - Case "FABRIC" - Return Type2D.FABRIC - Case "PLATE" - Return Type2D.PLATE - Case "SHELL" - Return Type2D.SHELL - Case "CURVED_SHELL" - Return Type2D.CURVED_SHELL - Case "TORSION" - Return Type2D.TORSION - Case "WALL" - Return Type2D.WALL - Case "LOAD" - Return Type2D.LOAD - Case Else - Return Type2D.UNDEF - End Select - End Function - Public Function MembTypeStr(ByVal mType As MembType) As String - Return mType.ToString() - End Function - Public Function MembTypeFromStr(ByVal mType As String) As MembType - mType = mType.ToUpper() - Select Case mType - Case "UNDEF" - Return MembType.UNDEF - Case "GENERIC_1D" - Case "1D_GENERIC" - Return MembType.GENERIC_1D - Case "GENERIC_2D" - Case "2D_GENERIC" - Return MembType.GENERIC_2D - Case "GENERIC_3D" - Return MembType.GENERIC_3D - Case "BEAM" - Return MembType.BEAM - Case "COLUMN" - Return MembType.COLUMN - Case "SLAB" - Return MembType.SLAB - Case "WALL" - Return MembType.WALL - Case "CANTILEVER" - Return MembType.CANTILEVER - Case "RIBSLAB" - Return MembType.RIBSLAB - Case "COMPOS" - Return MembType.COMPOS - Case "PILE" - Return MembType.PILE - Case "EXPLICIT" - Return MembType.EXPLICIT - Case "VOID_CUTTER_1D" - Return MembType.VOID_CUTTER_1D - Case "VOID_CUTTER_2D" - Return MembType.VOID_CUTTER_2D - Case "VOID_CUTTER_1D" - Return MembType.GENERIC_3D - Case Else - Return MembType.UNDEF - End Select - End Function - Public Enum MembBarLayout - BEAM = 0 - COLUMN = 1 - PERIM = 2 - UNDEF = 3 - End Enum - Public Enum MembMat - UNDEF = -1 - STEEL = 1 - CONCRETE = 2 - TIMBER = 3 - ALUMINIUM = 4 - GLASS = 5 - FRP = 6 - End Enum - Public Function MembMatStr(ByVal mType As MembMat) As String - Select Case mType - Case MembMat.CONCRETE - Return "CONCRETE" - Case MembMat.STEEL - Return "STEEL" - Case MembMat.TIMBER - Return "TIMBER" - Case MembMat.ALUMINIUM - Return "ALUMINIUM" - Case MembMat.GLASS - Return "GLASS" - Case MembMat.FRP - Return "FRP" - Case Else - Return "GENERIC" - End Select - End Function - Public Function MembMatFromStr(ByVal mType As String) As MembMat - Select Case mType - Case "STEEL" - Return MembMat.STEEL - Case "CONCRETE" - Return MembMat.CONCRETE - Case "TIMBER" - Return MembMat.TIMBER - Case "ALUMINIUM" - Return MembMat.ALUMINIUM - Case "GLASS" - Return MembMat.GLASS - Case "FRP" - Return MembMat.FRP - Case Else - Return MembMat.UNDEF - End Select - End Function - - Public Enum LoadPos - SHR_CENTRE = 0 - TOP_FLANGE = 1 - BOT_FLANGE = 2 - End Enum - Public Enum SectionMatch_Flags - NONE = 0 - SEC_INCL_SS = 1 - SEC_ATTEMPT_STD = 2 - BOTH = (SectionMatch_Flags.SEC_INCL_SS Or SectionMatch_Flags.SEC_ATTEMPT_STD) - End Enum - - Public Enum SectionUsage - NOT_USED = 0 - FRAMING = GsRevit_Usage.FRAMING - COLUMNS = GsRevit_Usage.COLUMNS - SLAB = 3 - WALL = 4 - INVALID = 5 - End Enum - Public Enum Units - IMPERIAL = GsRevit_Units.IMPERIAL - METRIC = GsRevit_Units.METRIC - End Enum - - Public Structure ToMilliMeter - public Shared FromMeter As Double = 1000.0 - public Shared FromFeet As Double = 304.8 - public Shared FromInch As Double = 25.4 - public Shared FromCentimeter As Double = 10.0 - End Structure - - 'GSA object - Private m_GSAObject As ComAuto - Private m_eSelType As EntType - Private m_eUnit As GsRevit_Units ' Units of the REVIT MODEL!! Careful - Public m_cfactor As Double = 1 - Public Sub New() - Try - m_GSAObject = New ComAuto() - Catch ex As System.Runtime.InteropServices.COMException - Throw New System.Exception("Cannot initialise GSA object. " & ex.Message) - End Try - - If m_GSAObject Is Nothing Then - Throw New System.Exception("Cannot initialise GSA object") - End If - _EleList = New Dictionary(Of Integer, MemberElement) - _MemList = New Dictionary(Of Integer, MemberElement) - _EleListExist = New Dictionary(Of Integer, Boolean) - _MemListExist = New Dictionary(Of Integer, Boolean) - _IsHoz = New Dictionary(Of Integer, Boolean) - _IsVet = New Dictionary(Of Integer, Boolean) - _SecList = New Dictionary(Of Integer, GSASection) - _SecListExist = New Dictionary(Of Integer, Boolean) - ' we parse using the EN_GB locale - ' we parse using the EN_GB locale - - m_GSAObject.SetLocale(Locale.LOC_EN_GB) - End Sub - - 'release GSA object - Public Sub ReleaseGsa() - m_GSAObject = Nothing - End Sub - - Public Sub GsaUpdateViews() - Me.m_GSAObject.UpdateViews() - End Sub - - 'open a new GSA file - Public Function GsaNewFile() As Short - Return Me.m_GSAObject.NewFile() - End Function - - 'open an existing GSA file - Public Function GsaOpenFile(ByRef sFileName As String) As Short - Return Me.m_GSAObject.Open(sFileName) - End Function - - 'save the current GSA model to file - Public Function GsaSaveFile(Optional ByVal sFileName As String = "") As Short - If Not String.IsNullOrEmpty(sFileName) Then - Return Me.m_GSAObject.SaveAs(sFileName) - Else - Return Me.m_GSAObject.Save() - End If - End Function - Public Function GsaObj() As ComAuto - Return m_GSAObject - End Function - 'close GSA model - Public Function GsaCloseFile() As Short - Dim returnVal As Short = 0 - Try - returnVal = m_GSAObject.Close() - Me.ReleaseGsa() - Return returnVal - Catch ex As Exception - 'Throw New System.Exception("GSA COM object do not exist" & ex.Message) - End Try - Return returnVal - End Function - Public Function DeleteResults(ByVal Key As String, ByVal iRecLow As Integer, ByVal iRecHigh As Integer) As Boolean - Dim gwaCommand As String - gwaCommand = "DELETE," + Key + "," + iRecLow.ToString() + "," + iRecHigh.ToString() - Dim check As Object = m_GSAObject.GwaCommand(gwaCommand) - Dim bOut As Boolean = CType(check, Boolean) - Return bOut - End Function - 'delete GSA results - Public Function GsaDeleteResults() As Short - Return Me.m_GSAObject.Delete("RESULTS") - End Function - - 'delete the GSA results and cases - Public Function GsaDeleteResultsAndCases() As Short - Return Me.m_GSAObject.Delete("RESULTS_AND_CASES") - End Function - - 'analyse the GSA model - Public Sub GsaAnalyse() - Me.m_GSAObject.Analyse() - End Sub - Public Sub LogFeatureUsage(ByVal LogName As String) - Me.m_GSAObject.LogFeatureUsage(LogName) - End Sub - - Public ReadOnly Property GsaComObject() As ComAuto - Get - Return m_GSAObject - End Get - End Property - Public Property RevitUnits() As GsaComUtil.Units - Get - Return CType(m_eUnit, GsaComUtil.Units) - End Get - Set(ByVal value As GsaComUtil.Units) - m_eUnit = CType(value, GsRevit_Units) - End Set - End Property - Public Function MappingPath() As String - Dim cPath As String = "" - m_GSAObject.MappingDBPath(cPath) - Return cPath - End Function - Public Function RevitFamilyToSection(ByVal familyType As String, ByVal revitFamily As String, ByVal usage As SectionUsage) As String - Dim gsrevit_usage As GsRevit_Usage = GsRevit_Usage.FRAMING - If SectionUsage.COLUMNS = usage Then - gsrevit_usage = GsRevit_Usage.COLUMNS - End If - Return m_GSAObject.Gen_SectTransltnGsRevit(familyType, GsRevit_SectTrnsDir.REVIT_TO_GSA, gsrevit_usage, revitFamily) - End Function - - Public Function IsDescValid(ByVal sDes As String) As Boolean - If String.IsNullOrEmpty(sDes) Then - Return False - End If - Dim strOut As String = m_GSAObject.Gen_SectionMatchDesc(sDes, SectionMatch_Flags.BOTH, False) - If String.IsNullOrEmpty(strOut) Then - Return False - End If - Return True - End Function - Public Function SectionToRevitFamily(ByVal gsaDesc As String, - ByVal usage As SectionUsage, - ByRef familyName As String, - ByRef bFamilyTypeFound As Boolean) As String - - Dim familyType As String = "" - Dim gsrevit_usage As GsRevit_Usage = gsrevit_usage.FRAMING - If SectionUsage.COLUMNS = usage Then - gsrevit_usage = gsrevit_usage.COLUMNS - End If - familyName = "" - familyType = m_GSAObject.Gen_SectTransltnGsRevit(gsaDesc, GsRevit_SectTrnsDir.GSA_TO_REVIT, gsrevit_usage, familyName) - If Not String.IsNullOrEmpty(familyType) And Not String.IsNullOrEmpty(familyName) Then - bFamilyTypeFound = True - Else - 'i.e. 5.0 should be same as 5 - Dim newGsaDesc As String = gsaDesc - If Not newGsaDesc.Contains(".0") Then - newGsaDesc = newGsaDesc + ".0" - Else - newGsaDesc = newGsaDesc.Replace(".0", "") - End If - familyType = m_GSAObject.Gen_SectTransltnGsRevit(newGsaDesc, GsRevit_SectTrnsDir.GSA_TO_REVIT, gsrevit_usage, familyName) - If Not String.IsNullOrEmpty(familyType) And Not String.IsNullOrEmpty(familyName) Then - bFamilyTypeFound = True - Return familyType - End If - familyType = TrySNFamilies(gsaDesc, usage, bFamilyTypeFound, familyName) - End If - Return familyType - End Function - - Private Function TrySNFamilies(ByVal desc As String, ByVal usage As GsaComUtil.SectionUsage, ByRef familyTypeFound As Boolean, ByRef familyName As String) As String - Dim parts As String() = Nothing - parts = desc.Split(New [Char]() {"%"c, " "c}, StringSplitOptions.RemoveEmptyEntries) - Dim typeName As String = "" - If String.Equals(parts.GetValue(0), "CAT") Then - 'CAT W W14x43 - If Me.CATSectionToSNFamily(parts, usage, familyName) Then - familyTypeFound = True - Return parts(2) - End If - ElseIf String.Equals(parts.GetValue(0), "STD") Then - If Me.STDSectionToSNFamily(parts, usage, familyName) Then - familyTypeFound = False - Return Nothing - End If - End If - 'Debug.Assert(False) - familyName = "" - familyTypeFound = False - Return Nothing - - End Function - ''' - ''' calls Gen_MatchDesc. Options include bSuperSeded, bAttemptStd - ''' - ''' - ''' - ''' - ''' - Public Function MatchDescription(ByVal sDesc As String, ByVal options As GsaComUtil.SectionMatch_Flags) As String - If String.IsNullOrEmpty(sDesc) Then - Return String.Empty - End If - Dim result As String = "" - Try - result = m_GSAObject.Gen_SectionMatchDesc(sDesc, options, False) - Catch ex As Exception - Debug.WriteLine(ex.Message) - End Try - Return result - End Function - - 'find existing GSA node at required position or create a new one - Public Function NodeAt(ByVal dX As Double, ByVal dY As Double, ByVal dZ As Double, - ByVal dCoincidenceTol As Double) As Integer - Dim iNode As Integer = 0 - 'round - dX = Math.Round(dX, RoundPrecision) - dY = Math.Round(dY, RoundPrecision) - dZ = Math.Round(dZ, RoundPrecision) - - 'find existing node within tolerance or create new node - iNode = Me.m_GSAObject.Gen_NodeAt(dX, dY, dZ, dCoincidenceTol) - Return iNode - End Function - Public Function BlankElement(ByVal iELem As Integer) As Boolean - Dim gwaCommand As String - gwaCommand = "BLANK,EL," + iELem.ToString() - Dim check As Object = m_GSAObject.GwaCommand(gwaCommand) - Return True - End Function - Public Function BlankMember(ByVal iMem As Integer) As Boolean - Dim gwaCommand As String - gwaCommand = "BLANK,MEMB," + iMem.ToString() - Dim check As Object = m_GSAObject.GwaCommand(gwaCommand) - Return True - End Function - Public Sub ChangeUnits(ByRef dData() As Double) - dData(0) = Math.Round(dData(0) * m_cfactor, 4) - dData(1) = Math.Round(dData(1) * m_cfactor, 4) - dData(2) = Math.Round(dData(2) * m_cfactor, 4) - End Sub - - - Public Sub ChangeUnits(ByRef dData As Double) - dData = Math.Round(dData * m_cfactor, 4) - End Sub - Public Sub ExtractNodeCoor(ByVal iNode As Integer, ByRef x As Double, ByRef y As Double, ByRef z As Double) - - Dim SIToFeet As Double = 3.28084 - 'initialize the coords to 0 first - x = 0 - y = 0 - z = 0 - - Dim check As Object - Dim gwaCommand As String - gwaCommand = "EXIST,NODE," + iNode.ToString() - check = m_GSAObject.GwaCommand(gwaCommand) - Dim iCheck As Integer = CType(check, Integer) - If 1 = iCheck Then - m_GSAObject.NodeCoor(iNode, x, y, z) - End If - 'change SI unit to user unit as NodeCord function return in SI unit - x = x * SIToFeet / m_cfactor - y = y * SIToFeet / m_cfactor - z = z * SIToFeet / m_cfactor - - End Sub - Public Function ExtractNodeCoor(ByVal iNode As Integer) As Double() - - Dim SIToFeet As Double = 3.28084 - 'initialize the coords to 0 first - Dim dbNoderCord() As Double = {0.0, 0.0, 0.0} - Dim check As Object - Dim gwaCommand As String - gwaCommand = "EXIST,NODE," + iNode.ToString() - check = m_GSAObject.GwaCommand(gwaCommand) - Dim iCheck As Integer = CType(check, Integer) - If 1 = iCheck Then - m_GSAObject.NodeCoor(iNode, dbNoderCord(0), dbNoderCord(1), dbNoderCord(2)) - End If - 'change SI unit to user unit as NodeCord function return in SI unit - dbNoderCord(0) = dbNoderCord(0) * SIToFeet / m_cfactor - dbNoderCord(1) = dbNoderCord(1) * SIToFeet / m_cfactor - dbNoderCord(2) = dbNoderCord(2) * SIToFeet / m_cfactor - Return dbNoderCord - End Function - Public Shared Function Arg(ByVal pos As Integer, ByVal source As String) As String - Dim strList As New List(Of String) - Dim strArray As String() = source.Split(New [Char]() {","c}) - Dim bQuoteStart As Boolean = False - Dim bQuoteEnd As Boolean = False - Dim QuoteRecord As String = "" - Dim index As Integer = 0 - For Each value As String In strArray - value = value.Trim() - If (bQuoteStart) Then - bQuoteEnd = value.EndsWith(ControlChars.Quote) - End If - If (Not bQuoteStart) Then - QuoteRecord = "" - bQuoteStart = value.StartsWith(ControlChars.Quote) - End If - - If bQuoteStart OrElse bQuoteEnd Then - If (index > 0) Then - QuoteRecord = QuoteRecord + "," - End If - QuoteRecord = QuoteRecord + value - index = index + 1 - Else - QuoteRecord = value - End If - - If bQuoteEnd Then - bQuoteStart = False - End If - - If Not bQuoteStart Then - strList.Add(QuoteRecord) - End If - Next - If strList.Count > pos Then - Return CType(strList(pos), String) - Else - Return String.Empty - End If - End Function - Public Sub AssignUnitsCF() - - 'Revit store length in feet i.e in Impherial and rest other in SI units - Dim commandObj As Object = m_GSAObject.GwaCommand("GET,UNIT_DATA, LENGTH") - If commandObj Is Nothing Then - Exit Sub - End If - Dim commandResult As String = commandObj.ToString() - 'UNIT_DATA | option | name | factor - 'UNIT_DATA,LENGTH,ft,3.28084 - - Double.TryParse(GsaComUtil.Arg(3, commandResult), m_cfactor) - m_cfactor = 3.28084 / m_cfactor - ' A factor which can convert the values to feet - This is what the revit API expects. - End Sub - 'write a GSA Grid Plane - Public Function SetGridPlane(ByVal iGrid As Integer, ByVal sName As String, ByVal sid As String, ByVal iAxis As Integer, ByVal dElev As Double, ByVal dTol As Double, Optional ByVal type As GsaComUtil.GridPlaneType = GsaComUtil.GridPlaneType.STOREY) As Integer - '// ++ - '// GRID_PLANE.2 | num | name | type | axis | elev | tol | below | above - '// - '// @desc Grid plane definition - '// - '// @param - '// num record number - '// name name - '// type type + - '// GENERAL : general grid plane + - '// STOREY : storey - '// axis grid plane axis - '// elev grid elevation [m] - '// tol grid plane tolerance - '// below storey tolerance below grid plane if STOREY - '// above storey tolerance above grid plane if STOREY - ' // -- - Dim sGwaCommand As String = "" - If (iGrid <= 0) Then - iGrid = Me.HighestGridPlane() + 1 - End If - 'round - dElev = Math.Round(dElev, RoundPrecision) - 'write grid plane - sGwaCommand = "GRID_PLANE:" - sGwaCommand += "{RVT:" & sid & "}" - sGwaCommand += "," + iGrid.ToString() 'number - sGwaCommand += "," & sName 'name - sGwaCommand += "," + type.ToString() 'type [GENERAL :: general grid plane] or [STOREY :: storey] - sGwaCommand += "," + iAxis.ToString() 'axis - sGwaCommand += "," + dElev.ToString() 'elevation - sGwaCommand += "," + dTol.ToString() 'above tolerance - sGwaCommand += "," + dTol.ToString() 'below tolerance - m_GSAObject.GwaCommand(sGwaCommand) - - Return iGrid - End Function - - Public Function GridPlane(ByVal iNum As Integer, ByRef sName As String, ByRef uid As String, ByRef dElev As Double) As Boolean - Dim type As GridPlaneType = GridPlaneType.STOREY - Dim iAxis As Integer = 0 - Dim dTol As Double = 0.0 - Return Me.GridPlane(iNum, sName, uid, iAxis, dElev, type, dTol) - End Function - 'read a GSA Grid Plane - Public Function GridPlane(ByVal iGrid As Integer, ByRef sName As String, ByRef uid As String, ByRef iAxis As Integer, ByRef dElev As Double, ByRef eType As GsaComUtil.GridPlaneType, ByRef dTol As Double) As Boolean - - '// ++ - '// GRID_PLANE.2 | num | name | type | axis | elev | tol | below | above - '// - '// @desc Grid plane definition - '// - '// @param - '// num record number - '// name name - '// type type + - '// GENERAL : general grid plane + - '// STOREY : storey - '// axis grid plane axis - '// elev grid elevation [m] - '// tol grid plane tolerance - '// below storey tolerance below grid plane if STOREY - '// above storey tolerance above grid plane if STOREY - ' // -- - Try - If Not Me.GridPlaneExists(iGrid) Then - Return False - End If - Dim sGwaCommand As String = "" - Dim sArg As String - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,GRID_PLANE," & iGrid.ToString)) - If String.IsNullOrEmpty(sGwaCommand) Then - Return False - End If - sArg = GsaComUtil.Arg(0, sGwaCommand) - Dim idString As String = GsaComUtil.ExtractId(sArg) - If Not String.IsNullOrEmpty(idString) Then - uid = idString - End If - sArg = GsaComUtil.Arg(1, sGwaCommand) 'number - sArg = GsaComUtil.Arg(2, sGwaCommand) 'name - sName = sArg - sArg = GsaComUtil.Arg(3, sGwaCommand) 'type - If (sArg.ToLower().Equals("storey")) Then - eType = GridPlaneType.STOREY - Else - eType = GridPlaneType.GENERAL - End If - sArg = GsaComUtil.Arg(4, sGwaCommand) 'axis - iAxis = CInt(sArg) - - sArg = GsaComUtil.Arg(5, sGwaCommand) 'elevation [feet] - dElev = Val(sArg) - sArg = GsaComUtil.Arg(6, sGwaCommand) 'elements - dTol = Val(sArg) - Catch ex As Exception - Return False - End Try - Return True - End Function - 'write GSA grid line - Public Function SetGridLine(ByVal iGrLine As Integer, ByVal sName As String, ByVal bArc As Boolean, ByVal sid As String, - ByVal coorX As Double, ByVal coorY As Double, ByVal length As Double, - Optional ByVal theta1 As Double = 0.0, Optional ByVal theta2 As Double = 0.0) As Integer - - Dim sGwaCommand As String = "" - If (iGrLine <= 0) Then - iGrLine = Me.HighestGridLine() + 1 - End If - '// ++ - '// GRID_LINE | num | name | arc | coor_x | coor_y | length | theta1 | theta2 - '// - '// @desc Grid line definition - '// - '// @param - '// num record number - '// name name - '// arc line Is circular arc + - '// ARC : + - '// LINE (Or blank) : - '// coor_x X coordinate of start of line Or centre of arc [m] - '// coor_y Y coordinate of start of line Or centre of arc [m] - '// length length of line Or radius of arc [m] - '// theta1 angle of line from X Or Or to start of arc [°] - '// theta2 angle to end of arc (ignored if line) [°] - '// -- - sName = sName.Replace("""", String.Empty) - sGwaCommand = "GRID_LINE:" - sGwaCommand += "{RVT:" & sid & "}" - sGwaCommand += "," + iGrLine.ToString() + "," - sGwaCommand += sName + "," - If bArc Then - sGwaCommand += "ARC" - End If - sGwaCommand += "," - sGwaCommand += coorX.ToString() + "," - sGwaCommand += coorY.ToString() + "," - sGwaCommand += length.ToString() + "," - sGwaCommand += theta1.ToString() + "," + theta2.ToString() + "," - - m_GSAObject.GwaCommand(sGwaCommand) - Dim iGrLineNew As Integer = Me.HighestGridLine() - Return iGrLine - End Function - Public Function GridLine(ByVal iGrLine As Integer, ByRef name As String, ByRef bArc As Boolean, ByRef sid As String, - ByRef coorX As Double, ByRef coorY As Double, ByRef len As Double, - ByRef theta1 As Double, ByRef theta2 As Double) As Boolean - - - 'GRID_LINE | num | name | arc | coor_x | coor_y | length | theta1 | theta2 - Try - If Not Me.GridLineExists(iGrLine) Then - Return False - End If - - Dim result As String = CStr(m_GSAObject.GwaCommand("GET,GRID_LINE," & iGrLine.ToString())) - Dim arg As String = GsaComUtil.Arg(0, result) - Dim idString As String = GsaComUtil.ExtractId(arg) - If Not String.IsNullOrEmpty(idString) Then - sid = idString - End If - - arg = GsaComUtil.Arg(1, result) - Dim iLine As Integer = CInt(arg) - If Not Int32.Equals(iLine, iGrLine) Then - Return False - End If - - arg = GsaComUtil.Arg(2, result) - name = arg - - arg = GsaComUtil.Arg(3, result) - If arg.Equals("LINE") Then - bArc = False - Else - bArc = True - End If - - arg = GsaComUtil.Arg(4, result) - Double.TryParse(arg, coorX) - - arg = GsaComUtil.Arg(5, result) - Double.TryParse(arg, coorY) - - arg = GsaComUtil.Arg(6, result) - Double.TryParse(arg, len) - - arg = GsaComUtil.Arg(7, result) - Double.TryParse(arg, theta1) - - arg = GsaComUtil.Arg(8, result) - Double.TryParse(arg, theta2) - - sid = m_GSAObject.GetSidTagValue("GRID_LINE", iGrLine, "RVT") - - Catch ex As Exception - Return False - End Try - Return True - End Function - 'write a GSA 1D element - Public Function IsPolyLineExist(ByVal Desc As String, ByRef iPolyLine As Integer) As Boolean - If String.IsNullOrEmpty(Desc.Trim()) Then - Return False - End If - Dim uid As String = "", name As String = "", _desc As String = "" - For iPoly As Integer = 0 To HighestPolyLine() - 1 - If PolyLine(iPoly, uid, name, _desc) Then - If _desc.Trim() = Desc.Trim() Then - iPolyLine = iPoly - Return True - End If - End If - Next - Return False - End Function - Public Function PolyLine(ByVal iPoly As Integer, ByRef sID As String, ByRef sName As String, ByRef sDec As String) As Boolean - - Dim sGwaCommand As String = "", sResult As Integer = 0 - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,POLYLINE," & iPoly.ToString)) - Dim sArg As String = GsaComUtil.Arg(0, sGwaCommand) - Dim idString As String = GsaComUtil.ExtractId(sArg) - If Not String.IsNullOrEmpty(idString) Then - sID = idString - End If - sName = GsaComUtil.Arg(2, sGwaCommand) - - sDec = GsaComUtil.Arg(6, sGwaCommand) - - Return True - End Function - Public Function SetPolyLine(ByVal iPoly As Integer, ByVal sID As String, ByVal sName As String, ByVal sDec As String) As Integer - If (iPoly <= 0) Then - iPoly = Me.HighestPolyLine() + 1 - End If - If String.IsNullOrEmpty(sName) Then - sName = "PolyLine " + iPoly.ToString() - End If - Dim sGwaCommand As String = "" - sGwaCommand = "POLYLINE:" - sGwaCommand += "{RVT:" & sID & "}" - sGwaCommand += "," + iPoly.ToString() 'number - sGwaCommand += "," + sName 'name - sGwaCommand += ",NO_RGB" 'colour - sGwaCommand += ",-1" 'undefined grid plane - sGwaCommand += ",2" 'number of dimension - sGwaCommand += "," + sDec 'point description - - m_GSAObject.GwaCommand(sGwaCommand) - Return iPoly - End Function - Public Function SetGridAreaLoad(ByVal iGridAreaLoad As Integer, ByVal sID As String, ByVal sName As String, ByVal iGrid As Integer, ByVal sPolyDesc As String, ByVal iDir As String, ByVal LoadValue1 As Double, ByVal LoadValue2 As Double, ByVal loadCase As Integer, ByVal bProjected As Boolean, ByVal bGlobal As Boolean, ByVal loadtype As GridLoadType) As Integer - 'LOAD_GRID_AREA.2 | name | grid_surface | area | poly | case | axis | proj | dir | value @end - 'LOAD_GRID_LINE.2 | name | grid_surface | line | poly | case | axis | proj | dir | value_1 | value_2 @end - 'LOAD_GRID_POINT.2 | name | grid_surface | x | y | case | axis | dir | value @end - - If (iGridAreaLoad <= 0) Then - If loadtype = GridLoadType.AREA Then - iGridAreaLoad = Me.HighestGridAreaLoad() + 1 - ElseIf loadtype = GridLoadType.LINE Then - iGridAreaLoad = Me.HighestGridLineLoad() + 1 - Else - iGridAreaLoad = Me.HighestGridPointLoad() + 1 - End If - End If - If String.IsNullOrEmpty(sName) Then - sName = "Grid Area Load " + iGridAreaLoad.ToString() - End If - - Dim sGwaCommand As String = "" - If loadtype = GridLoadType.AREA Then - sGwaCommand = "LOAD_GRID_AREA:" - ElseIf loadtype = GridLoadType.LINE Then - sGwaCommand = "LOAD_GRID_LINE:" - Else - sGwaCommand = "LOAD_GRID_POINT:" - End If - - sGwaCommand += "{RVT:" & sID & "}" - sGwaCommand += "," + sName 'name - sGwaCommand += "," + iGrid.ToString() 'grid surface - If Not loadtype = GridLoadType.POINT Then - sGwaCommand += ",POLYREF" - End If - - sGwaCommand += "," + sPolyDesc.ToString() 'polygon ref - - sGwaCommand += "," + loadCase.ToString() 'load case - - If Not bGlobal Then - sGwaCommand += ",LOCAL" 'Global axis - Else - sGwaCommand += ",GLOBAL" 'Global axis - End If - - If Not loadtype = GridLoadType.POINT Then - If Not bProjected Then - sGwaCommand += ",NO" 'projected Load False - Else - sGwaCommand += ",YES" 'projected Load False - End If - End If - - sGwaCommand += "," + iDir 'Direction - sGwaCommand += "," + LoadValue1.ToString() 'Load Value 1 - - If loadtype = GridLoadType.LINE Then - sGwaCommand += "," + LoadValue2.ToString() 'Load Value - End If - sGwaCommand += ", " 'Is Bridge - m_GSAObject.GwaCommand(sGwaCommand) - Return iGridAreaLoad - End Function - Public Function IsGridAreaLoadExistInDirection(ByVal sidIn As String, ByVal sDirIn As String, ByRef AreaLoadRec As Integer, ByVal loadtype As GridLoadType) As Boolean - For iGridArea As Integer = 0 To HighestGridAreaLoad() - 1 - Dim sID As String = "", sName As String = "", iGrid As Integer = 0, iPolyRef As String = "" - Dim LoadCase As Integer = 0 - Dim sDir As String = "", LoadValue1 As Double = 0, LoadValue2 As Double = 0, bProjected As Boolean = False, bGlobal As Boolean = False - If GetGridAreaLoad(iGridArea, sID, sName, iGrid, iPolyRef, LoadCase, sDir, LoadValue1, LoadValue2, bProjected, bGlobal, loadtype) Then - If sidIn.Trim() = sID.Trim() AndAlso sDirIn.ToLower().Trim() = sDir.ToLower().Trim() Then - AreaLoadRec = iGridArea - Return True - End If - End If - Next - Return False - End Function - Public Function GetGridAreaLoad(ByVal iGridAreaLoad As Integer, ByRef sID As String, ByRef sName As String, ByRef iGrid As Integer, ByRef sPolyDesc As String, ByRef LoadCase As Integer, ByRef sDir As String, ByRef LoadValue1 As Double, ByRef LoadValue2 As Double, ByRef bProjected As Boolean, ByRef bGlobal As Boolean, ByVal loadtype As GridLoadType) As Boolean - 'LOAD_GRID_AREA.2 | name | grid_surface | area | poly | case | axis | proj | dir | value @end - 'LOAD_GRID_LINE.2 | name | grid_surface | line | poly | case | axis | proj | dir | value_1 | value_2 @end - 'LOAD_GRID_POINT.2 | name | grid_surface | x | y | case | axis | dir | value @end - - Dim sGwaCommand As String = "", sResult As Integer = 0 - If loadtype = GridLoadType.AREA Then - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,LOAD_GRID_AREA," & iGridAreaLoad.ToString)) - ElseIf loadtype = GridLoadType.LINE Then - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,LOAD_GRID_LINE," & iGridAreaLoad.ToString)) - Else - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,LOAD_GRID_POINT," & iGridAreaLoad.ToString)) - End If - - Dim sArg As String = GsaComUtil.Arg(0, sGwaCommand) - Dim idString As String = GsaComUtil.ExtractId(sArg) - If Not String.IsNullOrEmpty(idString) Then - sID = idString - End If - - Dim iNextIndex As Integer = 1 - - sName = GsaComUtil.Arg(iNextIndex, sGwaCommand) - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) - - If Integer.TryParse(sArg, sResult) Then - iGrid = sResult - Else - Return False - End If - - If loadtype = GridLoadType.POINT Then - iNextIndex = iNextIndex + 1 'X-coordinate - sPolyDesc = GsaComUtil.Arg(iNextIndex, sGwaCommand) - - iNextIndex = iNextIndex + 1 'Y-coordinate - sPolyDesc = sPolyDesc + "," + GsaComUtil.Arg(iNextIndex, sGwaCommand) - Else - - iNextIndex = iNextIndex + 1 'area/line - iNextIndex = iNextIndex + 1 'polygon description - sPolyDesc = GsaComUtil.Arg(iNextIndex, sGwaCommand) - - End If - - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) - If Not Integer.TryParse(sArg, LoadCase) Then - Return False - End If - - iNextIndex = iNextIndex + 1 - bGlobal = True - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) - If sArg = "LOCAL" Then - bGlobal = False - End If - - - If Not loadtype = GridLoadType.POINT Then - iNextIndex = iNextIndex + 1 - bProjected = True - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) - If sArg = "NO" Then - bProjected = False - End If - - iNextIndex = iNextIndex + 1 - sDir = GsaComUtil.Arg(iNextIndex, sGwaCommand) - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) - - Dim fLoadValue As Double = 0 - If Double.TryParse(sArg, fLoadValue) Then - LoadValue1 = fLoadValue - Else - Return False - End If - - If loadtype = GridLoadType.LINE Then - fLoadValue = 0 - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) - If Double.TryParse(sArg, fLoadValue) Then - LoadValue2 = fLoadValue - Else - Return False - End If - End If - - Else - iNextIndex = iNextIndex + 1 - sDir = GsaComUtil.Arg(iNextIndex, sGwaCommand) - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) - Dim fLoadValue As Double = 0 - If Double.TryParse(sArg, fLoadValue) Then - LoadValue1 = fLoadValue - Else - Return False - End If - End If - Return True - End Function - Public Function IsGridAssociatedWithGridSurface(ByVal iGrid As Integer, ByRef iGridSurf As Integer) As Boolean - Dim uid As String = "", name As String = "", grid As Integer = -1, elem2d As Boolean = False, bSpan2d As Boolean = False - For iSurf As Integer = 0 To HighestGridSurface() - 1 - If GridSurface(iSurf + 1, uid, name, grid, elem2d, bSpan2d) Then - If grid = iGrid Then - iGridSurf = iSurf + 1 - Return True - End If - End If - Next - Return False - End Function - Public Function SetGridSurface(ByVal iGridSurf As Integer, ByVal uid As String, ByVal name As String, ByVal iGrid As Integer, ByVal elem2d As Boolean, ByVal bSpan2d As Boolean) As Integer - - If (iGridSurf <= 0) Then - iGridSurf = Me.HighestGridSurface() + 1 - End If - If String.IsNullOrEmpty(name) Then - name = "Grid Surface " + iGridSurf.ToString() - End If - Dim sGwaCommand As String = "" - sGwaCommand = "GRID_SURFACE:" - sGwaCommand += "{RVT:" & uid & "}" - sGwaCommand += "," + iGridSurf.ToString() 'grid id - sGwaCommand += "," + name 'name - sGwaCommand += "," + iGrid.ToString() 'grid plane - If elem2d Then - sGwaCommand += ",2" 'area type - Else - sGwaCommand += ",1" 'area type - End If - sGwaCommand += ",all" 'element list - sGwaCommand += ",0.001" 'tolerance - If bSpan2d Then - sGwaCommand += ",TWO_GENERAL" 'span direction - Else - sGwaCommand += ",ONE" 'span direction - End If - sGwaCommand += ",0" 'angle - sGwaCommand += ",LEGACY" 'grid expension option - m_GSAObject.GwaCommand(sGwaCommand) - Return iGridSurf - - End Function - Public Function NatureToGsaType(ByVal nature As String) As String - - If nature.ToLower().Contains("dead") Then - Return "LC_PERM_SELF" - End If - If nature.ToLower().Contains("soil") Then - Return "LC_PERM_SOIL" - End If - If nature.ToLower().Contains("notional") Then - Return "LC_PERM_EQUIV" - End If - If nature.ToLower().Contains("prestress") Then - Return "LC_PRESTRESS" - End If - If nature.ToLower().Contains("live") Then - Return "LC_VAR_IMP" - End If - If nature.ToLower().Contains("live") Then - Return "LC_VAR_IMP" - End If - If nature.ToLower().Contains("roof") Then - Return "LC_VAR_ROOF" - End If - If nature.ToLower().Contains("wind") Then - Return "LC_VAR_WIND" - End If - If nature.ToLower().Contains("snow") Then - Return "LC_VAR_SNOW" - End If - If nature.ToLower().Contains("rain") Then - Return "LC_VAR_RAIN" - End If - If nature.ToLower().Contains("ther") OrElse nature.ToLower().Contains("temp") Then - Return "LC_VAR_TEMP" - End If - If nature.ToLower().Contains("equi") Then - Return "LC_VAR_EQUIV" - End If - If nature.ToLower().Contains("accid") Then - Return "LC_ACCIDENTAL" - End If - If nature.ToLower().Contains("earthqua") OrElse nature.ToLower().Contains("seis") Then - Return "LC_EQE_ACC" - End If - Return "LC_PERM_SELF" - End Function - - Public Function SetLoadCase(ByVal iLoadCase As Integer, ByVal uid As String, ByVal name As String, ByVal nature As String) As Integer - - If (iLoadCase <= 0) Then - iLoadCase = Me.HighestLoadCase + 1 - End If - If String.IsNullOrEmpty(name) Then - name = "Load Case " + iLoadCase.ToString() - End If - Dim sGwaCommand As String = "" - sGwaCommand = "LOAD_TITLE:" - sGwaCommand += "{RVT:" & uid & "}" - sGwaCommand += "," + iLoadCase.ToString() 'case no - sGwaCommand += "," + name 'name - sGwaCommand += "," + NatureToGsaType(nature) 'nature - sGwaCommand += ",1,A,NONE,INC_BOTH" - m_GSAObject.GwaCommand(sGwaCommand) - Return iLoadCase - - End Function - Public Function LoadCase(ByVal iLoadCase As Integer, ByRef uid As String, ByRef name As String, ByRef nature As String) As Boolean - Try - Dim sGwaCommand As String = "", sResult As Integer = 0 - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,LOAD_TITLE," & iLoadCase.ToString)) - If String.IsNullOrEmpty(sGwaCommand.Trim()) Then - Return False - End If - Dim sArg As String = GsaComUtil.Arg(0, sGwaCommand) - Dim idString As String = GsaComUtil.ExtractId(sArg) - If Not String.IsNullOrEmpty(idString) Then - uid = idString - End If - name = GsaComUtil.Arg(2, sGwaCommand) - If String.IsNullOrEmpty(name.Trim()) Then - Return False - End If - nature = GsaComUtil.Arg(3, sGwaCommand) - Catch ex As Exception - Return False - End Try - - Return True - End Function - Public Function GridSurface(ByVal iGridSurf As Integer, ByRef uid As String, ByRef name As String, ByRef iGrid As Integer, ByRef elem2d As Boolean, ByRef bSpan2d As Boolean) As Boolean - Try - Dim sGwaCommand As String = "", sResult As Integer = 0 - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,GRID_SURFACE," & iGridSurf.ToString)) - Dim sArg As String = GsaComUtil.Arg(3, sGwaCommand) - If Integer.TryParse(sArg, sResult) Then - iGrid = sResult - End If - sArg = GsaComUtil.Arg(0, sGwaCommand) - Dim idString As String = GsaComUtil.ExtractId(sArg) - If Not String.IsNullOrEmpty(idString) Then - uid = idString - End If - - name = GsaComUtil.Arg(2, sGwaCommand) - - sArg = GsaComUtil.Arg(4, sGwaCommand) - elem2d = False - If Integer.TryParse(sArg, sResult) Then - If sResult = 2 Then - elem2d = True - End If - End If - sArg = GsaComUtil.Arg(7, sGwaCommand) - bSpan2d = True - If sArg = "ONE" Then - bSpan2d = False - End If - Return True - Catch ex As Exception - Return False - End Try - - - End Function - - Public Function ElementCord(ByVal iElem As Integer) As List(Of Integer) - Dim sName As String = "", iProp As Integer = 0, uid As String = "", sTopo As String = "", dBeta As Double = 0 - Dim sRelease As New List(Of String), dOffset As New List(Of Double()), typeMemb As MembType = MembType.BEAM - Dim eType As ElemType = ElemType.EL_BEAM - Dim iTopo As New List(Of Integer), iOrNode As Integer = 0 - Elem1d(iElem, sName, iProp, uid, iTopo, iOrNode, dBeta, sRelease, dOffset, eType, "") - Return iTopo - End Function - Public Function MembCord(ByVal iElem As Integer) As String - Dim sName As String = "", iProp As Integer = 0, uid As String = "", sTopo As String = "", dBeta As Double = 0 - Dim sRelease As New List(Of String), dOffset As New List(Of Double()), typeMemb As MembType = MembType.BEAM - Dim eType As ElemType = ElemType.EL_BEAM - Dim endRestraint1 As String = "" - Dim endRestraint2 As String = "" - Dim iOrNode As Integer = 0 - Member(iElem, sName, iProp, uid, sTopo, iOrNode, dBeta, sRelease, dOffset, typeMemb, endRestraint1, endRestraint2) - Return sTopo - End Function - Public Function RestraintType(ByVal release As String) As String - 'A pin joint is a connection between two objects that allows only relative - 'rotation about a single axis. All translations as well as rotations about - 'any other axis are prevented - release = release.ToUpper() - If (release.Equals("FFFFRR")) Then - Return "Pinned" - ElseIf (release.Equals("RRRRRR")) Then - Return "Free" - Else - Return "Fixed" - End If - End Function - 'write a GSA 1D element - Public Function SetMember(ByVal iElem As Integer, ByVal sName As String, ByVal iProp As Integer, - ByVal sID As String, ByVal sTopo As String, ByVal iOrNode As Integer, - ByVal dBeta As Double, ByVal sRelease As List(Of String), - ByVal dOffset As List(Of Double()), ByVal typeMemb As MembType, - ByVal endRestraint1 As String, ByVal endRestraint2 As String) As Integer - - If (iElem <= 0) Then - iElem = Me.HighestEnt("MEMB") + 1 - End If - 'MEMB0.8 | num | name | colour | type (1D) | prop | group | topology | node | angle | @end - 'mesh_size | is_intersector | analysis_type | fire | limit | time[4] | dummy | @End - 'is_rls { | rls { | k } } | restraint_end_1 | restraint_end_2 | AUTOMATIC | height | load_ref | @end - 'off_auto_x1 | off_auto_x2 | off_auto_internal | off_x1 | off_x2 | off_y | off_z | exposure@End - 'MEMB0.8 | num | name | colour | type (1D) | prop | group | topology | node | angle | @end - 'mesh_size | is_intersector | analysis_type | fire | time[4] | dummy | @End - 'is_rls { | rls { | k } } | restraint_end_1 | restraint_end_2 | EXPLICIT | nump | { point | rest | } | nums | { span | rest | } @end - 'height | load_ref | stud_layout | off_auto_x1 | off_auto_x2 | off_auto_internal | off_x1 | off_x2 | off_y | off_z | exposure @End - 'MEMB0.8 | num | name | colour | type (2D) | prop | group | topology | node | angle | @end - 'mesh_size | is_intersector | analysis_type | fire | time[4] | dummy | @End - 'off_auto_internal | off_z | exposure - - Dim b1D As Boolean = Not Is2D(typeMemb) - dBeta = Math.Round(dBeta, RoundPrecision) - 'Write beam element - Dim sGwaCommand As String = "" - sGwaCommand = "MEMB.8:" - sGwaCommand += "{RVT:" & sID & "}" - sGwaCommand += "," + iElem.ToString() 'number - sGwaCommand += "," + sName 'name - sGwaCommand += ",NO_RGB" 'colour - sGwaCommand += "," + MembTypeStr(typeMemb) 'member type - sGwaCommand += "," + "" 'exposed face - sGwaCommand += "," + iProp.ToString() 'section - sGwaCommand += ",1" 'group - sGwaCommand += "," + sTopo 'number of topo - sGwaCommand += "," + iOrNode.ToString() 'orientation node - sGwaCommand += "," + dBeta.ToString() 'orientation angle - sGwaCommand += ",1,NO" 'mesh size and mesh option + Intersector - If b1D Then - sGwaCommand += "," + "BEAM" 'Analysis type ID - Else - sGwaCommand += "," + "LINEAR" 'Analysis type 2D - End If - sGwaCommand += "," + "0,0.0,0,0,0,0" 'fire resistance, temperature, stages - sGwaCommand += ",ACTIVE" 'member status - If b1D Then - sGwaCommand += "," + sRelease(0) 'start release - sGwaCommand += "," + sRelease(1) 'end release - If (String.IsNullOrEmpty(endRestraint1)) Then - sGwaCommand += "," + RestraintType(sRelease(0)) 'fixity at end1 - Else - sGwaCommand += "," + endRestraint1 'fixity at end1 - End If - - If (String.IsNullOrEmpty(endRestraint2)) Then - sGwaCommand += "," + RestraintType(sRelease(1)) 'fixity at end1 - Else - sGwaCommand += "," + endRestraint2 'fixity at end2 - End If - - sGwaCommand += ",AUTOMATIC" 'Automatic(0) - sGwaCommand += ",0" 'load height - sGwaCommand += "," + CType(LoadPos.SHR_CENTRE, Integer).ToString() 'reference point - - sGwaCommand += ",YES" 'offset flag - sGwaCommand += ",MAN" 'manual offset - sGwaCommand += ",MAN" 'manual offset - - sGwaCommand += "," + dOffset.Item(0)(0).ToString() 'axial offset at start - sGwaCommand += "," + dOffset.Item(1)(0).ToString() 'axial offset at end - sGwaCommand += "," + dOffset.Item(0)(1).ToString() 'transaverse offset - sGwaCommand += "," + dOffset.Item(0)(2).ToString() 'transverse offset - Else - sGwaCommand += "," + dOffset.Item(0)(2).ToString() 'axial offset at start - sGwaCommand += ",NO" 'auto internal offset - End If - m_GSAObject.GwaCommand(sGwaCommand) - Return iElem - End Function - Public Function Member(ByVal iElem As Integer, ByRef sName As String, ByRef iProp As Integer, - ByRef uid As String, ByRef sTopo As String, ByRef iOrNode As Integer, ByRef dBeta As Double, - ByRef sRelease As List(Of String), ByRef dOffset As List(Of Double()), ByRef eMembType As GsaComUtil.MembType, ByRef endRestraint1 As String, ByRef endRestraint2 As String) As Boolean - - If _MemList.ContainsKey(iElem) Then - - Dim nEle As MemberElement = _MemList(iElem) - iElem = nEle.Element - sName = nEle.Name - iProp = nEle.SecPro - uid = nEle.UID - sTopo = nEle.sTopo - sRelease = nEle.Release - iOrNode = nEle.OrientationNode - dBeta = nEle.Beta - dOffset = nEle.Offset - eMembType = nEle.MemberType - endRestraint1 = nEle.Endrestraint1 - endRestraint2 = nEle.Endrestraint2 - Else - Try - If Not Me.EntExists("MEMB", iElem) Then - Return False - End If - uid = "" - dBeta = 0.0 - dOffset = New List(Of Double()) - sRelease = New List(Of String) - Dim sGwaCommand As String = "" - Dim sArg As String = "" - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,MEMB," & iElem.ToString)) - If String.IsNullOrEmpty(sGwaCommand) Then - Return False - End If - - 'MEMB.8 | num | name | colour | type (1D) | prop | group | topology | node | angle | @end - 'mesh_size | is_intersector | analysis_type | fire | limit | time[4] | dummy | @End - 'is_rls { | rls { | k } } | restraint_end_1 | restraint_end_2 | AUTOMATIC | height | load_ref | @end - 'off_auto_x1 | off_auto_x2 | off_auto_internal | off_x1 | off_x2 | off_y | off_z | exposure@End - 'MEMB0.8 | num | name | colour | type (1D) | prop | group | topology | node | angle | @end - 'mesh_size | is_intersector | analysis_type | fire | time[4] | dummy | @End - 'is_rls { | rls { | k } } | restraint_end_1 | restraint_end_2 | EXPLICIT | nump | { point | rest | } | nums | { span | rest | } @end - 'height | load_ref | stud_layout | off_auto_x1 | off_auto_x2 | off_auto_internal | off_x1 | off_x2 | off_y | off_z | exposure @End - 'MEMB0.8 | num | name | colour | type (2D) | prop | group | topology | node | angle | @end - 'mesh_size | is_intersector | analysis_type | fire | time[4] | dummy | @End - 'off_auto_internal | off_z | exposure - sArg = GsaComUtil.Arg(0, sGwaCommand) - Dim idString As String = GsaComUtil.ExtractId(sArg) - Dim moduleVesrion As String = ExtractVesrion(sArg) - - If Not String.IsNullOrEmpty(idString) Then - uid = idString - End If - Dim iNextIndex As Integer = 1 - sArg = GsaComUtil.Arg(1, sGwaCommand) 'number - Debug.Assert(Integer.Equals(iElem, CInt(sArg))) - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'name - sName = sArg - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'color - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'member type - eMembType = MembTypeFromStr(sArg) - - Dim b1D As Boolean = Not Is2D(eMembType) - - iNextIndex = iNextIndex + 1 ' exposed face - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'member section property - iProp = CInt(sArg) - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'group - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'string of topo - sTopo = sArg - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'orientation node - iOrNode = CInt(sArg) - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'beta - dBeta = CDbl(sArg) - - - iNextIndex = iNextIndex + 1 'mesh size - - iNextIndex = iNextIndex + 1 'Intersector - - iNextIndex = iNextIndex + 1 'analysis type - - iNextIndex = iNextIndex + 1 'fire - iNextIndex = iNextIndex + 1 'limiting temperature - iNextIndex = iNextIndex + 1 'time 1 - iNextIndex = iNextIndex + 1 'time 2 - iNextIndex = iNextIndex + 1 'time 3 - iNextIndex = iNextIndex + 1 'time 4 - iNextIndex = iNextIndex + 1 'dummy - - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'dummy - Dim bDummy As Boolean = False - If sArg.Equals("DUMMY") Then - bDummy = True - Else - bDummy = False - End If - If b1D Then - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'release 0 - For Each c As Char In sArg - If c.Equals("K") Then - iNextIndex = iNextIndex + 1 - End If - Next - sRelease.Add(sArg) - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'release 1 - For Each c As Char In sArg - If c.Equals("K") Then - iNextIndex = iNextIndex + 1 - End If - Next - sRelease.Add(sArg) - - iNextIndex = iNextIndex + 1 'connection 1 - endRestraint1 = GsaComUtil.Arg(iNextIndex, sGwaCommand) - - iNextIndex = iNextIndex + 1 'connection 2 - endRestraint2 = GsaComUtil.Arg(iNextIndex, sGwaCommand) - - iNextIndex = iNextIndex + 1 - - 'steel member - Dim restraintOption As Integer = RestraintOptID(Arg(iNextIndex, sGwaCommand)) - If restraintOption.Equals(1) Then 'explicit - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) - Dim nPoint As Integer = 0 - Integer.TryParse(sArg, nPoint) - For value As Integer = 0 To nPoint - 1 - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'point - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'restraint description - Next - 'for span - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) - nPoint = 0 : Integer.TryParse(sArg, nPoint) - For value As Integer = 0 To nPoint - 1 - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'span - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'span's restraint description - Next - - ElseIf restraintOption.Equals(2) Then 'effective length - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'Lyy - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'Lzz - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'Llt - - End If - - iNextIndex = iNextIndex + 1 - - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'load height - Dim Loadheight As Double = CDbl(sArg) - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'Ref point - Dim RefPoint As String = sArg - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'offset - - If sArg.Equals("OFF") Then - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'offset type 1 - Dim OffsetType1 As String = sArg - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'offset type 2 - Dim OffsetType2 As String = sArg - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'x1 - Dim X1 As Double = CDbl(sArg) - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'x2 - Dim X2 As Double = CDbl(sArg) - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'y - Dim y As Double = CDbl(sArg) - - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'z - Dim z As Double = CDbl(sArg) - Dim offset0() As Double = {X1, y, z} - Dim offset1() As Double = {X2, y, z} - dOffset.Add(offset0) - dOffset.Add(offset1) - Else - dOffset.Add({0, 0, 0}) - dOffset.Add({0, 0, 0}) - - End If - Else - iNextIndex = iNextIndex + 1 - sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'z - iNextIndex = iNextIndex + 1 'auto internal offset - Dim z As Double = CDbl(sArg) - Dim offset0() As Double = {0, 0, z} - Dim offset1() As Double = {0, 0, z} - dOffset.Add(offset0) - dOffset.Add(offset1) - End If - - - Dim nEle As New MemberElement - nEle.Element = iElem - nEle.Name = sName - nEle.SecPro = iProp - nEle.UID = uid - nEle.sTopo = sTopo - nEle.Beta = dBeta - nEle.Offset = dOffset - nEle.MemberType = eMembType - nEle.Release = sRelease - nEle.OrientationNode = iOrNode - 'GSA-5631 - nEle.Endrestraint1 = endRestraint1 - nEle.Endrestraint2 = endRestraint2 - _MemList.Add(iElem, nEle) - - Catch ex As Exception - Return False - End Try - End If - Return True - End Function - - Public Function SetElem1d(ByVal iElem As Integer, ByVal name As String, ByVal iProp As Integer, ByVal sID As String, - ByVal iTopoList As List(Of Integer), ByVal iOrNode As Integer, ByVal dBeta As Double, - ByVal sRelease As List(Of String), ByVal dOffset As List(Of Double()), ByVal type As ElemType, Optional ByVal strDummy As String = "") As Integer - - ' EL.4 | num | name | colour | type | prop | group | topo() | orient_node | orient_angle | @br - ' is_rls { | rls { | k } } - ' off_x1 | off_x2 | off_y | off_z | parent_member | dummy @end - - Dim sGwaCommand As String = "" - Dim clr As Color = Color.Black() - - If (iElem <= 0) Then - iElem = Me.HighestEnt("EL") + 1 - End If - 'round - dBeta = Math.Round(dBeta, RoundPrecision) - sGwaCommand = "EL:" - sGwaCommand += "{RVT:" & sID & "}" - sGwaCommand += "," + iElem.ToString() 'number - sGwaCommand += "," + name 'name - sGwaCommand += "," + clr.ToArgb().ToString() 'color - sGwaCommand += "," + ElemDesc(type) 'element type - sGwaCommand += "," + iProp.ToString() 'property - sGwaCommand += ",1" 'group - For Each topo As String In iTopoList - sGwaCommand += "," + topo 'topo - Next - sGwaCommand += "," + iOrNode.ToString() 'orientation node - sGwaCommand += "," + dBeta.ToString() 'orientation angle - sGwaCommand += "," + "RLS" 'is_rls - - For Each rels As String In sRelease - sGwaCommand += "," + rels 'topo - For Each c As Char In rels - If c.Equals("K") Then - sGwaCommand += ",1.0" - End If - Next - Next - - If dOffset.Count > 1 Then - sGwaCommand += "," + dOffset(0)(0).ToString() 'X1 - sGwaCommand += "," + dOffset(1)(0).ToString() 'X2 - sGwaCommand += "," + dOffset(0)(1).ToString() 'Y - sGwaCommand += "," + dOffset(0)(2).ToString() 'Z - Else - sGwaCommand += ",0" 'X1 - sGwaCommand += ",0" 'X2 - sGwaCommand += ",0" 'Y - sGwaCommand += ",0" 'Z - End If - sGwaCommand += "," + strDummy - m_GSAObject.GwaCommand(sGwaCommand) - - Return iElem - End Function - - - 'read a GSA 1D element - Public Function Elem1d(ByVal iElem As Integer, ByRef name As String, ByRef iProp As Integer, ByRef uid As String, - ByRef iTopoList As List(Of Integer), ByRef iOrNode As Integer, ByRef dBeta As Double, - ByRef sRelease As List(Of String), ByRef dOffset As List(Of Double()), ByRef elemType As ElemType, - ByRef strDummy As String) As Boolean - - ' EL.4 | num | name | colour | type | prop | group | topo() | orient_node | orient_angle | @br - ' is_rls { | rls { | k } } - ' off_x1 | off_x2 | off_y | off_z | parent_member | dummy @end - - If _EleList.ContainsKey(iElem) Then - Dim nEle As MemberElement = _EleList(iElem) - iElem = nEle.Element - name = nEle.Name - iProp = nEle.SecPro - uid = nEle.UID - iTopoList = nEle.Topo - - dBeta = nEle.Beta - sRelease = nEle.Release - dOffset = nEle.Offset - iOrNode = nEle.OrientationNode - strDummy = nEle.Dummy - elemType = nEle.ElementType - Else - iTopoList = New List(Of Integer) - dOffset = New List(Of Double()) - sRelease = New List(Of String) - - If Not Me.EntExists("EL", iElem) Then - Return False - End If - - Dim sGwaCommand As String = "" - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,EL," & iElem.ToString)) - - If String.IsNullOrEmpty(sGwaCommand) Then - Return False - End If - - Dim sArg As String - uid = "" - sArg = GsaComUtil.Arg(0, sGwaCommand) - Dim idString As String = GsaComUtil.ExtractId(sArg) - If Not String.IsNullOrEmpty(idString) Then - uid = idString - End If - - name = GsaComUtil.Arg(2, sGwaCommand) - - sArg = GsaComUtil.Arg(4, sGwaCommand) - elemType = Me.ElemTypeFromString(sArg) - - If Not GsaComUtil.ElemTypeIsBeamOrTruss(elemType) Then - Return False - End If - - sArg = GsaComUtil.Arg(1, sGwaCommand) 'number - Debug.Assert(Integer.Equals(iElem, CInt(sArg))) - sArg = GsaComUtil.Arg(5, sGwaCommand) 'property - - 'https://ovearup.atlassian.net/browse/GSA-5998 - Dim splitProperty As String() = sArg.Split("["c) - iProp = CInt(splitProperty(0)) - - sArg = GsaComUtil.Arg(7, sGwaCommand) 'topo 0 - iTopoList.Add(CInt(sArg)) - - sArg = GsaComUtil.Arg(8, sGwaCommand) 'topo 1 - iTopoList.Add(CInt(sArg)) - - sArg = GsaComUtil.Arg(9, sGwaCommand) 'orientation node - Integer.TryParse(sArg, iOrNode) - sArg = GsaComUtil.Arg(10, sGwaCommand) 'orientation angle - Double.TryParse(sArg, dBeta) - - Dim position As Integer = 11 - 'releases - sArg = GsaComUtil.Arg(position, sGwaCommand) - If String.Equals("RLS", sArg) Then - - position += 1 - sArg = GsaComUtil.Arg(position, sGwaCommand) 'release 0 - For Each c As Char In sArg - If c.Equals("K") Then - position += 1 - End If - Next - sRelease.Add(sArg) - position += 1 - sArg = GsaComUtil.Arg(position, sGwaCommand) 'release 1 - For Each c As Char In sArg - If c.Equals("K") Then - position += 1 - End If - Next - sRelease.Add(sArg) - Else - sRelease.Add("FFFFFF") - sRelease.Add("FFFFFF") - End If - - 'offsets - position += 1 - Dim dOff() As Double = New Double() {0, 0, 0, 0} - sArg = GsaComUtil.Arg(position, sGwaCommand) 'offset 0, X1 - Dim X1 As Double = Val(sArg) - - position += 1 - sArg = GsaComUtil.Arg(position, sGwaCommand) 'offset 0, X2 - Dim X2 As Double = Val(sArg) - - position += 1 - sArg = GsaComUtil.Arg(position, sGwaCommand) 'offset 0, Y - Dim Y As Double = Val(sArg) - - position += 1 - sArg = GsaComUtil.Arg(position, sGwaCommand) 'offset 0, Z - Dim Z As Double = Val(sArg) - - Dim dOff_i() As Double = New Double() {0, 0, 0} - dOff_i(0) = X1 - dOff_i(1) = Y - dOff_i(2) = Z - dOffset.Add(dOff_i) - - Dim dOff_j() As Double = New Double() {0, 0, 0} - dOff_j(0) = X2 - dOff_j(1) = Y - dOff_j(2) = Z - dOffset.Add(dOff_j) - - position += 1 - strDummy = GsaComUtil.Arg(position, sGwaCommand) - - Dim nEle As MemberElement = New MemberElement() - nEle.Element = iElem - nEle.Name = name - nEle.SecPro = iProp - nEle.UID = uid - nEle.Topo = iTopoList - ' nEle.OrientationNode = iOrNode - nEle.Beta = dBeta - nEle.Release = sRelease - nEle.Offset = dOffset - nEle.Dummy = strDummy - nEle.OrientationNode = iOrNode - nEle.ElementType = elemType - _EleList.Add(iElem, nEle) - End If - Return True - End Function - - Public Function Prop2D(ByVal i2dprop As Integer, ByRef sidFromGsa As String, ByRef usage As SectionUsage, ByRef name As String, ByRef description As String, ByRef ematType As MembMat, ByRef iMat As Integer, ByRef eType As Type2D) As Boolean - ' PROP_2D.8 | num | name | colour | type | axis | mat | mat_type | grade | design | profile | ref_pt | ref_z | - ' mass | flex | shear | inplane | weight | @end - Try - - Dim sGwaCommand As String = CStr(m_GSAObject.GwaCommand("GET,PROP_2D," & i2dprop.ToString)) - Dim sArg As String = GsaComUtil.Arg(0, sGwaCommand) - usage = SectionUsage.INVALID - Dim sidList As New SortedList(Of String, String) - Dim sid_string As String = GsaComUtil.ExtractId(sArg) - Me.ParseNestedSid(sid_string, sidList) - If sidList.ContainsKey(GsaComUtil.SectionSid_Usage) Then - Dim usageString As String = sidList(GsaComUtil.SectionSid_Usage) - If String.Equals(usageString, SectionUsage.COLUMNS.ToString()) Then - usage = SectionUsage.COLUMNS - ElseIf String.Equals(usageString, SectionUsage.FRAMING.ToString()) Then - usage = SectionUsage.FRAMING - ElseIf String.Equals(usageString, SectionUsage.SLAB.ToString()) Then - usage = SectionUsage.SLAB - ElseIf String.Equals(usageString, SectionUsage.WALL.ToString()) Then - usage = SectionUsage.WALL - End If - Else - usage = SectionUsage.INVALID ' for now - End If - - If sidList.ContainsKey(GsaComUtil.SectionSid_Symbol) Then - sidFromGsa = sidList(GsaComUtil.SectionSid_Symbol) - End If - - name = GsaComUtil.Arg(2, sGwaCommand) - sArg = GsaComUtil.Arg(4, sGwaCommand) - eType = Type2DFromStr(sArg) - Dim iIndex As Integer = 6 - sArg = GsaComUtil.Arg(iIndex, sGwaCommand) - Dim nLayer As Integer = CType(sArg, Integer) - If nLayer < 0 Then - iIndex = iIndex + 3 * Math.Abs(nLayer) - Else - iIndex = iIndex + 1 - End If - sArg = GsaComUtil.Arg(iIndex, sGwaCommand) - ematType = MembMatFromStr(sArg) - - iIndex = iIndex + 1 - sArg = GsaComUtil.Arg(iIndex, sGwaCommand) - iMat = CType(sArg, Integer) - - iIndex = iIndex + 2 - description = GsaComUtil.Arg(iIndex, sGwaCommand) - Catch ex As Exception - Return False - End Try - Return True - End Function - Public Function IsEqual(ByRef pt1 As Double(), ByRef pt2 As Double()) As Boolean - Dim bEqual As Boolean = False - bEqual = IsEqual(pt1(0), pt2(0), 0.01) - If bEqual.Equals(False) Then - Return False - End If - bEqual = IsEqual(pt1(1), pt2(1), 0.01) - If bEqual.Equals(False) Then - Return False - End If - bEqual = IsEqual(pt1(2), pt2(2), 0.01) - If bEqual.Equals(False) Then - Return False - End If - Return bEqual - End Function - - Public Function SetSection(ByVal iSec As Integer, ByVal sName As String, ByVal uid As String, ByVal usage As SectionUsage, - ByVal iAnalysisMat As Integer, ByVal sDesc As String, ByVal eMatType As MembMat, - ByVal justification As String, Optional ByVal bNameMap As Boolean = False, Optional ByVal bDescMap As Boolean = False) As Integer - '// PROP_SEC.3 | num | name | colour | mat | grade | anal | desc | cost @end - Dim sGwaCommand As String = "" - If (iSec <= 0) Then - iSec = HighestSection() + 1 - End If - Dim sid As String = "{" & GsaComUtil.SectionSid_Symbol & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" - If (bDescMap) Then - sid = "{" & "DESCRIPTION" & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" - End If - If (bNameMap) Then - sid = "{" & "NAME" & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" - End If - - sGwaCommand = "PROP_SEC:" - sGwaCommand += "{RVT:" & sid & "}" - sGwaCommand += "," & iSec.ToString() 'number - sGwaCommand += "," & sName 'name - sGwaCommand += ",NO_RGB" 'colour - sGwaCommand += "," & MembMatStr(eMatType) 'material type - sGwaCommand += "," & iAnalysisMat.ToString() 'analysis material - sGwaCommand += ",0" 'grade - sGwaCommand += "," & sDesc 'description - sGwaCommand += ",0" 'cost - sGwaCommand += "," & justification 'justification - sGwaCommand += ",0,0" 'offset - m_GSAObject.GwaCommand(sGwaCommand) - Return iSec - End Function - - - Public Function SetSectionSid(ByVal iSec As Integer, ByVal uid As String, ByVal usage As SectionUsage, Optional ByVal bNameMap As Boolean = False, Optional ByVal bDescMap As Boolean = False) As Boolean - Dim sid As String = "{" & GsaComUtil.SectionSid_Symbol & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" - If (bDescMap) Then - sid = "{" & "DESCRIPTION" & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" - End If - If (bNameMap) Then - sid = "{" & "NAME" & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" - End If - Return Me.SetSid("PROP_SEC", iSec, sid) - End Function - - Public Function SetSectionSid2D(ByVal iSec As Integer, ByVal uid As String, ByVal usage As SectionUsage) As Boolean - Dim sid As String = "{" & GsaComUtil.SectionSid_Symbol & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" - Return Me.SetSid("PROP_2D", iSec, sid) - End Function - 'read a GSA Section - Public Function Section(ByVal iSec As Integer, ByRef sName As String, ByRef sid As String, ByRef usage As GsaComUtil.SectionUsage, ByRef iAnalysisMat As Integer, ByRef sDesc As String, ByRef eMatType As GsaComUtil.MembMat, ByRef justification As String, Optional ByRef MapOp As String = "") As Boolean - - Try - If _SecList.ContainsKey(iSec) Then - Dim gsaSec As GSASection = _SecList(iSec) - iSec = gsaSec.Number - sName = gsaSec.Name - sid = gsaSec.Sid - usage = CType(gsaSec.SecUsage, SectionUsage) - sDesc = gsaSec.Desc - iAnalysisMat = gsaSec.AnalysisMat - MapOp = gsaSec.MapOp - eMatType = gsaSec.MaterialType - justification = gsaSec.justification - Else - 'PROP_SEC.3 | num | name | colour | mat | grade | anal | desc | cost @end - If Not SectionExists(iSec) Then - Return False - End If - Dim gsaSec As New GSASection() - Dim sGwaCommand As String = "" - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,PROP_SEC," & iSec.ToString)) - If String.IsNullOrEmpty(sGwaCommand) Then - Return False - End If - - Dim sArg As String - sArg = GsaComUtil.Arg(0, sGwaCommand) - Dim sidList As New SortedList(Of String, String) - Dim sid_string As String = GsaComUtil.ExtractId(sArg) - Me.ParseNestedSid(sid_string, sidList) - - If sidList.ContainsKey(GsaComUtil.SectionSid_Usage) Then - Dim usageString As String = sidList(GsaComUtil.SectionSid_Usage) - If String.Equals(usageString, SectionUsage.COLUMNS.ToString()) Then - usage = SectionUsage.COLUMNS - ElseIf String.Equals(usageString, SectionUsage.FRAMING.ToString()) Then - usage = SectionUsage.FRAMING - End If - Else - usage = SectionUsage.INVALID ' for now - End If - gsaSec.SecUsage = usage - If sidList.ContainsKey(GsaComUtil.SectionSid_Symbol) Then - sid = sidList(GsaComUtil.SectionSid_Symbol) - End If - MapOp = "SID" - If sidList.ContainsKey("DESCRIPTION") Then - MapOp = "DESC" - sid = sidList("DESCRIPTION") - End If - If sidList.ContainsKey("NAME") Then - MapOp = "NAME" - sid = sidList("NAME") - End If - gsaSec.Sid = sid - gsaSec.MapOp = MapOp - - sArg = GsaComUtil.Arg(1, sGwaCommand) 'number - Debug.Assert(Integer.Equals(iSec, CInt(sArg))) - gsaSec.Number = iSec - sArg = GsaComUtil.Arg(2, sGwaCommand) 'name - sName = sArg - gsaSec.Name = sName - - sArg = GsaComUtil.Arg(4, sGwaCommand) 'material type - eMatType = MembMatFromStr(sArg) - gsaSec.MaterialType = eMatType - - sArg = GsaComUtil.Arg(5, sGwaCommand) 'Analysis material - iAnalysisMat = CInt(sArg) - gsaSec.AnalysisMat = iAnalysisMat - - sArg = GsaComUtil.Arg(7, sGwaCommand) 'description - sDesc = sArg.Replace("%", " ") - gsaSec.Desc = sDesc - - justification = GsaComUtil.Arg(9, sGwaCommand) 'justification - gsaSec.justification = justification - _SecList.Add(iSec, gsaSec) - End If - Catch ex As Exception - Return False - End Try - Return True - End Function - Function Is2D(ByVal type As MembType) As Boolean - If type.Equals(MembType.GENERIC_2D) OrElse type.Equals(MembType.WALL) OrElse type.Equals(MembType.SLAB) Then - Return True - End If - Return False - End Function - Function SectionUsageType(ByVal b2D As Boolean, ByVal strEnt As String, ByVal iSecNum As Integer, ByVal strVert As String, ByVal strInc As String, ByVal bFromMemeb As Boolean) As SectionUsage - - Dim iHgstelem As Integer = HighestEnt(strEnt) - Dim iEnt As Integer - Dim bFram As Boolean = False - Dim bColm As Boolean = False - Dim bSlab As Boolean = False - Dim bWall As Boolean = False - - - For iEnt = 1 To iHgstelem - - Dim iProp As Integer = 1, uID As String = "" - Dim iOrNode As Integer = 0, dBeta As Double = 0 - Dim sRelease As List(Of String) = Nothing - Dim dOffset As List(Of Double()) = Nothing - Dim eMembtype As MembType = MembType.UNDEF - Dim eMembMattype As MembMat = MembMat.UNDEF - - Dim eletype As ElemType = ElemType.EL_BAR - - Dim sName As String = "", sEleList As String = "" - Dim x As Double = 0.0, y As Double = 0.0, z As Double = 0.0 - Dim x1 As Double = 0.0, y1 As Double = 0.0, z1 As Double = 0.0 - Dim strDummy As String = "" - Dim dFacetval As Double = 0 - Dim iGeom As Integer = 0 - Dim dRadius As Double = 0 - Dim iTopo2 As Integer = 0 - Dim endRestraint1 As String = "" - Dim endRestraint2 As String = "" - ' Dim Mat As GsaComUtil.MembMat - Dim bOut As Boolean = False - Dim iTopoList As New List(Of Integer) - Dim sTopo As String = "" - Dim eEntType As EntType = EntType.SEL_MEMBER - If "MEMB" = strEnt Then - bOut = Member(iEnt, sName, iProp, uID, sTopo, iOrNode, dBeta, sRelease, dOffset, eMembtype, endRestraint1, endRestraint2) - eEntType = EntType.SEL_MEMBER - If Not bOut Then - Continue For - End If - If Not b2D.Equals(Is2D(eMembtype)) Then - Continue For - End If - Else - eEntType = EntType.SEL_ELEM - bOut = Elem1d(iEnt, sName, iProp, uID, iTopoList, iOrNode, dBeta, sRelease, dOffset, eletype, strDummy) - If Not bOut Then - Continue For - End If - If Not ElemTypeIsBeamOrTruss(eletype) Then - Continue For - End If - End If - - If (iProp <> iSecNum) Then - Continue For - End If - - - Dim bVertical As Boolean = EntIsVertical(iEnt, eEntType) - Dim bHoriZontal As Boolean = EntIsHorizontal(iEnt, eEntType) - If b2D Then - bVertical = Not bHoriZontal - End If - - If (bFromMemeb) Then - If eMembtype.Equals(MembType.BEAM) Then - bFram = True - Continue For - ElseIf eMembtype.Equals(MembType.COLUMN) Then - bColm = True - Continue For - ElseIf eMembtype.Equals(MembType.SLAB) Then - bSlab = True - Continue For - ElseIf eMembtype.Equals(MembType.WALL) Then - bWall = True - Continue For - End If - Else - If bVertical Then - If strVert.Contains("Columns") Then - bColm = True - Else - bFram = True - End If - bWall = True - Else - If bHoriZontal Then - 'horizontal - bFram = True - Else - 'inclined - If strInc.Contains("Columns") Then - bColm = True - Else - bFram = True - End If - End If - bSlab = True - End If - End If - - If b2D Then - If bSlab AndAlso bWall Then - Return SectionUsage.INVALID - End If - Else - If bFram AndAlso bColm Then - Return SectionUsage.INVALID - End If - End If - Next - - Dim iFram As Integer = 1 - Dim iColm As Integer = 2 - Dim iSlab As Integer = 3 - Dim iWall As Integer = 4 - If b2D Then - If bSlab AndAlso bWall Then - Return SectionUsage.INVALID - End If - If (bSlab) Then - Return SectionUsage.SLAB - End If - If (bWall) Then - Return SectionUsage.WALL - End If - Else - If bFram AndAlso bColm Then - Return SectionUsage.INVALID - End If - If (bFram) Then - Return SectionUsage.FRAMING - End If - If (bColm) Then - Return SectionUsage.COLUMNS - End If - End If - Return SectionUsage.NOT_USED - - End Function - - Public Shared Function IsEqual(ByVal d1 As Double, ByVal d2 As Double, ByVal Tol As Double) As Boolean - If Abs(d1 - d2) < Tol Then - Return True - Else - Return False - End If - End Function - - Public Function EntIsVertical(ByVal element As Integer, ByVal eType As EntType) As Boolean - Dim iResult As Boolean = CType(m_GSAObject.ElemIsVertical(element, eType), Boolean) - Return iResult - End Function - Public Function EntIsHorizontal(ByVal element As Integer, ByVal eType As EntType) As Boolean - Dim iResult As Boolean = CType(m_GSAObject.ElemIsHorizontal(element, eType), Boolean) - Return iResult - - End Function - Public Function IsVertical(ByVal element As Integer) As Boolean - If (_IsVet.ContainsKey(element)) Then - Return _IsVet(element) - Else - Dim iResult As Integer = m_GSAObject.ElemIsVertical(element, m_eSelType) - _IsVet.Add(element, CType(iResult, Boolean)) - Return CType(iResult, Boolean) - End If - End Function - Public Function IsHorizontal(ByVal element As Integer) As Boolean - If (_IsHoz.ContainsKey(element)) Then - Return _IsHoz(element) - Else - Dim iResult As Integer = m_GSAObject.ElemIsHorizontal(element, m_eSelType) - _IsHoz.Add(element, CType(iResult, Boolean)) - Return CType(iResult, Boolean) - End If - End Function - Public Function SetProp2D(ByVal iProp As Integer, ByVal uid As String, ByVal usage As GsaComUtil.SectionUsage, ByVal sName As String, ByVal description As String, ByVal eType As Type2D, ByVal eMaterType As GsaComUtil.MembMat, ByVal iMat As Integer) As Integer - 'PROP_2D.8 | num | name | colour | type | axis | mat | mat_type | grade | design | profile | ref_pt | ref_z | - 'mass | flex | shear | inplane | weight | @end - If (iProp <= 0) Then - iProp = HighestProp2d() + 1 - End If - sName = sName.Replace("""", String.Empty) - Dim sid As String = "{" & GsaComUtil.SectionSid_Symbol & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" - Dim sGwaCommand As String = "PROP_2D:" - sGwaCommand += "{RVT:" & sid & "}" + "," - sGwaCommand += iProp.ToString() + "," - sGwaCommand += sName + "," - sGwaCommand += "NO_RGB," 'colour - sGwaCommand += eType.ToString() + "," ' 2D element type - sGwaCommand += "GLOBAL," - sGwaCommand += "0," ' analysis material - sGwaCommand += eMaterType.ToString() + "," - sGwaCommand += iMat.ToString() + "," 'undefined - sGwaCommand += "0," 'slab design peoperty - sGwaCommand += description + "," - sGwaCommand += "CENTROID," 'refrence point centroid - sGwaCommand += "0.0," 'set defuault offset to 0 - sGwaCommand += "0.0,100%,100%,100%,100%" - m_GSAObject.GwaCommand(sGwaCommand) - Return iProp - End Function - 'write a GSA Material - Public Function SetMaterial(ByVal iMat As Integer, ByVal sName As String, ByVal sid As String, ByVal sDesc As String, - ByVal dE As Double, ByVal dNu As Double, ByVal dG As Double, ByVal dRho As Double, ByVal dAlpha As Double, - ByVal dDamp As Double) As Integer - Dim sGwaCommand As String = "" - - If (iMat <= 0) Then - iMat = HighestMaterial() + 1 - End If - ' ++ - 'MAT_ANAL | num | MAT_ELAS_ISO | name | colour | 6 | E | nu | rho | alpha | G | damp | 0 | 0 | env | rebar | - 'country | variant | grade | eE | eCO2 | recycle | user | - '{ country | variant | grade | eE | eCO2 | recycle | user } - sGwaCommand = "MAT_ANAL:" - sGwaCommand += "{RVT:" & sid & "}" - sGwaCommand += "," & iMat.ToString() 'number - sGwaCommand += ",MAT_ELAS_ISO" '@desc - sGwaCommand += "," & sName 'name - sGwaCommand += ",NO_RGB" 'color - sGwaCommand += ",6" 'number of parameter - sGwaCommand += "," & dE.ToString - sGwaCommand += "," & dNu.ToString - sGwaCommand += "," & dRho.ToString - sGwaCommand += "," & dAlpha.ToString - sGwaCommand += "," & dG.ToString - sGwaCommand += "," & dDamp.ToString - sGwaCommand += ",0,0" - m_GSAObject.GwaCommand(sGwaCommand) - Return iMat - End Function - - 'read a GSA Material - Public Function Material(ByVal iMat As Integer, ByRef sName As String, ByRef sid As String, ByRef sDesc As String, - ByRef dE As Double, ByRef dNu As Double, ByRef dG As Double, ByRef dRho As Double, ByRef dAlpha As Double, - ByRef dDamp As Double) As Boolean - If Not MaterialExists(iMat) Then - Return False - End If - ' ++ - 'MAT_ANAL | num | MAT_ELAS_ISO | name | colour | 6 | E | nu | rho | alpha | G | damp | 0 | 0 | env | rebar | - 'country | variant | grade | eE | eCO2 | recycle | user | - '{ country | variant | grade | eE | eCO2 | recycle | user } - - Dim sGwaCommand As String = "" - Dim sArg As String - - sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,MAT_ANAL," & iMat.ToString)) - If String.IsNullOrEmpty(sGwaCommand) Then - Return False - End If - Dim iCount As Integer = 0 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) - sid = GsaComUtil.ExtractId(sArg) ' sid - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) 'number - Debug.Assert(Integer.Equals(iMat, CInt(sArg))) - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) 'description - sDesc = sArg - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) 'name - sName = sArg - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) 'color - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) 'num parameter - - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) - dE = Val(sArg) - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) - dNu = Val(sArg) - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) - dRho = Val(sArg) - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) - dAlpha = Val(sArg) - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) - dG = Val(sArg) - - iCount = iCount + 1 - sArg = GsaComUtil.Arg(iCount, sGwaCommand) - dDamp = Val(sArg) - - Return True - - End Function - Function RestraintOptID(ByVal opt As String) As Integer - Dim iOption As Integer = 0 - Select Case opt - Case "AUTOMATIC", "0" - iOption = 0 - Case "EXPLICIT", "1" - iOption = 1 - Case "EFF_LEN", "2" - iOption = 2 - Case Else - iOption = 0 - End Select - Return iOption - End Function - Function ElemTypeFromString(ByVal sKey As String) As ElemType - - ' strip the string of sid if any - If sKey.Contains(":") Then - sKey = sKey.Substring(0, sKey.IndexOf(":")) - End If - ' Get the element type corresponding to a keyword - Dim etype As ElemType = ElemType.EL_UNDEF - - Select Case sKey - Case "MEMB", "MEMB" - etype = ElemType.EL_BEAM - Case "BEAM" - etype = ElemType.EL_BEAM - Case "BAR" - etype = ElemType.EL_BAR - Case "TIE" - etype = ElemType.EL_TIE - Case "STRUT" - etype = ElemType.EL_STRUT - Case "SPRING" - etype = ElemType.EL_SPRING - Case "LINK" - etype = ElemType.EL_LINK - Case "CABLE" - etype = ElemType.EL_CABLE - Case "QUAD4" - etype = ElemType.EL_QUAD4 - Case "QUAD8" - etype = ElemType.EL_QUAD8 - Case "TRI3" - etype = ElemType.EL_TRI3 - Case "TRI6" - etype = ElemType.EL_TRI6 - Case Else - etype = ElemType.EL_UNDEF - End Select - - Return etype - End Function - - Public Sub SetGsaModelUnits(ByVal units As GsaComUtil.Units) - Select Case units - Case GsaComUtil.Units.IMPERIAL - m_GSAObject.GwaCommand("UNIT_DATA,FORCE,lbf") - m_GSAObject.GwaCommand("UNIT_DATA,LENGTH,ft") 'used for section property unit conversion: A, I... - m_GSAObject.GwaCommand("UNIT_DATA,DISP,in") 'Gen_SectionMatchDesc uses the DISP units for interpreting general section dimensions - m_GSAObject.GwaCommand("UNIT_DATA,SECTION,in") - m_GSAObject.GwaCommand("UNIT_DATA,MASS,lb") - m_GSAObject.GwaCommand("UNIT_DATA,TIME,s") - m_GSAObject.GwaCommand("UNIT_DATA,TEMP,°F") - m_GSAObject.GwaCommand("UNIT_DATA,STRESS,kip/in²") - m_GSAObject.GwaCommand("UNIT_DATA,ACCEL,ft/s²") - Case GsaComUtil.Units.METRIC - m_GSAObject.GwaCommand("UNIT_DATA,FORCE,N") - m_GSAObject.GwaCommand("UNIT_DATA,LENGTH,m") 'used for section property unit conversion: A, I... - m_GSAObject.GwaCommand("UNIT_DATA,DISP,m") 'Gen_SectionMatchDesc uses the DISP units for interpreting general section dimensions - m_GSAObject.GwaCommand("UNIT_DATA,SECTION,m") - m_GSAObject.GwaCommand("UNIT_DATA,MASS,kg") - m_GSAObject.GwaCommand("UNIT_DATA,TIME,s") - m_GSAObject.GwaCommand("UNIT_DATA,TEMP,°F") - m_GSAObject.GwaCommand("UNIT_DATA,STRESS,N/m²") - m_GSAObject.GwaCommand("UNIT_DATA,ACCEL,m/s²") - End Select - End Sub - Public Function GetGsaModelUnit(ByVal units As String) As String - Dim commandObj As Object = m_GSAObject.GwaCommand("GET,UNIT_DATA," + units.ToUpper()) - If commandObj Is Nothing Then - Return "" - End If - Dim commandResult As String = commandObj.ToString() - Return GsaComUtil.Arg(2, commandResult) - End Function - ''' - ''' CAUTION: Special function for use ONLY for setting material units - ''' - ''' - ''' - Public Sub SetGsaTemporaryUnitsMaterial(ByRef unitStrings As String()) - ' for setting material bizzare unit factors only - For Each unitString As String In unitStrings - m_GSAObject.GwaCommand(unitString) - Next - End Sub - Function ListName(ByVal iList As Integer) As String - 'LIST | num | name | type | list - If Not Me.ListExists(iList) Then - Return Nothing - End If - Dim result As String = CStr(m_GSAObject.GwaCommand("GET,LIST," & iList.ToString())) - Dim parts As String() = result.Split(New Char() {","c}) - Debug.Assert(parts.Length > 2) - Return parts(2) - - End Function - Public Function ListToString(ByRef lists As List(Of Integer)) As String - Dim cStrItem As String = "" - For Each it As Integer In lists - cStrItem = cStrItem + " " + it.ToString() - Next - Return cStrItem.Trim() - End Function - Public Function ListToArcString(ByRef lists As List(Of Integer)) As String - Debug.Assert(lists.Count.Equals(3)) - Dim cStrItem As String = lists(0).ToString() + " a " + lists(1).ToString() + " " + lists(2).ToString() - Return cStrItem.Trim() - End Function - Public Sub StringTolist(ByVal sTopo As String, ByRef orderedNodes As List(Of List(Of Integer)), ByRef arcNode As List(Of Integer), ByRef voids As List(Of List(Of Integer))) - - orderedNodes = New List(Of List(Of Integer)) - arcNode = New List(Of Integer) - voids = New List(Of List(Of Integer)) - If sTopo Is Nothing - Return - End If - Dim pattern As String = "(\(?[0-9a]\s*\)?)+|([AVLP][(]([0-9a]\s*)+[)])" - Dim rg As New Regex(pattern) - Dim items As New List(Of String) - For Each item As Match In rg.Matches(sTopo) - items.Add(item.Value) - Next - - - For Each item As String In items - Dim voidList As New List(Of Integer) - Dim solidList As New List(Of Integer) - Dim words As String() = item.Split(New Char() {" "c}) - Dim isAcrNode As Boolean = False - If item.Contains("P") OrElse item.Contains("L") Then - Continue For - End If - For Each word As String In words - If word.Trim().Equals("a") Then - isAcrNode = True - Continue For - End If - Dim wordString As String = word.Trim().Replace("(", "").Replace("V", "").Replace("A", "").Replace(")", "") - Dim nodeId As Integer = 0 - If Integer.TryParse(wordString, nodeId) Then - If item.Contains("V(") Then - voidList.Add(nodeId) - Else - solidList.Add(nodeId) - End If - If isAcrNode Then - arcNode.Add(nodeId) - isAcrNode = False - End If - End If - Next - If solidList.Count > 0 Then - orderedNodes.Add(solidList) - End If - If voidList.Count > 0 Then - voids.Add(voidList) - End If - Next - End Sub - Private Function ListString(ByVal iList As Integer) As String - If Not Me.ListExists(iList) Then - Return Nothing - End If - Dim list As String = CStr(m_GSAObject.GwaCommand("GET, LIST," & iList.ToString())) - Return list - End Function - Public Function ListTypeIsMember(ByVal iList As Integer) As Boolean - Dim listString As String = Me.ListString(iList) - If String.IsNullOrEmpty(listString) Then - Return False - End If - If listString.Contains("MEMB") Then - Return True - Else - Return False - End If - End Function - Public Function ListTypeIsElement(ByVal iList As Integer) As Boolean - Dim listString As String = Me.ListString(iList) - If String.IsNullOrEmpty(listString) Then - Return False - End If - If listString.Contains("ELEM") Then - Return True - Else - Return False - End If - End Function - Function ListItemsInList(ByVal iList As Integer) As List(Of Integer) - Dim check As Object = m_GSAObject.GwaCommand("EXIST,LIST," & iList.ToString()) - Dim iCheck As Integer = 0 - - Dim items As New List(Of Integer) - Int32.TryParse(check.ToString(), iCheck) - If 0 = iCheck Then - Return items - End If - - Dim resultObj As Object = m_GSAObject.GwaCommand("GET,LIST," & iList.ToString()) - If resultObj Is Nothing Then - Return items - End If - - Dim result As String = resultObj.ToString(), sEnt As String = "", listType As String = "" - If result.Contains("ELEMENT") Then - sEnt = "EL" - listType = "ELEM" - ElseIf result.Contains("MEMB") Then - listType = "MEMB" - sEnt = "MEMB" - Else - Return items - End If - - Dim parts As String() = result.Split(New Char() {","c}, StringSplitOptions.None) - - Dim nElem As Integer = CInt(m_GSAObject.GwaCommand("HIGHEST," & sEnt)) - If nElem = 0 Then - Return items - End If - For i As Integer = 1 To nElem - If Val(m_GSAObject.GwaCommand("EXIST," & sEnt & "," & i.ToString())) = 0 Then - Continue For - End If - If (CBool(m_GSAObject.IsItemIncluded(listType, i, parts(4)))) Then - items.Add(i) - End If - Next - Return items - End Function - Function ElemDesc(ByVal eType As ElemType) As String - - ' Get a string that describes the element - ElemDesc = "UNDEF" - If (eType = ElemType.EL_GROUND) Then - ElemDesc = "GROUND" - ElseIf (eType = ElemType.EL_MASS) Then - ElemDesc = "MASS" - ElseIf (eType = ElemType.EL_BEAM) Then - ElemDesc = "BEAM" - ElseIf (eType = ElemType.EL_BAR) Then - ElemDesc = "BAR" - ElseIf (eType = ElemType.EL_TIE) Then - ElemDesc = "TIE" - ElseIf (eType = ElemType.EL_STRUT) Then - ElemDesc = "STRUT" - ElseIf (eType = ElemType.EL_SPRING) Then - ElemDesc = "SPRING" - ElseIf (eType = ElemType.EL_LINK) Then - ElemDesc = "LINK" - ElseIf (eType = ElemType.EL_CABLE) Then - ElemDesc = "CABLE" - ElseIf (eType = ElemType.EL_SPACER) Then - ElemDesc = "SPACER" - ElseIf (eType = ElemType.EL_QUAD4) Then - ElemDesc = "QUAD4" - ElseIf (eType = ElemType.EL_QUAD8) Then - ElemDesc = "QUAD8" - ElseIf (eType = ElemType.EL_TRI3) Then - ElemDesc = "TRI3" - ElseIf (eType = ElemType.EL_TRI6) Then - ElemDesc = "TRI6" - End If - - End Function - - Function CATSectionToSNFamily(ByVal parts As String(), ByVal usage As SectionUsage, - ByRef familyName As String) As Boolean - - familyName = "" - Dim catAbr As String = parts(1) - If SectionUsage.FRAMING = usage Then - Select Case catAbr - Case "C", "HP", "L", "M", "MC", "MT", "P", "PX", "PXX", "S", "ST", "TS", "W", "WT" - familyName += "American_" - Case "A-CHS250", "A-CHS350", "A-EA", "A-PFC", "A-RHS350", "A-RHS450", "A-RSJs", "A-SHS350", "A-SHS450", "A-UA", "A-UB", "A-UBP", "A-UC" - familyName += "Australian_" - Case "BP", "CH", "CHS", "EA", "PFC", "RHS", "SHS", "TUB", "TUC", "UA", "UB", "UC", "UJ" - familyName += "British_" - Case "UKA", "UKB", "UKBP", "UKC", "UKPFC" - familyName += "Corus Advance_" - Case Else - familyName = "" - Return False - End Select - ElseIf SectionUsage.COLUMNS = usage Then - Select Case catAbr - Case "HP", "M", "P", "S", "W" - familyName += "American_" - Case "A-CHS250", "A-CHS350", "A-RHS350", "A-RHS450", "A-RSJs", "A-SHS350", "A-SHS450", "A-UB", "A-UBP", "A-UC" - familyName += "Australian_" - Case "BP", "CH", "CHS", "RHS", "SHS", "UB", "UC", "UJ" - familyName += "British_" - Case "UKB", "UKBP", "UKC" - familyName += "Corus Advance_" - Case Else - familyName = "" - Return False - End Select - End If - familyName += catAbr + "_" + usage.ToString().ToLower() - Return True - End Function - ' From an STD section, find out which rfa file is to be used - ' and the dimensions of the section - Function STDSectionToSNFamily(ByRef parts As String(), ByVal usage As SectionUsage, ByRef familyName As String) As Boolean - - Debug.Assert(String.Equals(parts(0), "STD")) - Dim cf As Double = 3.28 / 1000 - - Dim sShape As String = parts(1) - Dim shapeSubString As String() = sShape.Split(New Char() {"("c, ")"c}) - If shapeSubString.Length > 1 Then - sShape = shapeSubString(0) - Select Case shapeSubString(1) - Case "m" - cf = 1 / 3.28 - Case "mm" - cf = 1000 / 3.28 - Case "in" - cf = 12 - Case "ft" - cf = 1 - 'Case "" - End Select - End If - familyName = "" - - Select Case sShape - Case "GI", "I" - familyName = "Generic_I_" - Case "CH" - familyName = "Generic_CH_" - Case "CHS" - familyName = "Generic_CHS_" - Case "C" - familyName = "Generic_C_" - Case "RHS" - familyName = "Oasys_Generic_RHS_" - Case "R" - familyName = "Generic_R_" - Case "T" - familyName = "Generic_T_" - Case Else - Return False - End Select - - familyName += usage.ToString().ToLower() - Return True - End Function - ''' - ''' Given a descriptionm, return a map of dimension name to dimension value - ''' - ''' - ''' - ''' - ''' - Function SectionDimensions(ByVal desc As String, ByRef dimensions As SortedList) As Boolean - - Dim parts As String() = Nothing - parts = desc.Split(New [Char]() {"%"c, " "c}, StringSplitOptions.RemoveEmptyEntries) - - Debug.Assert(String.Equals(parts(0), "STD")) - Dim cf As Double = 3.28 / 1000 - - Dim sShape As String = parts(1) - Dim shapeSubString As String() = sShape.Split(New Char() {"("c, ")"c}) - If shapeSubString.Length > 1 Then - sShape = shapeSubString(0) - Select Case shapeSubString(1) - Case "m" - cf = 1 / 3.28 - Case "mm" - cf = 1000 / 3.28 - Case "in" - cf = 12 - Case "ft" - cf = 1 - 'Case "" - End Select - End If - Select Case sShape - Case "GI", "I" - ExtractDimensions_I(parts, dimensions, cf) - Case "CH" - ExtractDimensions_CH_T(parts, dimensions, cf) - Case "CHS" - ExtractDimensions_CHS(parts, dimensions, cf) - Case "C" - ExtractDimensions_C(parts, dimensions, cf) - Case "RHS" - ExtractDimensions_RECT(parts, dimensions, cf) - Case "R" - ExtractDimensions_RECT(parts, dimensions, cf) - Case "T" - ExtractDimensions_CH_T(parts, dimensions, cf) - Case Else - Return False - End Select - Return True - - End Function - - Function ExtractDimensions_I(ByRef parts As String(), ByRef dimensions As SortedList, ByVal cf As Double) As Boolean - Dim D As Double = 0.0, - Wt As Double = 0.0, - Wb As Double = 0.0, - Tt As Double = 0.0, - Tb As Double = 0.0, - t As Double = 0.0 - - Dim b1, b2, b3, b4, b5, b6 As Boolean - Select Case parts(1) - Case "GI" - ' D Wt Wb t Tt Tb - - Debug.Assert(8 = parts.Length) - b1 = Double.TryParse(parts(2), D) - dimensions.Add("D", D * cf) - - b2 = Double.TryParse(parts(3), Wt) - dimensions.Add("Wt", Wt * cf) - - b3 = Double.TryParse(parts(4), Wb) - dimensions.Add("Wb", Wb * cf) - - b4 = Double.TryParse(parts(5), t) - dimensions.Add("t", t * cf) - - b5 = Double.TryParse(parts(6), Tt) - dimensions.Add("Tt", Tt * cf) - - b6 = Double.TryParse(parts(7), Tb) - dimensions.Add("Tb", Tb * cf) - - Debug.Assert(b1 And b2 And b3 And b4 And b5 And b6) - - Case "I" - ' D W t T - 'STD I(m) 0.9 0.4 2.E-002 3.E-002 - Debug.Assert(6 = parts.Length) - b1 = Double.TryParse(parts(2), D) - dimensions.Add("D", D * cf) - - b2 = Double.TryParse(parts(3), Wt) - dimensions.Add("Wt", Wt * cf) - dimensions.Add("Wb", Wt * cf) - - b3 = Double.TryParse(parts(4), t) - dimensions.Add("t", t * cf) - - b4 = Double.TryParse(parts(5), Tt) - dimensions.Add("Tt", Tt * cf) - dimensions.Add("Tb", Tt * cf) - - Debug.Assert(b1 And b2 And b3 And b4) - End Select - Return True - End Function - Function ExtractDimensions_CH_T(ByRef parts As String(), ByRef dimensions As SortedList, ByVal cf As Double) As Boolean - - Dim D As Double = 0.0, - W As Double = 0.0, - T As Double = 0.0, - Tt As Double = 0.0 - 'STD CH(m) 0.5 0.25 2.E-002 3.E-002 - 'STD T(m) 0.5 0.25 3.E-002 2.E-002 - - Dim b1, b2, b3, b4 As Boolean - Debug.Assert(6 = parts.Length) - - b1 = Double.TryParse(parts(2), D) - dimensions.Add("D", D * cf) - - b2 = Double.TryParse(parts(3), W) - dimensions.Add("W", W * cf) - - b3 = Double.TryParse(parts(4), T) - dimensions.Add("T", T * cf) - - b4 = Double.TryParse(parts(5), Tt) - dimensions.Add("t", Tt * cf) - - Debug.Assert(b1 And b2 And b3 And b4) - Return True - - End Function - Function ExtractDimensions_CHS(ByRef parts As String(), ByRef dimensions As SortedList, ByVal cf As Double) As Boolean - - Dim D As Double = 0.0, - t As Double = 0.0 - 'STD CHS(m) 0.25 1.E-002 - - Dim b1, b2 As Boolean - Debug.Assert(4 = parts.Length) - - b1 = Double.TryParse(parts(2), D) - dimensions.Add("D", D * cf) - - b2 = Double.TryParse(parts(3), t) - dimensions.Add("t", t * cf) - - Debug.Assert(b1 And b2) - Return True - - End Function - Function ExtractDimensions_C(ByRef parts As String(), ByRef dimensions As SortedList, ByVal cf As Double) As Boolean - Dim D As Double = 0.0 - - Dim b1 As Boolean - Debug.Assert(3 = parts.Length) - - b1 = Double.TryParse(parts(2), D) - dimensions.Add("D", D * cf) - - Debug.Assert(b1) - Return True - - End Function - Function ExtractDimensions_RECT(ByRef parts As String(), ByRef dimensions As SortedList, ByVal cf As Double) As Boolean - - Dim D As Double = 0.0, - W As Double = 0.0, - T As Double = 0.0, - Tt As Double = 0.0 - 'STD RHS(m) 0.25 0.3 3.E-002 3.E-002 - - Dim b1, b2, b3, b4 As Boolean - Debug.Assert(6 = parts.Length Or 4 = parts.Length) - - b1 = Double.TryParse(parts(2), D) - dimensions.Add("D", D * cf) - - b2 = Double.TryParse(parts(3), W) - dimensions.Add("W", W * cf) - - Dim sShape As String = parts(1) - Dim shapeSubString As String() = sShape.Split(New [Char]() {"("c, ")"c}) - Debug.Assert(shapeSubString.Length > 0) - - If (String.Equals(shapeSubString(0), "RHS")) Then - b3 = Double.TryParse(parts(4), T) - dimensions.Add("T", T * cf) - - b4 = Double.TryParse(parts(5), Tt) - dimensions.Add("t", Tt * cf) - End If - - 'Debug.Assert(b1 And b2 And b3 And b4) - Return True - - End Function - - Function SetSid(ByVal keyword As String, ByVal record As Integer, ByVal sid As String) As Boolean - Debug.Assert(Not String.IsNullOrEmpty(keyword) And Not String.IsNullOrEmpty(sid) And Not (0 = record)) - - ' ensure record exists - Dim iCheck As Integer = CInt(m_GSAObject.GwaCommand("EXIST," & keyword & "," & record.ToString())) - If 1 <> iCheck Then - Return False - End If - m_GSAObject.WriteSidTagValue(keyword, record, "RVT", sid) - Return True - - End Function - - ''' - ''' Fetches value associated with the RVT key from the sid of the record - ''' - ''' - ''' - ''' - ''' - Private Function GetSid(ByRef keyword As String, ByRef record As Integer) As String - - Debug.Assert(Not String.IsNullOrEmpty(keyword) AndAlso Not 0 = record) - Dim iCheck As Integer = CInt(m_GSAObject.GwaCommand("EXIST," & keyword & "," & record.ToString())) - If iCheck <> 1 Then - Return Nothing - End If - Return m_GSAObject.GetSidTagValue(keyword, record, "RVT") - - End Function - Private Function GetSidMaterial(ByRef keyword As String, ByRef record As Integer) As String - - Debug.Assert(Not String.IsNullOrEmpty(keyword)) - Dim iCheck As Integer = CInt(m_GSAObject.GwaCommand("EXIST," & keyword & "," & record.ToString())) - If iCheck <> 1 Then - Return Nothing - End If - Return m_GSAObject.GetSidTagValue(keyword, record, "RVT") - - End Function - - Function ParseModelSid(ByRef sids As SortedList(Of String, String)) As Boolean - Dim sidString As String = m_GSAObject.GetSidTagValue("SID", 1, "RVT") - If String.IsNullOrEmpty(sidString) Then - Return False - End If - Return Me.ParseNestedSid(sidString, sids) - - End Function - - Function ParseNestedSid(ByRef sid_string As String, ByRef sids As SortedList(Of String, String)) As Boolean - 'sid is of format {RVT:{key1:value1}{key2:value2}...} - - 'sid = sid.Substring(5) - 'sid = sid.Remove(sid.Length - 1) - 'Dim params As New SortedList - - Dim parts As String() = sid_string.Split(New Char() {"{"c, "}"c}, System.StringSplitOptions.RemoveEmptyEntries) - If parts Is Nothing Then - Return False - End If - - For Each s As String In parts - Dim pair As String() = s.Split(New Char() {":"c}) - If pair.Length <> 2 Then - Continue For - End If - sids(pair(0)) = pair(1) - Next - Return True - - End Function - Sub SetModelSid(ByRef sid As String) - m_GSAObject.GwaCommand("SID," & sid) - End Sub - ''' - ''' Highest record number for a given module - ''' - ''' - ''' - ''' - Private Function HighestRecord(ByRef keyword As String) As Integer - Dim command As String = "HIGHEST," + keyword - Dim obj As Object = m_GSAObject.GwaCommand(command) - Dim nRecord As Integer = CType(obj, Integer) - If nRecord < 0 Then - nRecord = 0 - End If - Return nRecord - End Function - Function HighestGridPlane() As Integer - Return Me.HighestRecord("GRID_PLANE") - End Function - Function HighestGridSurface() As Integer - Return Me.HighestRecord("GRID_SURFACE") - End Function - Function HighestGridLine() As Integer - Return Me.HighestRecord("GRID_LINE") - End Function - Function HighestNode() As Integer - Return Me.HighestRecord("NODE") - End Function - Function HighestSection() As Integer - Return Me.HighestRecord("PROP_SEC") - End Function - Function HighestProp2d() As Integer - Return Me.HighestRecord("PROP_2D") - End Function - Function HighestMaterial() As Integer - Return Me.HighestRecord("MAT_ANAL") - End Function - Function HighestEnt(ByRef ent As String) As Integer - ent = ent.Replace("MEMBER", "MEMB") - Return Me.HighestRecord(ent) - End Function - Function HighestList() As Integer - Return Me.HighestRecord("LIST") - End Function - Function HighestPolyLine() As Integer - Return Me.HighestRecord("POLYLINE") - End Function - Function HighestGridAreaLoad() As Integer - Return Me.HighestRecord("LOAD_GRID_AREA") - End Function - Function HighestGridLineLoad() As Integer - Return Me.HighestRecord("LOAD_GRID_LINE") - End Function - Function HighestGridPointLoad() As Integer - Return Me.HighestRecord("LOAD_GRID_POINT") - End Function - Function HighestLoadCase() As Integer - Return Me.HighestRecord("LOAD_TITLE") - End Function - - - ''' - ''' Does record exist for keyword - ''' - ''' - ''' - ''' - ''' - Private Function ModuleRecordExists(ByRef keyword As String, ByVal record As Integer) As Boolean - Dim command As String = "EXIST," + keyword + "," + record.ToString() - Dim obj As Object = m_GSAObject.GwaCommand(command) - Dim bExist As Boolean = False - Dim iResult As Integer = CType(obj, Integer) - If 0 = iResult Then - Return False - Else - Return True - End If - - End Function - Function SectionExists(ByVal iSec As Integer, Optional ByVal bFresh As Boolean = False) As Boolean - If bFresh Then - Return Me.ModuleRecordExists("PROP_SEC", iSec) - Else - If Not _SecListExist.ContainsKey(iSec) Then - _SecListExist.Add(iSec, Me.ModuleRecordExists("PROP_SEC", iSec)) - End If - Return _SecListExist.Item(iSec) - End If - End Function - Function Section2DExists(ByVal iSec As Integer) As Boolean - Return Me.ModuleRecordExists("PROP_2D", iSec) - End Function - Function ClearSectionExistsInfo() As Boolean - _SecListExist.Clear() - _SecList.Clear() - Return True - End Function - Function MaterialExists(ByVal iMat As Integer) As Boolean - Return Me.ModuleRecordExists("MAT_ANAL", iMat) - End Function - Function GridPlaneExists(ByVal iGridPl As Integer) As Boolean - Return Me.ModuleRecordExists("GRID_PLANE", iGridPl) - End Function - Function GridLineExists(ByVal iGridLine As Integer) As Boolean - Return Me.ModuleRecordExists("GRID_LINE", iGridLine) - End Function - Function EntExists(ByRef ent As String, ByVal iEnt As Integer) As Boolean - If (ent.Equals("EL")) Then - If Not _EleListExist.ContainsKey(iEnt) Then - _EleListExist.Add(iEnt, Me.ModuleRecordExists(ent, iEnt)) - End If - Return _EleListExist.Item(iEnt) - Else - If Not _MemListExist.ContainsKey(iEnt) Then - _MemListExist.Add(iEnt, Me.ModuleRecordExists(ent, iEnt)) - End If - Return _MemListExist.Item(iEnt) - End If - - End Function - Function ListExists(ByRef iList As Integer) As Boolean - Return Me.ModuleRecordExists("LIST", iList) - End Function - - ''' - ''' gets revit id for the material record - ''' - ''' - ''' - ''' No need to extract RevitID again when using this - Function MaterialSid(ByRef record As Integer) As String - Return GetSidMaterial("MAT_ANAL", record) - End Function - ''' - ''' gets revit id for the grid plane record - ''' - ''' - ''' - ''' No need to extract RevitID again when using this - Function GridPlaneSid(ByRef record As Integer) As String - Return GetSid("GRID_PLANE", record) - End Function - ''' - ''' gets revit id for the grid line record - ''' - ''' - ''' - ''' No need to extract RevitID again when using this - Function GridLineSid(ByRef record As Integer) As String - Return GetSid("GRID_LINE", record) - End Function - ''' - ''' gets revit id for a member or element - ''' - ''' - ''' - ''' - ''' - Function EntSid(ByVal entity As String, ByVal record As Integer) As String - Return GetSid(entity, record) - End Function - - Function EntSection(ByVal entity As String, ByVal iEnt As Integer) As Integer - Debug.Assert(String.Equals(entity, "EL") Or String.Equals(entity, "MEMB")) - If Not Me.EntExists(entity, iEnt) Then - Debug.Assert(False) - Return 0 - End If - - Dim sName As String = "", sTopo As String = "", iProp As Integer = 0 - Dim type As MembType = MembType.UNDEF, Mat As MembMat = MembMat.UNDEF - Dim eMembtype As MembType = MembType.UNDEF - Dim eMembMattype As MembMat = MembMat.UNDEF - Dim uid As String = "", strDummy As String = "" - Dim iOrNode As Integer = 0, dBeta As Double = 0.0, - iTopoList As List(Of Integer) = Nothing, - dOffset As List(Of Double()) = Nothing, - release As List(Of String) = Nothing - Dim eleType As ElemType = ElemType.EL_BAR - Dim endRestraint1 As String = "" - Dim endRestraint2 As String = "" - If String.Equals(entity, "EL") Then - Me.Elem1d(iEnt, sName, iProp, uid, iTopoList, iOrNode, dBeta, release, dOffset, eleType, strDummy) - Else - Me.Member(iEnt, sName, iProp, uid, sTopo, iOrNode, dBeta, release, dOffset, eMembtype, endRestraint1, endRestraint2) - End If - - Return iProp - End Function - Private Shared Function ElemTypeIsBeamOrTruss(ByVal eType As ElemType) As Boolean - If (ElemType.EL_BEAM = eType _ - Or ElemType.EL_BAR = eType _ - Or ElemType.EL_STRUT = eType _ - Or ElemType.EL_TIE = eType) Then - Return True - Else - Return False - End If - End Function - ''' - ''' returns sid from string {RVT:sid} - ''' - ''' - ''' - ''' sid can be of form {tag1:{subtag1:data}{subtag2:data}}{tag2:data} - Public Shared Function ExtractId(ByVal sArg As String) As String - - Dim tag As String = "RVT:" - Dim value As String = "" - If Not sArg.Contains(tag) Then - 'Debug.Assert(False) - Return value - End If - - Dim pos_tag As Integer = sArg.IndexOf(tag) - ' sid will be of form {tag1:{subtag1:data}{subtag2:data}}{tag2:data} - Dim pos_value As Integer = pos_tag + tag.Length - Dim nBraces As Integer = 1 - Dim sOpn As String = "{", sCls As String = "}" - 'Debug.Assert(Char.Equals(sArg.Chars(pos_value), sOpn.Chars(0))) - - Dim i As Integer = 0 - While nBraces > 0 - If Char.Equals(sArg.Chars(pos_value + i), sOpn.Chars(0)) Then - nBraces += 1 - End If - If Char.Equals(sArg.Chars(pos_value + i), sCls.Chars(0)) Then - nBraces -= 1 - End If - i += 1 - End While - If sArg.Length < pos_value + i Then - Debug.Assert(False) ' something's wrong - Return value - End If - value = sArg.Substring(pos_value, i - 1) - Return value - End Function - Public Shared Function ExtractVesrion(ByVal sArg As String) As String - Dim tag As String = "RVT:" - If Not sArg.Contains(tag) Then - Return sArg - End If - Dim pos_tag As Integer = sArg.IndexOf(tag) - Return sArg.Substring(0, pos_tag - 2) - End Function - Public Property SelType() As EntType - Get - Return m_eSelType - End Get - Set(ByVal value As EntType) - m_eSelType = value - End Set - End Property - Public Shared Function DisplacementUnitFactor(ByVal unit As String) As Double - Dim dSectionDispFactor As Double = 1.0 - If unit.Contains("(m)") Then - dSectionDispFactor = ToMilliMeter.FromMeter - ElseIf unit.Contains("(ft)") Then - dSectionDispFactor = ToMilliMeter.FromFeet - ElseIf unit.Contains("in") Then - dSectionDispFactor = ToMilliMeter.FromInch - ElseIf unit.Contains("cm") Then - dSectionDispFactor = ToMilliMeter.FromCentimeter - Else - dSectionDispFactor = 1.0 - End If - Return dSectionDispFactor - End Function -End Class +' +' © 2008 Oasys Ltd. +' +Imports System.IO +Imports System.Math +Imports System.Reflection +Imports System.Collections.Generic +Imports System.Drawing +Imports System.Linq +Imports System.Text.RegularExpressions +Public Class GsaComUtil + + Const RoundPrecision As Integer = 6 'precision for rounding real numbers + Const SectionSid_Usage As String = "usage" + Const SectionSid_Symbol As String = "symbol" + Private _MemList As Dictionary(Of Integer, MemberElement) + Private _EleList As Dictionary(Of Integer, MemberElement) + Private _EleListExist As Dictionary(Of Integer, Boolean) + Private _MemListExist As Dictionary(Of Integer, Boolean) + Private _IsHoz As Dictionary(Of Integer, Boolean) + Private _IsVet As Dictionary(Of Integer, Boolean) + Private _SecList As Dictionary(Of Integer, GSASection) + Private _SecListExist As Dictionary(Of Integer, Boolean) + Private _Connection As Dictionary(Of Integer, String) + Enum RefPt + CENTROID = 0 + TOP_LEFT + TOP_CENTRE + TOP_RIGHT + MIDDLE_LEFT + DUMMY + MIDDLE_RIGHT + BOTTOM_LEFT + BOTTOM_CENTRE + BOTTOM_RIGHT + End Enum + Enum AreaType + VOID = 1 + TWO_WAY = 2 + End Enum + Enum LineType + ARC_THIRD_PT + ARC_RADIUS + LINEAR + End Enum + Enum GridPlaneType + UNDEF = -1 + STOREY = 0 + GENERAL = 1 + End Enum + Enum EntType + SEL_ELEM = 2 + SEL_MEMBER = 3 + SEL_AREA = 7 + SEL_REGION = 8 + End Enum + Enum GridLoadType + UNDEF = -1 + AREA = 0 + LINE = 1 + POINT = 3 + End Enum + Enum ElemType + EL_UNDEF = 0 + EL_BEAM = 201 + EL_BAR = 202 + EL_TIE = 203 + EL_STRUT = 204 + EL_SPRING = 205 + EL_LINK = 206 + EL_CABLE = 207 + EL_SPACER = 208 + EL_GROUND = 101 + EL_MASS = 102 + EL_QUAD4 = 401 + EL_QUAD8 = 801 + EL_TRI3 = 301 + EL_TRI6 = 601 + EL_PLANESTRESS = 901 + EL_FLATPLATE = 902 + End Enum + Public Enum MembType + UNDEF = -1 + GENERIC_1D = 0 + GENERIC_2D = 1 + BEAM = 2 + COLUMN = 3 + SLAB = 4 + WALL = 5 + CANTILEVER = 6 + RIBSLAB = 7 + COMPOS = 8 + PILE = 9 + EXPLICIT = 10 + VOID_CUTTER_1D = 11 + VOID_CUTTER_2D = 12 + GENERIC_3D = 13 + End Enum + Public Enum Type2D + UNDEF = 0 + PL_STRESS = 1 + PL_STRAIN = 2 + AXISYMMETRIC = 3 + FABRIC = 4 + PLATE = 5 + SHELL = 6 + CURVED_SHELL = 7 + TORSION = 8 + WALL = 9 + LOAD = 10 + End Enum + Public Function Type2DFromStr(ByVal mType As String) As Type2D + mType = mType.ToUpper() + Select Case mType + Case "UNDEF" + Return Type2D.UNDEF + Case "PL_STRESS" + Return Type2D.PL_STRESS + Case "PL_STRAIN" + Return Type2D.PL_STRAIN + Case "AXISYMMETRIC" + Return Type2D.AXISYMMETRIC + Case "FABRIC" + Return Type2D.FABRIC + Case "PLATE" + Return Type2D.PLATE + Case "SHELL" + Return Type2D.SHELL + Case "CURVED_SHELL" + Return Type2D.CURVED_SHELL + Case "TORSION" + Return Type2D.TORSION + Case "WALL" + Return Type2D.WALL + Case "LOAD" + Return Type2D.LOAD + Case Else + Return Type2D.UNDEF + End Select + End Function + Public Function MembTypeStr(ByVal mType As MembType) As String + Return mType.ToString() + End Function + Public Function MembTypeFromStr(ByVal mType As String) As MembType + mType = mType.ToUpper() + Select Case mType + Case "UNDEF" + Return MembType.UNDEF + Case "GENERIC_1D" + Case "1D_GENERIC" + Return MembType.GENERIC_1D + Case "GENERIC_2D" + Case "2D_GENERIC" + Return MembType.GENERIC_2D + Case "GENERIC_3D" + Return MembType.GENERIC_3D + Case "BEAM" + Return MembType.BEAM + Case "COLUMN" + Return MembType.COLUMN + Case "SLAB" + Return MembType.SLAB + Case "WALL" + Return MembType.WALL + Case "CANTILEVER" + Return MembType.CANTILEVER + Case "RIBSLAB" + Return MembType.RIBSLAB + Case "COMPOS" + Return MembType.COMPOS + Case "PILE" + Return MembType.PILE + Case "EXPLICIT" + Return MembType.EXPLICIT + Case "VOID_CUTTER_1D" + Return MembType.VOID_CUTTER_1D + Case "VOID_CUTTER_2D" + Return MembType.VOID_CUTTER_2D + Case "VOID_CUTTER_1D" + Return MembType.GENERIC_3D + Case Else + Return MembType.UNDEF + End Select + End Function + Public Enum MembBarLayout + BEAM = 0 + COLUMN = 1 + PERIM = 2 + UNDEF = 3 + End Enum + Public Enum MembMat + UNDEF = -1 + STEEL = 1 + CONCRETE = 2 + TIMBER = 3 + ALUMINIUM = 4 + GLASS = 5 + FRP = 6 + End Enum + Public Function MembMatStr(ByVal mType As MembMat) As String + Select Case mType + Case MembMat.CONCRETE + Return "CONCRETE" + Case MembMat.STEEL + Return "STEEL" + Case MembMat.TIMBER + Return "TIMBER" + Case MembMat.ALUMINIUM + Return "ALUMINIUM" + Case MembMat.GLASS + Return "GLASS" + Case MembMat.FRP + Return "FRP" + Case Else + Return "GENERIC" + End Select + End Function + Public Function MembMatFromStr(ByVal mType As String) As MembMat + Select Case mType + Case "STEEL" + Return MembMat.STEEL + Case "CONCRETE" + Return MembMat.CONCRETE + Case "TIMBER" + Return MembMat.TIMBER + Case "ALUMINIUM" + Return MembMat.ALUMINIUM + Case "GLASS" + Return MembMat.GLASS + Case "FRP" + Return MembMat.FRP + Case Else + Return MembMat.UNDEF + End Select + End Function + + Public Enum LoadPos + SHR_CENTRE = 0 + TOP_FLANGE = 1 + BOT_FLANGE = 2 + End Enum + Public Enum SectionMatch_Flags + NONE = 0 + SEC_INCL_SS = 1 + SEC_ATTEMPT_STD = 2 + BOTH = (SectionMatch_Flags.SEC_INCL_SS Or SectionMatch_Flags.SEC_ATTEMPT_STD) + End Enum + + Public Enum SectionUsage + NOT_USED = 0 + FRAMING = GsRevit_Usage.FRAMING + COLUMNS = GsRevit_Usage.COLUMNS + SLAB = 3 + WALL = 4 + INVALID = 5 + End Enum + Public Enum Units + IMPERIAL = GsRevit_Units.IMPERIAL + METRIC = GsRevit_Units.METRIC + End Enum + + Public Structure ToMilliMeter + public Shared FromMeter As Double = 1000.0 + public Shared FromFeet As Double = 304.8 + public Shared FromInch As Double = 25.4 + public Shared FromCentimeter As Double = 10.0 + End Structure + + 'GSA object + Private m_GSAObject As ComAuto + Private m_eSelType As EntType + Private m_eUnit As GsRevit_Units ' Units of the REVIT MODEL!! Careful + Public m_cfactor As Double = 1 + Public Sub New() + Try + m_GSAObject = New ComAuto() + Catch ex As System.Runtime.InteropServices.COMException + Throw New System.Exception("Cannot initialise GSA object. " & ex.Message) + End Try + + If m_GSAObject Is Nothing Then + Throw New System.Exception("Cannot initialise GSA object") + End If + _EleList = New Dictionary(Of Integer, MemberElement) + _MemList = New Dictionary(Of Integer, MemberElement) + _EleListExist = New Dictionary(Of Integer, Boolean) + _MemListExist = New Dictionary(Of Integer, Boolean) + _IsHoz = New Dictionary(Of Integer, Boolean) + _IsVet = New Dictionary(Of Integer, Boolean) + _SecList = New Dictionary(Of Integer, GSASection) + _SecListExist = New Dictionary(Of Integer, Boolean) + ' we parse using the EN_GB locale + ' we parse using the EN_GB locale + + m_GSAObject.SetLocale(Locale.LOC_EN_GB) + End Sub + + 'release GSA object + Public Sub ReleaseGsa() + m_GSAObject = Nothing + End Sub + + Public Sub GsaUpdateViews() + Me.m_GSAObject.UpdateViews() + End Sub + + 'open a new GSA file + Public Function GsaNewFile() As Short + Return Me.m_GSAObject.NewFile() + End Function + + 'open an existing GSA file + Public Function GsaOpenFile(ByRef sFileName As String) As Short + Return Me.m_GSAObject.Open(sFileName) + End Function + + 'save the current GSA model to file + Public Function GsaSaveFile(Optional ByVal sFileName As String = "") As Short + If Not String.IsNullOrEmpty(sFileName) Then + Return Me.m_GSAObject.SaveAs(sFileName) + Else + Return Me.m_GSAObject.Save() + End If + End Function + Public Function GsaObj() As ComAuto + Return m_GSAObject + End Function + 'close GSA model + Public Function GsaCloseFile() As Short + Dim returnVal As Short = 0 + Try + returnVal = m_GSAObject.Close() + Me.ReleaseGsa() + Return returnVal + Catch ex As Exception + 'Throw New System.Exception("GSA COM object do not exist" & ex.Message) + End Try + Return returnVal + End Function + Public Function DeleteResults(ByVal Key As String, ByVal iRecLow As Integer, ByVal iRecHigh As Integer) As Boolean + Dim gwaCommand As String + gwaCommand = "DELETE," + Key + "," + iRecLow.ToString() + "," + iRecHigh.ToString() + Dim check As Object = m_GSAObject.GwaCommand(gwaCommand) + Dim bOut As Boolean = CType(check, Boolean) + Return bOut + End Function + 'delete GSA results + Public Function GsaDeleteResults() As Short + Return Me.m_GSAObject.Delete("RESULTS") + End Function + + 'delete the GSA results and cases + Public Function GsaDeleteResultsAndCases() As Short + Return Me.m_GSAObject.Delete("RESULTS_AND_CASES") + End Function + + 'analyse the GSA model + Public Sub GsaAnalyse() + Me.m_GSAObject.Analyse() + End Sub + Public Sub LogFeatureUsage(ByVal LogName As String) + Me.m_GSAObject.LogFeatureUsage(LogName) + End Sub + + Public ReadOnly Property GsaComObject() As ComAuto + Get + Return m_GSAObject + End Get + End Property + Public Property RevitUnits() As GsaComUtil.Units + Get + Return CType(m_eUnit, GsaComUtil.Units) + End Get + Set(ByVal value As GsaComUtil.Units) + m_eUnit = CType(value, GsRevit_Units) + End Set + End Property + Public Function MappingPath() As String + Dim cPath As String = "" + m_GSAObject.MappingDBPath(cPath) + Return cPath + End Function + Public Function RevitFamilyToSection(ByVal familyType As String, ByVal revitFamily As String, ByVal usage As SectionUsage) As String + Dim gsrevit_usage As GsRevit_Usage = GsRevit_Usage.FRAMING + If SectionUsage.COLUMNS = usage Then + gsrevit_usage = GsRevit_Usage.COLUMNS + End If + Return m_GSAObject.Gen_SectTransltnGsRevit(familyType, GsRevit_SectTrnsDir.REVIT_TO_GSA, gsrevit_usage, revitFamily) + End Function + + Public Function IsDescValid(ByVal sDes As String) As Boolean + If String.IsNullOrEmpty(sDes) Then + Return False + End If + Dim strOut As String = m_GSAObject.Gen_SectionMatchDesc(sDes, SectionMatch_Flags.BOTH, False) + If String.IsNullOrEmpty(strOut) Then + Return False + End If + Return True + End Function + Public Function SectionToRevitFamily(ByVal gsaDesc As String, + ByVal usage As SectionUsage, + ByRef familyName As String, + ByRef bFamilyTypeFound As Boolean) As String + + Dim familyType As String = "" + Dim gsrevit_usage As GsRevit_Usage = gsrevit_usage.FRAMING + If SectionUsage.COLUMNS = usage Then + gsrevit_usage = gsrevit_usage.COLUMNS + End If + familyName = "" + familyType = m_GSAObject.Gen_SectTransltnGsRevit(gsaDesc, GsRevit_SectTrnsDir.GSA_TO_REVIT, gsrevit_usage, familyName) + If Not String.IsNullOrEmpty(familyType) And Not String.IsNullOrEmpty(familyName) Then + bFamilyTypeFound = True + Else + 'i.e. 5.0 should be same as 5 + Dim newGsaDesc As String = gsaDesc + If Not newGsaDesc.Contains(".0") Then + newGsaDesc = newGsaDesc + ".0" + Else + newGsaDesc = newGsaDesc.Replace(".0", "") + End If + familyType = m_GSAObject.Gen_SectTransltnGsRevit(newGsaDesc, GsRevit_SectTrnsDir.GSA_TO_REVIT, gsrevit_usage, familyName) + If Not String.IsNullOrEmpty(familyType) And Not String.IsNullOrEmpty(familyName) Then + bFamilyTypeFound = True + Return familyType + End If + familyType = TrySNFamilies(gsaDesc, usage, bFamilyTypeFound, familyName) + End If + Return familyType + End Function + + Private Function TrySNFamilies(ByVal desc As String, ByVal usage As GsaComUtil.SectionUsage, ByRef familyTypeFound As Boolean, ByRef familyName As String) As String + Dim parts As String() = Nothing + parts = desc.Split(New [Char]() {"%"c, " "c}, StringSplitOptions.RemoveEmptyEntries) + Dim typeName As String = "" + If String.Equals(parts.GetValue(0), "CAT") Then + 'CAT W W14x43 + If Me.CATSectionToSNFamily(parts, usage, familyName) Then + familyTypeFound = True + Return parts(2) + End If + ElseIf String.Equals(parts.GetValue(0), "STD") Then + If Me.STDSectionToSNFamily(parts, usage, familyName) Then + familyTypeFound = False + Return Nothing + End If + End If + 'Debug.Assert(False) + familyName = "" + familyTypeFound = False + Return Nothing + + End Function + ''' + ''' calls Gen_MatchDesc. Options include bSuperSeded, bAttemptStd + ''' + ''' + ''' + ''' + ''' + Public Function MatchDescription(ByVal sDesc As String, ByVal options As GsaComUtil.SectionMatch_Flags) As String + If String.IsNullOrEmpty(sDesc) Then + Return String.Empty + End If + Dim result As String = "" + Try + result = m_GSAObject.Gen_SectionMatchDesc(sDesc, options, False) + Catch ex As Exception + Debug.WriteLine(ex.Message) + End Try + Return result + End Function + + 'find existing GSA node at required position or create a new one + Public Function NodeAt(ByVal dX As Double, ByVal dY As Double, ByVal dZ As Double, + ByVal dCoincidenceTol As Double) As Integer + Dim iNode As Integer = 0 + 'round + dX = Math.Round(dX, RoundPrecision) + dY = Math.Round(dY, RoundPrecision) + dZ = Math.Round(dZ, RoundPrecision) + + 'find existing node within tolerance or create new node + iNode = Me.m_GSAObject.Gen_NodeAt(dX, dY, dZ, dCoincidenceTol) + Return iNode + End Function + Public Function BlankElement(ByVal iELem As Integer) As Boolean + Dim gwaCommand As String + gwaCommand = "BLANK,EL," + iELem.ToString() + Dim check As Object = m_GSAObject.GwaCommand(gwaCommand) + Return True + End Function + Public Function BlankMember(ByVal iMem As Integer) As Boolean + Dim gwaCommand As String + gwaCommand = "BLANK,MEMB," + iMem.ToString() + Dim check As Object = m_GSAObject.GwaCommand(gwaCommand) + Return True + End Function + Public Sub ChangeUnits(ByRef dData() As Double) + dData(0) = Math.Round(dData(0) * m_cfactor, 4) + dData(1) = Math.Round(dData(1) * m_cfactor, 4) + dData(2) = Math.Round(dData(2) * m_cfactor, 4) + End Sub + + + Public Sub ChangeUnits(ByRef dData As Double) + dData = Math.Round(dData * m_cfactor, 4) + End Sub + Public Sub ExtractNodeCoor(ByVal iNode As Integer, ByRef x As Double, ByRef y As Double, ByRef z As Double) + + Dim SIToFeet As Double = 3.28084 + 'initialize the coords to 0 first + x = 0 + y = 0 + z = 0 + + Dim check As Object + Dim gwaCommand As String + gwaCommand = "EXIST,NODE," + iNode.ToString() + check = m_GSAObject.GwaCommand(gwaCommand) + Dim iCheck As Integer = CType(check, Integer) + If 1 = iCheck Then + m_GSAObject.NodeCoor(iNode, x, y, z) + End If + 'change SI unit to user unit as NodeCord function return in SI unit + x = x * SIToFeet / m_cfactor + y = y * SIToFeet / m_cfactor + z = z * SIToFeet / m_cfactor + + End Sub + Public Function ExtractNodeCoor(ByVal iNode As Integer) As Double() + + Dim SIToFeet As Double = 3.28084 + 'initialize the coords to 0 first + Dim dbNoderCord() As Double = {0.0, 0.0, 0.0} + Dim check As Object + Dim gwaCommand As String + gwaCommand = "EXIST,NODE," + iNode.ToString() + check = m_GSAObject.GwaCommand(gwaCommand) + Dim iCheck As Integer = CType(check, Integer) + If 1 = iCheck Then + m_GSAObject.NodeCoor(iNode, dbNoderCord(0), dbNoderCord(1), dbNoderCord(2)) + End If + 'change SI unit to user unit as NodeCord function return in SI unit + dbNoderCord(0) = dbNoderCord(0) * SIToFeet / m_cfactor + dbNoderCord(1) = dbNoderCord(1) * SIToFeet / m_cfactor + dbNoderCord(2) = dbNoderCord(2) * SIToFeet / m_cfactor + Return dbNoderCord + End Function + Public Shared Function Arg(ByVal pos As Integer, ByVal source As String) As String + Dim strList As New List(Of String) + Dim strArray As String() = source.Split(New [Char]() {","c}) + Dim bQuoteStart As Boolean = False + Dim bQuoteEnd As Boolean = False + Dim QuoteRecord As String = "" + Dim index As Integer = 0 + For Each value As String In strArray + value = value.Trim() + If (bQuoteStart) Then + bQuoteEnd = value.EndsWith(ControlChars.Quote) + End If + If (Not bQuoteStart) Then + QuoteRecord = "" + bQuoteStart = value.StartsWith(ControlChars.Quote) + End If + + If bQuoteStart OrElse bQuoteEnd Then + If (index > 0) Then + QuoteRecord = QuoteRecord + "," + End If + QuoteRecord = QuoteRecord + value + index = index + 1 + Else + QuoteRecord = value + End If + + If bQuoteEnd Then + bQuoteStart = False + End If + + If Not bQuoteStart Then + strList.Add(QuoteRecord) + End If + Next + If strList.Count > pos Then + Return CType(strList(pos), String) + Else + Return String.Empty + End If + End Function + Public Sub AssignUnitsCF() + + 'Revit store length in feet i.e in Impherial and rest other in SI units + Dim commandObj As Object = m_GSAObject.GwaCommand("GET,UNIT_DATA, LENGTH") + If commandObj Is Nothing Then + Exit Sub + End If + Dim commandResult As String = commandObj.ToString() + 'UNIT_DATA | option | name | factor + 'UNIT_DATA,LENGTH,ft,3.28084 + + Double.TryParse(GsaComUtil.Arg(3, commandResult), m_cfactor) + m_cfactor = 3.28084 / m_cfactor + ' A factor which can convert the values to feet - This is what the revit API expects. + End Sub + 'write a GSA Grid Plane + Public Function SetGridPlane(ByVal iGrid As Integer, ByVal sName As String, ByVal sid As String, ByVal iAxis As Integer, ByVal dElev As Double, ByVal dTol As Double, Optional ByVal type As GsaComUtil.GridPlaneType = GsaComUtil.GridPlaneType.STOREY) As Integer + '// ++ + '// GRID_PLANE.2 | num | name | type | axis | elev | tol | below | above + '// + '// @desc Grid plane definition + '// + '// @param + '// num record number + '// name name + '// type type + + '// GENERAL : general grid plane + + '// STOREY : storey + '// axis grid plane axis + '// elev grid elevation [m] + '// tol grid plane tolerance + '// below storey tolerance below grid plane if STOREY + '// above storey tolerance above grid plane if STOREY + ' // -- + Dim sGwaCommand As String = "" + If (iGrid <= 0) Then + iGrid = Me.HighestGridPlane() + 1 + End If + 'round + dElev = Math.Round(dElev, RoundPrecision) + 'write grid plane + sGwaCommand = "GRID_PLANE:" + sGwaCommand += "{RVT:" & sid & "}" + sGwaCommand += "," + iGrid.ToString() 'number + sGwaCommand += "," & sName 'name + sGwaCommand += "," + type.ToString() 'type [GENERAL :: general grid plane] or [STOREY :: storey] + sGwaCommand += "," + iAxis.ToString() 'axis + sGwaCommand += "," + dElev.ToString() 'elevation + sGwaCommand += "," + dTol.ToString() 'above tolerance + sGwaCommand += "," + dTol.ToString() 'below tolerance + m_GSAObject.GwaCommand(sGwaCommand) + + Return iGrid + End Function + + Public Function GridPlane(ByVal iNum As Integer, ByRef sName As String, ByRef uid As String, ByRef dElev As Double) As Boolean + Dim type As GridPlaneType = GridPlaneType.STOREY + Dim iAxis As Integer = 0 + Dim dTol As Double = 0.0 + Return Me.GridPlane(iNum, sName, uid, iAxis, dElev, type, dTol) + End Function + 'read a GSA Grid Plane + Public Function GridPlane(ByVal iGrid As Integer, ByRef sName As String, ByRef uid As String, ByRef iAxis As Integer, ByRef dElev As Double, ByRef eType As GsaComUtil.GridPlaneType, ByRef dTol As Double) As Boolean + + '// ++ + '// GRID_PLANE.2 | num | name | type | axis | elev | tol | below | above + '// + '// @desc Grid plane definition + '// + '// @param + '// num record number + '// name name + '// type type + + '// GENERAL : general grid plane + + '// STOREY : storey + '// axis grid plane axis + '// elev grid elevation [m] + '// tol grid plane tolerance + '// below storey tolerance below grid plane if STOREY + '// above storey tolerance above grid plane if STOREY + ' // -- + Try + If Not Me.GridPlaneExists(iGrid) Then + Return False + End If + Dim sGwaCommand As String = "" + Dim sArg As String + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,GRID_PLANE," & iGrid.ToString)) + If String.IsNullOrEmpty(sGwaCommand) Then + Return False + End If + sArg = GsaComUtil.Arg(0, sGwaCommand) + Dim idString As String = GsaComUtil.ExtractId(sArg) + If Not String.IsNullOrEmpty(idString) Then + uid = idString + End If + sArg = GsaComUtil.Arg(1, sGwaCommand) 'number + sArg = GsaComUtil.Arg(2, sGwaCommand) 'name + sName = sArg + sArg = GsaComUtil.Arg(3, sGwaCommand) 'type + If (sArg.ToLower().Equals("storey")) Then + eType = GridPlaneType.STOREY + Else + eType = GridPlaneType.GENERAL + End If + sArg = GsaComUtil.Arg(4, sGwaCommand) 'axis + iAxis = CInt(sArg) + + sArg = GsaComUtil.Arg(5, sGwaCommand) 'elevation [feet] + dElev = Val(sArg) + sArg = GsaComUtil.Arg(6, sGwaCommand) 'elements + dTol = Val(sArg) + Catch ex As Exception + Return False + End Try + Return True + End Function + 'write GSA grid line + Public Function SetGridLine(ByVal iGrLine As Integer, ByVal sName As String, ByVal bArc As Boolean, ByVal sid As String, + ByVal coorX As Double, ByVal coorY As Double, ByVal length As Double, + Optional ByVal theta1 As Double = 0.0, Optional ByVal theta2 As Double = 0.0) As Integer + + Dim sGwaCommand As String = "" + If (iGrLine <= 0) Then + iGrLine = Me.HighestGridLine() + 1 + End If + '// ++ + '// GRID_LINE | num | name | arc | coor_x | coor_y | length | theta1 | theta2 + '// + '// @desc Grid line definition + '// + '// @param + '// num record number + '// name name + '// arc line Is circular arc + + '// ARC : + + '// LINE (Or blank) : + '// coor_x X coordinate of start of line Or centre of arc [m] + '// coor_y Y coordinate of start of line Or centre of arc [m] + '// length length of line Or radius of arc [m] + '// theta1 angle of line from X Or Or to start of arc [°] + '// theta2 angle to end of arc (ignored if line) [°] + '// -- + sName = sName.Replace("""", String.Empty) + sGwaCommand = "GRID_LINE:" + sGwaCommand += "{RVT:" & sid & "}" + sGwaCommand += "," + iGrLine.ToString() + "," + sGwaCommand += sName + "," + If bArc Then + sGwaCommand += "ARC" + End If + sGwaCommand += "," + sGwaCommand += coorX.ToString() + "," + sGwaCommand += coorY.ToString() + "," + sGwaCommand += length.ToString() + "," + sGwaCommand += theta1.ToString() + "," + theta2.ToString() + "," + + m_GSAObject.GwaCommand(sGwaCommand) + Dim iGrLineNew As Integer = Me.HighestGridLine() + Return iGrLine + End Function + Public Function GridLine(ByVal iGrLine As Integer, ByRef name As String, ByRef bArc As Boolean, ByRef sid As String, + ByRef coorX As Double, ByRef coorY As Double, ByRef len As Double, + ByRef theta1 As Double, ByRef theta2 As Double) As Boolean + + + 'GRID_LINE | num | name | arc | coor_x | coor_y | length | theta1 | theta2 + Try + If Not Me.GridLineExists(iGrLine) Then + Return False + End If + + Dim result As String = CStr(m_GSAObject.GwaCommand("GET,GRID_LINE," & iGrLine.ToString())) + Dim arg As String = GsaComUtil.Arg(0, result) + Dim idString As String = GsaComUtil.ExtractId(arg) + If Not String.IsNullOrEmpty(idString) Then + sid = idString + End If + + arg = GsaComUtil.Arg(1, result) + Dim iLine As Integer = CInt(arg) + If Not Int32.Equals(iLine, iGrLine) Then + Return False + End If + + arg = GsaComUtil.Arg(2, result) + name = arg + + arg = GsaComUtil.Arg(3, result) + If arg.Equals("LINE") Then + bArc = False + Else + bArc = True + End If + + arg = GsaComUtil.Arg(4, result) + Double.TryParse(arg, coorX) + + arg = GsaComUtil.Arg(5, result) + Double.TryParse(arg, coorY) + + arg = GsaComUtil.Arg(6, result) + Double.TryParse(arg, len) + + arg = GsaComUtil.Arg(7, result) + Double.TryParse(arg, theta1) + + arg = GsaComUtil.Arg(8, result) + Double.TryParse(arg, theta2) + + sid = m_GSAObject.GetSidTagValue("GRID_LINE", iGrLine, "RVT") + + Catch ex As Exception + Return False + End Try + Return True + End Function + 'write a GSA 1D element + Public Function IsPolyLineExist(ByVal Desc As String, ByRef iPolyLine As Integer) As Boolean + If String.IsNullOrEmpty(Desc.Trim()) Then + Return False + End If + Dim uid As String = "", name As String = "", _desc As String = "" + For iPoly As Integer = 0 To HighestPolyLine() - 1 + If PolyLine(iPoly, uid, name, _desc) Then + If _desc.Trim() = Desc.Trim() Then + iPolyLine = iPoly + Return True + End If + End If + Next + Return False + End Function + Public Function PolyLine(ByVal iPoly As Integer, ByRef sID As String, ByRef sName As String, ByRef sDec As String) As Boolean + + Dim sGwaCommand As String = "", sResult As Integer = 0 + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,POLYLINE," & iPoly.ToString)) + Dim sArg As String = GsaComUtil.Arg(0, sGwaCommand) + Dim idString As String = GsaComUtil.ExtractId(sArg) + If Not String.IsNullOrEmpty(idString) Then + sID = idString + End If + sName = GsaComUtil.Arg(2, sGwaCommand) + + sDec = GsaComUtil.Arg(6, sGwaCommand) + + Return True + End Function + Public Function SetPolyLine(ByVal iPoly As Integer, ByVal sID As String, ByVal sName As String, ByVal sDec As String) As Integer + If (iPoly <= 0) Then + iPoly = Me.HighestPolyLine() + 1 + End If + If String.IsNullOrEmpty(sName) Then + sName = "PolyLine " + iPoly.ToString() + End If + Dim sGwaCommand As String = "" + sGwaCommand = "POLYLINE:" + sGwaCommand += "{RVT:" & sID & "}" + sGwaCommand += "," + iPoly.ToString() 'number + sGwaCommand += "," + sName 'name + sGwaCommand += ",NO_RGB" 'colour + sGwaCommand += ",-1" 'undefined grid plane + sGwaCommand += ",2" 'number of dimension + sGwaCommand += "," + sDec 'point description + + m_GSAObject.GwaCommand(sGwaCommand) + Return iPoly + End Function + Public Function SetGridAreaLoad(ByVal iGridAreaLoad As Integer, ByVal sID As String, ByVal sName As String, ByVal iGrid As Integer, ByVal sPolyDesc As String, ByVal iDir As String, ByVal LoadValue1 As Double, ByVal LoadValue2 As Double, ByVal loadCase As Integer, ByVal bProjected As Boolean, ByVal bGlobal As Boolean, ByVal loadtype As GridLoadType) As Integer + 'LOAD_GRID_AREA.2 | name | grid_surface | area | poly | case | axis | proj | dir | value @end + 'LOAD_GRID_LINE.2 | name | grid_surface | line | poly | case | axis | proj | dir | value_1 | value_2 @end + 'LOAD_GRID_POINT.2 | name | grid_surface | x | y | case | axis | dir | value @end + + If (iGridAreaLoad <= 0) Then + If loadtype = GridLoadType.AREA Then + iGridAreaLoad = Me.HighestGridAreaLoad() + 1 + ElseIf loadtype = GridLoadType.LINE Then + iGridAreaLoad = Me.HighestGridLineLoad() + 1 + Else + iGridAreaLoad = Me.HighestGridPointLoad() + 1 + End If + End If + If String.IsNullOrEmpty(sName) Then + sName = "Grid Area Load " + iGridAreaLoad.ToString() + End If + + Dim sGwaCommand As String = "" + If loadtype = GridLoadType.AREA Then + sGwaCommand = "LOAD_GRID_AREA:" + ElseIf loadtype = GridLoadType.LINE Then + sGwaCommand = "LOAD_GRID_LINE:" + Else + sGwaCommand = "LOAD_GRID_POINT:" + End If + + sGwaCommand += "{RVT:" & sID & "}" + sGwaCommand += "," + sName 'name + sGwaCommand += "," + iGrid.ToString() 'grid surface + If Not loadtype = GridLoadType.POINT Then + sGwaCommand += ",POLYREF" + End If + + sGwaCommand += "," + sPolyDesc.ToString() 'polygon ref + + sGwaCommand += "," + loadCase.ToString() 'load case + + If Not bGlobal Then + sGwaCommand += ",LOCAL" 'Global axis + Else + sGwaCommand += ",GLOBAL" 'Global axis + End If + + If Not loadtype = GridLoadType.POINT Then + If Not bProjected Then + sGwaCommand += ",NO" 'projected Load False + Else + sGwaCommand += ",YES" 'projected Load False + End If + End If + + sGwaCommand += "," + iDir 'Direction + sGwaCommand += "," + LoadValue1.ToString() 'Load Value 1 + + If loadtype = GridLoadType.LINE Then + sGwaCommand += "," + LoadValue2.ToString() 'Load Value + End If + sGwaCommand += ", " 'Is Bridge + m_GSAObject.GwaCommand(sGwaCommand) + Return iGridAreaLoad + End Function + Public Function IsGridAreaLoadExistInDirection(ByVal sidIn As String, ByVal sDirIn As String, ByRef AreaLoadRec As Integer, ByVal loadtype As GridLoadType) As Boolean + For iGridArea As Integer = 0 To HighestGridAreaLoad() - 1 + Dim sID As String = "", sName As String = "", iGrid As Integer = 0, iPolyRef As String = "" + Dim LoadCase As Integer = 0 + Dim sDir As String = "", LoadValue1 As Double = 0, LoadValue2 As Double = 0, bProjected As Boolean = False, bGlobal As Boolean = False + If GetGridAreaLoad(iGridArea, sID, sName, iGrid, iPolyRef, LoadCase, sDir, LoadValue1, LoadValue2, bProjected, bGlobal, loadtype) Then + If sidIn.Trim() = sID.Trim() AndAlso sDirIn.ToLower().Trim() = sDir.ToLower().Trim() Then + AreaLoadRec = iGridArea + Return True + End If + End If + Next + Return False + End Function + Public Function GetGridAreaLoad(ByVal iGridAreaLoad As Integer, ByRef sID As String, ByRef sName As String, ByRef iGrid As Integer, ByRef sPolyDesc As String, ByRef LoadCase As Integer, ByRef sDir As String, ByRef LoadValue1 As Double, ByRef LoadValue2 As Double, ByRef bProjected As Boolean, ByRef bGlobal As Boolean, ByVal loadtype As GridLoadType) As Boolean + 'LOAD_GRID_AREA.2 | name | grid_surface | area | poly | case | axis | proj | dir | value @end + 'LOAD_GRID_LINE.2 | name | grid_surface | line | poly | case | axis | proj | dir | value_1 | value_2 @end + 'LOAD_GRID_POINT.2 | name | grid_surface | x | y | case | axis | dir | value @end + + Dim sGwaCommand As String = "", sResult As Integer = 0 + If loadtype = GridLoadType.AREA Then + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,LOAD_GRID_AREA," & iGridAreaLoad.ToString)) + ElseIf loadtype = GridLoadType.LINE Then + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,LOAD_GRID_LINE," & iGridAreaLoad.ToString)) + Else + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,LOAD_GRID_POINT," & iGridAreaLoad.ToString)) + End If + + Dim sArg As String = GsaComUtil.Arg(0, sGwaCommand) + Dim idString As String = GsaComUtil.ExtractId(sArg) + If Not String.IsNullOrEmpty(idString) Then + sID = idString + End If + + Dim iNextIndex As Integer = 1 + + sName = GsaComUtil.Arg(iNextIndex, sGwaCommand) + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) + + If Integer.TryParse(sArg, sResult) Then + iGrid = sResult + Else + Return False + End If + + If loadtype = GridLoadType.POINT Then + iNextIndex = iNextIndex + 1 'X-coordinate + sPolyDesc = GsaComUtil.Arg(iNextIndex, sGwaCommand) + + iNextIndex = iNextIndex + 1 'Y-coordinate + sPolyDesc = sPolyDesc + "," + GsaComUtil.Arg(iNextIndex, sGwaCommand) + Else + + iNextIndex = iNextIndex + 1 'area/line + iNextIndex = iNextIndex + 1 'polygon description + sPolyDesc = GsaComUtil.Arg(iNextIndex, sGwaCommand) + + End If + + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) + If Not Integer.TryParse(sArg, LoadCase) Then + Return False + End If + + iNextIndex = iNextIndex + 1 + bGlobal = True + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) + If sArg = "LOCAL" Then + bGlobal = False + End If + + + If Not loadtype = GridLoadType.POINT Then + iNextIndex = iNextIndex + 1 + bProjected = True + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) + If sArg = "NO" Then + bProjected = False + End If + + iNextIndex = iNextIndex + 1 + sDir = GsaComUtil.Arg(iNextIndex, sGwaCommand) + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) + + Dim fLoadValue As Double = 0 + If Double.TryParse(sArg, fLoadValue) Then + LoadValue1 = fLoadValue + Else + Return False + End If + + If loadtype = GridLoadType.LINE Then + fLoadValue = 0 + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) + If Double.TryParse(sArg, fLoadValue) Then + LoadValue2 = fLoadValue + Else + Return False + End If + End If + + Else + iNextIndex = iNextIndex + 1 + sDir = GsaComUtil.Arg(iNextIndex, sGwaCommand) + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) + Dim fLoadValue As Double = 0 + If Double.TryParse(sArg, fLoadValue) Then + LoadValue1 = fLoadValue + Else + Return False + End If + End If + Return True + End Function + Public Function IsGridAssociatedWithGridSurface(ByVal iGrid As Integer, ByRef iGridSurf As Integer) As Boolean + Dim uid As String = "", name As String = "", grid As Integer = -1, elem2d As Boolean = False, bSpan2d As Boolean = False + For iSurf As Integer = 0 To HighestGridSurface() - 1 + If GridSurface(iSurf + 1, uid, name, grid, elem2d, bSpan2d) Then + If grid = iGrid Then + iGridSurf = iSurf + 1 + Return True + End If + End If + Next + Return False + End Function + Public Function SetGridSurface(ByVal iGridSurf As Integer, ByVal uid As String, ByVal name As String, ByVal iGrid As Integer, ByVal elem2d As Boolean, ByVal bSpan2d As Boolean) As Integer + + If (iGridSurf <= 0) Then + iGridSurf = Me.HighestGridSurface() + 1 + End If + If String.IsNullOrEmpty(name) Then + name = "Grid Surface " + iGridSurf.ToString() + End If + Dim sGwaCommand As String = "" + sGwaCommand = "GRID_SURFACE:" + sGwaCommand += "{RVT:" & uid & "}" + sGwaCommand += "," + iGridSurf.ToString() 'grid id + sGwaCommand += "," + name 'name + sGwaCommand += "," + iGrid.ToString() 'grid plane + If elem2d Then + sGwaCommand += ",2" 'area type + Else + sGwaCommand += ",1" 'area type + End If + sGwaCommand += ",all" 'element list + sGwaCommand += ",0.001" 'tolerance + If bSpan2d Then + sGwaCommand += ",TWO_GENERAL" 'span direction + Else + sGwaCommand += ",ONE" 'span direction + End If + sGwaCommand += ",0" 'angle + sGwaCommand += ",LEGACY" 'grid expension option + m_GSAObject.GwaCommand(sGwaCommand) + Return iGridSurf + + End Function + Public Function NatureToGsaType(ByVal nature As String) As String + + If nature.ToLower().Contains("dead") Then + Return "LC_PERM_SELF" + End If + If nature.ToLower().Contains("soil") Then + Return "LC_PERM_SOIL" + End If + If nature.ToLower().Contains("notional") Then + Return "LC_PERM_EQUIV" + End If + If nature.ToLower().Contains("prestress") Then + Return "LC_PRESTRESS" + End If + If nature.ToLower().Contains("live") Then + Return "LC_VAR_IMP" + End If + If nature.ToLower().Contains("live") Then + Return "LC_VAR_IMP" + End If + If nature.ToLower().Contains("roof") Then + Return "LC_VAR_ROOF" + End If + If nature.ToLower().Contains("wind") Then + Return "LC_VAR_WIND" + End If + If nature.ToLower().Contains("snow") Then + Return "LC_VAR_SNOW" + End If + If nature.ToLower().Contains("rain") Then + Return "LC_VAR_RAIN" + End If + If nature.ToLower().Contains("ther") OrElse nature.ToLower().Contains("temp") Then + Return "LC_VAR_TEMP" + End If + If nature.ToLower().Contains("equi") Then + Return "LC_VAR_EQUIV" + End If + If nature.ToLower().Contains("accid") Then + Return "LC_ACCIDENTAL" + End If + If nature.ToLower().Contains("earthqua") OrElse nature.ToLower().Contains("seis") Then + Return "LC_EQE_ACC" + End If + Return "LC_PERM_SELF" + End Function + + Public Function SetLoadCase(ByVal iLoadCase As Integer, ByVal uid As String, ByVal name As String, ByVal nature As String) As Integer + + If (iLoadCase <= 0) Then + iLoadCase = Me.HighestLoadCase + 1 + End If + If String.IsNullOrEmpty(name) Then + name = "Load Case " + iLoadCase.ToString() + End If + Dim sGwaCommand As String = "" + sGwaCommand = "LOAD_TITLE:" + sGwaCommand += "{RVT:" & uid & "}" + sGwaCommand += "," + iLoadCase.ToString() 'case no + sGwaCommand += "," + name 'name + sGwaCommand += "," + NatureToGsaType(nature) 'nature + sGwaCommand += ",1,A,NONE,INC_BOTH" + m_GSAObject.GwaCommand(sGwaCommand) + Return iLoadCase + + End Function + Public Function LoadCase(ByVal iLoadCase As Integer, ByRef uid As String, ByRef name As String, ByRef nature As String) As Boolean + Try + Dim sGwaCommand As String = "", sResult As Integer = 0 + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,LOAD_TITLE," & iLoadCase.ToString)) + If String.IsNullOrEmpty(sGwaCommand.Trim()) Then + Return False + End If + Dim sArg As String = GsaComUtil.Arg(0, sGwaCommand) + Dim idString As String = GsaComUtil.ExtractId(sArg) + If Not String.IsNullOrEmpty(idString) Then + uid = idString + End If + name = GsaComUtil.Arg(2, sGwaCommand) + If String.IsNullOrEmpty(name.Trim()) Then + Return False + End If + nature = GsaComUtil.Arg(3, sGwaCommand) + Catch ex As Exception + Return False + End Try + + Return True + End Function + Public Function GridSurface(ByVal iGridSurf As Integer, ByRef uid As String, ByRef name As String, ByRef iGrid As Integer, ByRef elem2d As Boolean, ByRef bSpan2d As Boolean) As Boolean + Try + Dim sGwaCommand As String = "", sResult As Integer = 0 + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,GRID_SURFACE," & iGridSurf.ToString)) + Dim sArg As String = GsaComUtil.Arg(3, sGwaCommand) + If Integer.TryParse(sArg, sResult) Then + iGrid = sResult + End If + sArg = GsaComUtil.Arg(0, sGwaCommand) + Dim idString As String = GsaComUtil.ExtractId(sArg) + If Not String.IsNullOrEmpty(idString) Then + uid = idString + End If + + name = GsaComUtil.Arg(2, sGwaCommand) + + sArg = GsaComUtil.Arg(4, sGwaCommand) + elem2d = False + If Integer.TryParse(sArg, sResult) Then + If sResult = 2 Then + elem2d = True + End If + End If + sArg = GsaComUtil.Arg(7, sGwaCommand) + bSpan2d = True + If sArg = "ONE" Then + bSpan2d = False + End If + Return True + Catch ex As Exception + Return False + End Try + + + End Function + + Public Function ElementCord(ByVal iElem As Integer) As List(Of Integer) + Dim sName As String = "", iProp As Integer = 0, uid As String = "", sTopo As String = "", dBeta As Double = 0 + Dim sRelease As New List(Of String), dOffset As New List(Of Double()), typeMemb As MembType = MembType.BEAM + Dim eType As ElemType = ElemType.EL_BEAM + Dim iTopo As New List(Of Integer), iOrNode As Integer = 0 + Elem1d(iElem, sName, iProp, uid, iTopo, iOrNode, dBeta, sRelease, dOffset, eType, "") + Return iTopo + End Function + Public Function MembCord(ByVal iElem As Integer) As String + Dim sName As String = "", iProp As Integer = 0, uid As String = "", sTopo As String = "", dBeta As Double = 0 + Dim sRelease As New List(Of String), dOffset As New List(Of Double()), typeMemb As MembType = MembType.BEAM + Dim eType As ElemType = ElemType.EL_BEAM + Dim endRestraint1 As String = "" + Dim endRestraint2 As String = "" + Dim iOrNode As Integer = 0 + Member(iElem, sName, iProp, uid, sTopo, iOrNode, dBeta, sRelease, dOffset, typeMemb, endRestraint1, endRestraint2) + Return sTopo + End Function + Public Function RestraintType(ByVal release As String) As String + 'A pin joint is a connection between two objects that allows only relative + 'rotation about a single axis. All translations as well as rotations about + 'any other axis are prevented + release = release.ToUpper() + If (release.Equals("FFFFRR")) Then + Return "Pinned" + ElseIf (release.Equals("RRRRRR")) Then + Return "Free" + Else + Return "Fixed" + End If + End Function + 'write a GSA 1D element + Public Function SetMember(ByVal iElem As Integer, ByVal sName As String, ByVal iProp As Integer, + ByVal sID As String, ByVal sTopo As String, ByVal iOrNode As Integer, + ByVal dBeta As Double, ByVal sRelease As List(Of String), + ByVal dOffset As List(Of Double()), ByVal typeMemb As MembType, + ByVal endRestraint1 As String, ByVal endRestraint2 As String) As Integer + + If (iElem <= 0) Then + iElem = Me.HighestEnt("MEMB") + 1 + End If + 'MEMB0.8 | num | name | colour | type (1D) | prop | group | topology | node | angle | @end + 'mesh_size | is_intersector | analysis_type | fire | limit | time[4] | dummy | @End + 'is_rls { | rls { | k } } | restraint_end_1 | restraint_end_2 | AUTOMATIC | height | load_ref | @end + 'off_auto_x1 | off_auto_x2 | off_auto_internal | off_x1 | off_x2 | off_y | off_z | exposure@End + 'MEMB0.8 | num | name | colour | type (1D) | prop | group | topology | node | angle | @end + 'mesh_size | is_intersector | analysis_type | fire | time[4] | dummy | @End + 'is_rls { | rls { | k } } | restraint_end_1 | restraint_end_2 | EXPLICIT | nump | { point | rest | } | nums | { span | rest | } @end + 'height | load_ref | stud_layout | off_auto_x1 | off_auto_x2 | off_auto_internal | off_x1 | off_x2 | off_y | off_z | exposure @End + 'MEMB0.8 | num | name | colour | type (2D) | prop | group | topology | node | angle | @end + 'mesh_size | is_intersector | analysis_type | fire | time[4] | dummy | @End + 'off_auto_internal | off_z | exposure + + Dim b1D As Boolean = Not Is2D(typeMemb) + dBeta = Math.Round(dBeta, RoundPrecision) + 'Write beam element + Dim sGwaCommand As String = "" + sGwaCommand = "MEMB.8:" + sGwaCommand += "{RVT:" & sID & "}" + sGwaCommand += "," + iElem.ToString() 'number + sGwaCommand += "," + sName 'name + sGwaCommand += ",NO_RGB" 'colour + sGwaCommand += "," + MembTypeStr(typeMemb) 'member type + sGwaCommand += "," + "" 'exposed face + sGwaCommand += "," + iProp.ToString() 'section + sGwaCommand += ",1" 'group + sGwaCommand += "," + sTopo 'number of topo + sGwaCommand += "," + iOrNode.ToString() 'orientation node + sGwaCommand += "," + dBeta.ToString() 'orientation angle + sGwaCommand += ",1,NO" 'mesh size and mesh option + Intersector + If b1D Then + sGwaCommand += "," + "BEAM" 'Analysis type ID + Else + sGwaCommand += "," + "LINEAR" 'Analysis type 2D + End If + sGwaCommand += "," + "0,0.0,0,0,0,0" 'fire resistance, temperature, stages + sGwaCommand += ",ACTIVE" 'member status + If b1D Then + sGwaCommand += "," + sRelease(0) 'start release + sGwaCommand += "," + sRelease(1) 'end release + If (String.IsNullOrEmpty(endRestraint1)) Then + sGwaCommand += "," + RestraintType(sRelease(0)) 'fixity at end1 + Else + sGwaCommand += "," + endRestraint1 'fixity at end1 + End If + + If (String.IsNullOrEmpty(endRestraint2)) Then + sGwaCommand += "," + RestraintType(sRelease(1)) 'fixity at end1 + Else + sGwaCommand += "," + endRestraint2 'fixity at end2 + End If + + sGwaCommand += ",AUTOMATIC" 'Automatic(0) + sGwaCommand += ",0" 'load height + sGwaCommand += "," + CType(LoadPos.SHR_CENTRE, Integer).ToString() 'reference point + + sGwaCommand += ",YES" 'offset flag + sGwaCommand += ",MAN" 'manual offset + sGwaCommand += ",MAN" 'manual offset + + sGwaCommand += "," + dOffset.Item(0)(0).ToString() 'axial offset at start + sGwaCommand += "," + dOffset.Item(1)(0).ToString() 'axial offset at end + sGwaCommand += "," + dOffset.Item(0)(1).ToString() 'transaverse offset + sGwaCommand += "," + dOffset.Item(0)(2).ToString() 'transverse offset + Else + sGwaCommand += "," + dOffset.Item(0)(2).ToString() 'axial offset at start + sGwaCommand += ",NO" 'auto internal offset + End If + m_GSAObject.GwaCommand(sGwaCommand) + Return iElem + End Function + Public Function Member(ByVal iElem As Integer, ByRef sName As String, ByRef iProp As Integer, + ByRef uid As String, ByRef sTopo As String, ByRef iOrNode As Integer, ByRef dBeta As Double, + ByRef sRelease As List(Of String), ByRef dOffset As List(Of Double()), ByRef eMembType As GsaComUtil.MembType, ByRef endRestraint1 As String, ByRef endRestraint2 As String) As Boolean + + If _MemList.ContainsKey(iElem) Then + + Dim nEle As MemberElement = _MemList(iElem) + iElem = nEle.Element + sName = nEle.Name + iProp = nEle.SecPro + uid = nEle.UID + sTopo = nEle.sTopo + sRelease = nEle.Release + iOrNode = nEle.OrientationNode + dBeta = nEle.Beta + dOffset = nEle.Offset + eMembType = nEle.MemberType + endRestraint1 = nEle.Endrestraint1 + endRestraint2 = nEle.Endrestraint2 + Else + Try + If Not Me.EntExists("MEMB", iElem) Then + Return False + End If + uid = "" + dBeta = 0.0 + dOffset = New List(Of Double()) + sRelease = New List(Of String) + Dim sGwaCommand As String = "" + Dim sArg As String = "" + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,MEMB," & iElem.ToString)) + If String.IsNullOrEmpty(sGwaCommand) Then + Return False + End If + + 'MEMB.8 | num | name | colour | type (1D) | prop | group | topology | node | angle | @end + 'mesh_size | is_intersector | analysis_type | fire | limit | time[4] | dummy | @End + 'is_rls { | rls { | k } } | restraint_end_1 | restraint_end_2 | AUTOMATIC | height | load_ref | @end + 'off_auto_x1 | off_auto_x2 | off_auto_internal | off_x1 | off_x2 | off_y | off_z | exposure@End + 'MEMB0.8 | num | name | colour | type (1D) | prop | group | topology | node | angle | @end + 'mesh_size | is_intersector | analysis_type | fire | time[4] | dummy | @End + 'is_rls { | rls { | k } } | restraint_end_1 | restraint_end_2 | EXPLICIT | nump | { point | rest | } | nums | { span | rest | } @end + 'height | load_ref | stud_layout | off_auto_x1 | off_auto_x2 | off_auto_internal | off_x1 | off_x2 | off_y | off_z | exposure @End + 'MEMB0.8 | num | name | colour | type (2D) | prop | group | topology | node | angle | @end + 'mesh_size | is_intersector | analysis_type | fire | time[4] | dummy | @End + 'off_auto_internal | off_z | exposure + sArg = GsaComUtil.Arg(0, sGwaCommand) + Dim idString As String = GsaComUtil.ExtractId(sArg) + Dim moduleVesrion As String = ExtractVesrion(sArg) + + If Not String.IsNullOrEmpty(idString) Then + uid = idString + End If + Dim iNextIndex As Integer = 1 + sArg = GsaComUtil.Arg(1, sGwaCommand) 'number + Debug.Assert(Integer.Equals(iElem, CInt(sArg))) + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'name + sName = sArg + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'color + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'member type + eMembType = MembTypeFromStr(sArg) + + Dim b1D As Boolean = Not Is2D(eMembType) + + iNextIndex = iNextIndex + 1 ' exposed face + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'member section property + iProp = CInt(sArg) + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'group + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'string of topo + sTopo = sArg + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'orientation node + iOrNode = CInt(sArg) + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'beta + dBeta = CDbl(sArg) + + + iNextIndex = iNextIndex + 1 'mesh size + + iNextIndex = iNextIndex + 1 'Intersector + + iNextIndex = iNextIndex + 1 'analysis type + + iNextIndex = iNextIndex + 1 'fire + iNextIndex = iNextIndex + 1 'limiting temperature + iNextIndex = iNextIndex + 1 'time 1 + iNextIndex = iNextIndex + 1 'time 2 + iNextIndex = iNextIndex + 1 'time 3 + iNextIndex = iNextIndex + 1 'time 4 + iNextIndex = iNextIndex + 1 'dummy + + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'dummy + Dim bDummy As Boolean = False + If sArg.Equals("DUMMY") Then + bDummy = True + Else + bDummy = False + End If + If b1D Then + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'release 0 + For Each c As Char In sArg + If c.Equals("K") Then + iNextIndex = iNextIndex + 1 + End If + Next + sRelease.Add(sArg) + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'release 1 + For Each c As Char In sArg + If c.Equals("K") Then + iNextIndex = iNextIndex + 1 + End If + Next + sRelease.Add(sArg) + + iNextIndex = iNextIndex + 1 'connection 1 + endRestraint1 = GsaComUtil.Arg(iNextIndex, sGwaCommand) + + iNextIndex = iNextIndex + 1 'connection 2 + endRestraint2 = GsaComUtil.Arg(iNextIndex, sGwaCommand) + + iNextIndex = iNextIndex + 1 + + 'steel member + Dim restraintOption As Integer = RestraintOptID(Arg(iNextIndex, sGwaCommand)) + If restraintOption.Equals(1) Then 'explicit + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) + Dim nPoint As Integer = 0 + Integer.TryParse(sArg, nPoint) + For value As Integer = 0 To nPoint - 1 + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'point + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'restraint description + Next + 'for span + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) + nPoint = 0 : Integer.TryParse(sArg, nPoint) + For value As Integer = 0 To nPoint - 1 + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'span + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'span's restraint description + Next + + ElseIf restraintOption.Equals(2) Then 'effective length + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'Lyy + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'Lzz + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'Llt + + End If + + iNextIndex = iNextIndex + 1 + + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'load height + Dim Loadheight As Double = CDbl(sArg) + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'Ref point + Dim RefPoint As String = sArg + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'offset + + If sArg.Equals("OFF") Then + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'offset type 1 + Dim OffsetType1 As String = sArg + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'offset type 2 + Dim OffsetType2 As String = sArg + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'x1 + Dim X1 As Double = CDbl(sArg) + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'x2 + Dim X2 As Double = CDbl(sArg) + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'y + Dim y As Double = CDbl(sArg) + + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'z + Dim z As Double = CDbl(sArg) + Dim offset0() As Double = {X1, y, z} + Dim offset1() As Double = {X2, y, z} + dOffset.Add(offset0) + dOffset.Add(offset1) + Else + dOffset.Add({0, 0, 0}) + dOffset.Add({0, 0, 0}) + + End If + Else + iNextIndex = iNextIndex + 1 + sArg = GsaComUtil.Arg(iNextIndex, sGwaCommand) 'z + iNextIndex = iNextIndex + 1 'auto internal offset + Dim z As Double = CDbl(sArg) + Dim offset0() As Double = {0, 0, z} + Dim offset1() As Double = {0, 0, z} + dOffset.Add(offset0) + dOffset.Add(offset1) + End If + + + Dim nEle As New MemberElement + nEle.Element = iElem + nEle.Name = sName + nEle.SecPro = iProp + nEle.UID = uid + nEle.sTopo = sTopo + nEle.Beta = dBeta + nEle.Offset = dOffset + nEle.MemberType = eMembType + nEle.Release = sRelease + nEle.OrientationNode = iOrNode + 'GSA-5631 + nEle.Endrestraint1 = endRestraint1 + nEle.Endrestraint2 = endRestraint2 + _MemList.Add(iElem, nEle) + + Catch ex As Exception + Return False + End Try + End If + Return True + End Function + + Public Function SetElem1d(ByVal iElem As Integer, ByVal name As String, ByVal iProp As Integer, ByVal sID As String, + ByVal iTopoList As List(Of Integer), ByVal iOrNode As Integer, ByVal dBeta As Double, + ByVal sRelease As List(Of String), ByVal dOffset As List(Of Double()), ByVal type As ElemType, Optional ByVal strDummy As String = "") As Integer + + ' EL.4 | num | name | colour | type | prop | group | topo() | orient_node | orient_angle | @br + ' is_rls { | rls { | k } } + ' off_x1 | off_x2 | off_y | off_z | parent_member | dummy @end + + Dim sGwaCommand As String = "" + Dim clr As Color = Color.Black() + + If (iElem <= 0) Then + iElem = Me.HighestEnt("EL") + 1 + End If + 'round + dBeta = Math.Round(dBeta, RoundPrecision) + sGwaCommand = "EL:" + sGwaCommand += "{RVT:" & sID & "}" + sGwaCommand += "," + iElem.ToString() 'number + sGwaCommand += "," + name 'name + sGwaCommand += "," + clr.ToArgb().ToString() 'color + sGwaCommand += "," + ElemDesc(type) 'element type + sGwaCommand += "," + iProp.ToString() 'property + sGwaCommand += ",1" 'group + For Each topo As String In iTopoList + sGwaCommand += "," + topo 'topo + Next + sGwaCommand += "," + iOrNode.ToString() 'orientation node + sGwaCommand += "," + dBeta.ToString() 'orientation angle + sGwaCommand += "," + "RLS" 'is_rls + + For Each rels As String In sRelease + sGwaCommand += "," + rels 'topo + For Each c As Char In rels + If c.Equals("K") Then + sGwaCommand += ",1.0" + End If + Next + Next + + If dOffset.Count > 1 Then + sGwaCommand += "," + dOffset(0)(0).ToString() 'X1 + sGwaCommand += "," + dOffset(1)(0).ToString() 'X2 + sGwaCommand += "," + dOffset(0)(1).ToString() 'Y + sGwaCommand += "," + dOffset(0)(2).ToString() 'Z + Else + sGwaCommand += ",0" 'X1 + sGwaCommand += ",0" 'X2 + sGwaCommand += ",0" 'Y + sGwaCommand += ",0" 'Z + End If + sGwaCommand += "," + strDummy + m_GSAObject.GwaCommand(sGwaCommand) + + Return iElem + End Function + + + 'read a GSA 1D element + Public Function Elem1d(ByVal iElem As Integer, ByRef name As String, ByRef iProp As Integer, ByRef uid As String, + ByRef iTopoList As List(Of Integer), ByRef iOrNode As Integer, ByRef dBeta As Double, + ByRef sRelease As List(Of String), ByRef dOffset As List(Of Double()), ByRef elemType As ElemType, + ByRef strDummy As String) As Boolean + + ' EL.4 | num | name | colour | type | prop | group | topo() | orient_node | orient_angle | @br + ' is_rls { | rls { | k } } + ' off_x1 | off_x2 | off_y | off_z | parent_member | dummy @end + + If _EleList.ContainsKey(iElem) Then + Dim nEle As MemberElement = _EleList(iElem) + iElem = nEle.Element + name = nEle.Name + iProp = nEle.SecPro + uid = nEle.UID + iTopoList = nEle.Topo + + dBeta = nEle.Beta + sRelease = nEle.Release + dOffset = nEle.Offset + iOrNode = nEle.OrientationNode + strDummy = nEle.Dummy + elemType = nEle.ElementType + Else + iTopoList = New List(Of Integer) + dOffset = New List(Of Double()) + sRelease = New List(Of String) + + If Not Me.EntExists("EL", iElem) Then + Return False + End If + + Dim sGwaCommand As String = "" + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,EL," & iElem.ToString)) + + If String.IsNullOrEmpty(sGwaCommand) Then + Return False + End If + + Dim sArg As String + uid = "" + sArg = GsaComUtil.Arg(0, sGwaCommand) + Dim idString As String = GsaComUtil.ExtractId(sArg) + If Not String.IsNullOrEmpty(idString) Then + uid = idString + End If + + name = GsaComUtil.Arg(2, sGwaCommand) + + sArg = GsaComUtil.Arg(4, sGwaCommand) + elemType = Me.ElemTypeFromString(sArg) + + If Not GsaComUtil.ElemTypeIsBeamOrTruss(elemType) Then + Return False + End If + + sArg = GsaComUtil.Arg(1, sGwaCommand) 'number + Debug.Assert(Integer.Equals(iElem, CInt(sArg))) + sArg = GsaComUtil.Arg(5, sGwaCommand) 'property + + 'https://ovearup.atlassian.net/browse/GSA-5998 + Dim splitProperty As String() = sArg.Split("["c) + iProp = CInt(splitProperty(0)) + + sArg = GsaComUtil.Arg(7, sGwaCommand) 'topo 0 + iTopoList.Add(CInt(sArg)) + + sArg = GsaComUtil.Arg(8, sGwaCommand) 'topo 1 + iTopoList.Add(CInt(sArg)) + + sArg = GsaComUtil.Arg(9, sGwaCommand) 'orientation node + Integer.TryParse(sArg, iOrNode) + sArg = GsaComUtil.Arg(10, sGwaCommand) 'orientation angle + Double.TryParse(sArg, dBeta) + + Dim position As Integer = 11 + 'releases + sArg = GsaComUtil.Arg(position, sGwaCommand) + If String.Equals("RLS", sArg) Then + + position += 1 + sArg = GsaComUtil.Arg(position, sGwaCommand) 'release 0 + For Each c As Char In sArg + If c.Equals("K") Then + position += 1 + End If + Next + sRelease.Add(sArg) + position += 1 + sArg = GsaComUtil.Arg(position, sGwaCommand) 'release 1 + For Each c As Char In sArg + If c.Equals("K") Then + position += 1 + End If + Next + sRelease.Add(sArg) + Else + sRelease.Add("FFFFFF") + sRelease.Add("FFFFFF") + End If + + 'offsets + position += 1 + Dim dOff() As Double = New Double() {0, 0, 0, 0} + sArg = GsaComUtil.Arg(position, sGwaCommand) 'offset 0, X1 + Dim X1 As Double = Val(sArg) + + position += 1 + sArg = GsaComUtil.Arg(position, sGwaCommand) 'offset 0, X2 + Dim X2 As Double = Val(sArg) + + position += 1 + sArg = GsaComUtil.Arg(position, sGwaCommand) 'offset 0, Y + Dim Y As Double = Val(sArg) + + position += 1 + sArg = GsaComUtil.Arg(position, sGwaCommand) 'offset 0, Z + Dim Z As Double = Val(sArg) + + Dim dOff_i() As Double = New Double() {0, 0, 0} + dOff_i(0) = X1 + dOff_i(1) = Y + dOff_i(2) = Z + dOffset.Add(dOff_i) + + Dim dOff_j() As Double = New Double() {0, 0, 0} + dOff_j(0) = X2 + dOff_j(1) = Y + dOff_j(2) = Z + dOffset.Add(dOff_j) + + position += 1 + strDummy = GsaComUtil.Arg(position, sGwaCommand) + + Dim nEle As MemberElement = New MemberElement() + nEle.Element = iElem + nEle.Name = name + nEle.SecPro = iProp + nEle.UID = uid + nEle.Topo = iTopoList + ' nEle.OrientationNode = iOrNode + nEle.Beta = dBeta + nEle.Release = sRelease + nEle.Offset = dOffset + nEle.Dummy = strDummy + nEle.OrientationNode = iOrNode + nEle.ElementType = elemType + _EleList.Add(iElem, nEle) + End If + Return True + End Function + + Public Function Prop2D(ByVal i2dprop As Integer, ByRef sidFromGsa As String, ByRef usage As SectionUsage, ByRef name As String, ByRef description As String, ByRef ematType As MembMat, ByRef iMat As Integer, ByRef eType As Type2D) As Boolean + ' PROP_2D.8 | num | name | colour | type | axis | mat | mat_type | grade | design | profile | ref_pt | ref_z | + ' mass | flex | shear | inplane | weight | @end + Try + + Dim sGwaCommand As String = CStr(m_GSAObject.GwaCommand("GET,PROP_2D," & i2dprop.ToString)) + Dim sArg As String = GsaComUtil.Arg(0, sGwaCommand) + usage = SectionUsage.INVALID + Dim sidList As New SortedList(Of String, String) + Dim sid_string As String = GsaComUtil.ExtractId(sArg) + Me.ParseNestedSid(sid_string, sidList) + If sidList.ContainsKey(GsaComUtil.SectionSid_Usage) Then + Dim usageString As String = sidList(GsaComUtil.SectionSid_Usage) + If String.Equals(usageString, SectionUsage.COLUMNS.ToString()) Then + usage = SectionUsage.COLUMNS + ElseIf String.Equals(usageString, SectionUsage.FRAMING.ToString()) Then + usage = SectionUsage.FRAMING + ElseIf String.Equals(usageString, SectionUsage.SLAB.ToString()) Then + usage = SectionUsage.SLAB + ElseIf String.Equals(usageString, SectionUsage.WALL.ToString()) Then + usage = SectionUsage.WALL + End If + Else + usage = SectionUsage.INVALID ' for now + End If + + If sidList.ContainsKey(GsaComUtil.SectionSid_Symbol) Then + sidFromGsa = sidList(GsaComUtil.SectionSid_Symbol) + End If + + name = GsaComUtil.Arg(2, sGwaCommand) + sArg = GsaComUtil.Arg(4, sGwaCommand) + eType = Type2DFromStr(sArg) + Dim iIndex As Integer = 6 + sArg = GsaComUtil.Arg(iIndex, sGwaCommand) + Dim nLayer As Integer = CType(sArg, Integer) + If nLayer < 0 Then + iIndex = iIndex + 3 * Math.Abs(nLayer) + Else + iIndex = iIndex + 1 + End If + sArg = GsaComUtil.Arg(iIndex, sGwaCommand) + ematType = MembMatFromStr(sArg) + + iIndex = iIndex + 1 + sArg = GsaComUtil.Arg(iIndex, sGwaCommand) + iMat = CType(sArg, Integer) + + iIndex = iIndex + 2 + description = GsaComUtil.Arg(iIndex, sGwaCommand) + Catch ex As Exception + Return False + End Try + Return True + End Function + Public Function IsEqual(ByRef pt1 As Double(), ByRef pt2 As Double()) As Boolean + Dim bEqual As Boolean = False + bEqual = IsEqual(pt1(0), pt2(0), 0.01) + If bEqual.Equals(False) Then + Return False + End If + bEqual = IsEqual(pt1(1), pt2(1), 0.01) + If bEqual.Equals(False) Then + Return False + End If + bEqual = IsEqual(pt1(2), pt2(2), 0.01) + If bEqual.Equals(False) Then + Return False + End If + Return bEqual + End Function + + Public Function SetSection(ByVal iSec As Integer, ByVal sName As String, ByVal uid As String, ByVal usage As SectionUsage, + ByVal iAnalysisMat As Integer, ByVal sDesc As String, ByVal eMatType As MembMat, + ByVal justification As String, Optional ByVal bNameMap As Boolean = False, Optional ByVal bDescMap As Boolean = False) As Integer + '// PROP_SEC.3 | num | name | colour | mat | grade | anal | desc | cost @end + Dim sGwaCommand As String = "" + If (iSec <= 0) Then + iSec = HighestSection() + 1 + End If + Dim sid As String = "{" & GsaComUtil.SectionSid_Symbol & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" + If (bDescMap) Then + sid = "{" & "DESCRIPTION" & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" + End If + If (bNameMap) Then + sid = "{" & "NAME" & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" + End If + + sGwaCommand = "PROP_SEC:" + sGwaCommand += "{RVT:" & sid & "}" + sGwaCommand += "," & iSec.ToString() 'number + sGwaCommand += "," & sName 'name + sGwaCommand += ",NO_RGB" 'colour + sGwaCommand += "," & MembMatStr(eMatType) 'material type + sGwaCommand += "," & iAnalysisMat.ToString() 'analysis material + sGwaCommand += ",0" 'grade + sGwaCommand += "," & sDesc 'description + sGwaCommand += ",0" 'cost + sGwaCommand += "," & justification 'justification + sGwaCommand += ",0,0" 'offset + m_GSAObject.GwaCommand(sGwaCommand) + Return iSec + End Function + + + Public Function SetSectionSid(ByVal iSec As Integer, ByVal uid As String, ByVal usage As SectionUsage, Optional ByVal bNameMap As Boolean = False, Optional ByVal bDescMap As Boolean = False) As Boolean + Dim sid As String = "{" & GsaComUtil.SectionSid_Symbol & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" + If (bDescMap) Then + sid = "{" & "DESCRIPTION" & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" + End If + If (bNameMap) Then + sid = "{" & "NAME" & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" + End If + Return Me.SetSid("PROP_SEC", iSec, sid) + End Function + + Public Function SetSectionSid2D(ByVal iSec As Integer, ByVal uid As String, ByVal usage As SectionUsage) As Boolean + Dim sid As String = "{" & GsaComUtil.SectionSid_Symbol & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" + Return Me.SetSid("PROP_2D", iSec, sid) + End Function + 'read a GSA Section + Public Function Section(ByVal iSec As Integer, ByRef sName As String, ByRef sid As String, ByRef usage As GsaComUtil.SectionUsage, ByRef iAnalysisMat As Integer, ByRef sDesc As String, ByRef eMatType As GsaComUtil.MembMat, ByRef justification As String, Optional ByRef MapOp As String = "") As Boolean + + Try + If _SecList.ContainsKey(iSec) Then + Dim gsaSec As GSASection = _SecList(iSec) + iSec = gsaSec.Number + sName = gsaSec.Name + sid = gsaSec.Sid + usage = CType(gsaSec.SecUsage, SectionUsage) + sDesc = gsaSec.Desc + iAnalysisMat = gsaSec.AnalysisMat + MapOp = gsaSec.MapOp + eMatType = gsaSec.MaterialType + justification = gsaSec.justification + Else + 'PROP_SEC.3 | num | name | colour | mat | grade | anal | desc | cost @end + If Not SectionExists(iSec) Then + Return False + End If + Dim gsaSec As New GSASection() + Dim sGwaCommand As String = "" + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,PROP_SEC," & iSec.ToString)) + If String.IsNullOrEmpty(sGwaCommand) Then + Return False + End If + + Dim sArg As String + sArg = GsaComUtil.Arg(0, sGwaCommand) + Dim sidList As New SortedList(Of String, String) + Dim sid_string As String = GsaComUtil.ExtractId(sArg) + Me.ParseNestedSid(sid_string, sidList) + + If sidList.ContainsKey(GsaComUtil.SectionSid_Usage) Then + Dim usageString As String = sidList(GsaComUtil.SectionSid_Usage) + If String.Equals(usageString, SectionUsage.COLUMNS.ToString()) Then + usage = SectionUsage.COLUMNS + ElseIf String.Equals(usageString, SectionUsage.FRAMING.ToString()) Then + usage = SectionUsage.FRAMING + End If + Else + usage = SectionUsage.INVALID ' for now + End If + gsaSec.SecUsage = usage + If sidList.ContainsKey(GsaComUtil.SectionSid_Symbol) Then + sid = sidList(GsaComUtil.SectionSid_Symbol) + End If + MapOp = "SID" + If sidList.ContainsKey("DESCRIPTION") Then + MapOp = "DESC" + sid = sidList("DESCRIPTION") + End If + If sidList.ContainsKey("NAME") Then + MapOp = "NAME" + sid = sidList("NAME") + End If + gsaSec.Sid = sid + gsaSec.MapOp = MapOp + + sArg = GsaComUtil.Arg(1, sGwaCommand) 'number + Debug.Assert(Integer.Equals(iSec, CInt(sArg))) + gsaSec.Number = iSec + sArg = GsaComUtil.Arg(2, sGwaCommand) 'name + sName = sArg + gsaSec.Name = sName + + sArg = GsaComUtil.Arg(4, sGwaCommand) 'material type + eMatType = MembMatFromStr(sArg) + gsaSec.MaterialType = eMatType + + sArg = GsaComUtil.Arg(5, sGwaCommand) 'Analysis material + iAnalysisMat = CInt(sArg) + gsaSec.AnalysisMat = iAnalysisMat + + sArg = GsaComUtil.Arg(7, sGwaCommand) 'description + sDesc = sArg.Replace("%", " ") + gsaSec.Desc = sDesc + + justification = GsaComUtil.Arg(9, sGwaCommand) 'justification + gsaSec.justification = justification + _SecList.Add(iSec, gsaSec) + End If + Catch ex As Exception + Return False + End Try + Return True + End Function + Function Is2D(ByVal type As MembType) As Boolean + If type.Equals(MembType.GENERIC_2D) OrElse type.Equals(MembType.WALL) OrElse type.Equals(MembType.SLAB) Then + Return True + End If + Return False + End Function + Function SectionUsageType(ByVal b2D As Boolean, ByVal strEnt As String, ByVal iSecNum As Integer, ByVal strVert As String, ByVal strInc As String, ByVal bFromMemeb As Boolean) As SectionUsage + + Dim iHgstelem As Integer = HighestEnt(strEnt) + Dim iEnt As Integer + Dim bFram As Boolean = False + Dim bColm As Boolean = False + Dim bSlab As Boolean = False + Dim bWall As Boolean = False + + + For iEnt = 1 To iHgstelem + + Dim iProp As Integer = 1, uID As String = "" + Dim iOrNode As Integer = 0, dBeta As Double = 0 + Dim sRelease As List(Of String) = Nothing + Dim dOffset As List(Of Double()) = Nothing + Dim eMembtype As MembType = MembType.UNDEF + Dim eMembMattype As MembMat = MembMat.UNDEF + + Dim eletype As ElemType = ElemType.EL_BAR + + Dim sName As String = "", sEleList As String = "" + Dim x As Double = 0.0, y As Double = 0.0, z As Double = 0.0 + Dim x1 As Double = 0.0, y1 As Double = 0.0, z1 As Double = 0.0 + Dim strDummy As String = "" + Dim dFacetval As Double = 0 + Dim iGeom As Integer = 0 + Dim dRadius As Double = 0 + Dim iTopo2 As Integer = 0 + Dim endRestraint1 As String = "" + Dim endRestraint2 As String = "" + ' Dim Mat As GsaComUtil.MembMat + Dim bOut As Boolean = False + Dim iTopoList As New List(Of Integer) + Dim sTopo As String = "" + Dim eEntType As EntType = EntType.SEL_MEMBER + If "MEMB" = strEnt Then + bOut = Member(iEnt, sName, iProp, uID, sTopo, iOrNode, dBeta, sRelease, dOffset, eMembtype, endRestraint1, endRestraint2) + eEntType = EntType.SEL_MEMBER + If Not bOut Then + Continue For + End If + If Not b2D.Equals(Is2D(eMembtype)) Then + Continue For + End If + Else + eEntType = EntType.SEL_ELEM + bOut = Elem1d(iEnt, sName, iProp, uID, iTopoList, iOrNode, dBeta, sRelease, dOffset, eletype, strDummy) + If Not bOut Then + Continue For + End If + If Not ElemTypeIsBeamOrTruss(eletype) Then + Continue For + End If + End If + + If (iProp <> iSecNum) Then + Continue For + End If + + + Dim bVertical As Boolean = EntIsVertical(iEnt, eEntType) + Dim bHoriZontal As Boolean = EntIsHorizontal(iEnt, eEntType) + If b2D Then + bVertical = Not bHoriZontal + End If + + If (bFromMemeb) Then + If eMembtype.Equals(MembType.BEAM) Then + bFram = True + Continue For + ElseIf eMembtype.Equals(MembType.COLUMN) Then + bColm = True + Continue For + ElseIf eMembtype.Equals(MembType.SLAB) Then + bSlab = True + Continue For + ElseIf eMembtype.Equals(MembType.WALL) Then + bWall = True + Continue For + End If + Else + If bVertical Then + If strVert.Contains("Columns") Then + bColm = True + Else + bFram = True + End If + bWall = True + Else + If bHoriZontal Then + 'horizontal + bFram = True + Else + 'inclined + If strInc.Contains("Columns") Then + bColm = True + Else + bFram = True + End If + End If + bSlab = True + End If + End If + + If b2D Then + If bSlab AndAlso bWall Then + Return SectionUsage.INVALID + End If + Else + If bFram AndAlso bColm Then + Return SectionUsage.INVALID + End If + End If + Next + + Dim iFram As Integer = 1 + Dim iColm As Integer = 2 + Dim iSlab As Integer = 3 + Dim iWall As Integer = 4 + If b2D Then + If bSlab AndAlso bWall Then + Return SectionUsage.INVALID + End If + If (bSlab) Then + Return SectionUsage.SLAB + End If + If (bWall) Then + Return SectionUsage.WALL + End If + Else + If bFram AndAlso bColm Then + Return SectionUsage.INVALID + End If + If (bFram) Then + Return SectionUsage.FRAMING + End If + If (bColm) Then + Return SectionUsage.COLUMNS + End If + End If + Return SectionUsage.NOT_USED + + End Function + + Public Shared Function IsEqual(ByVal d1 As Double, ByVal d2 As Double, ByVal Tol As Double) As Boolean + If Abs(d1 - d2) < Tol Then + Return True + Else + Return False + End If + End Function + + Public Function EntIsVertical(ByVal element As Integer, ByVal eType As EntType) As Boolean + Dim iResult As Boolean = CType(m_GSAObject.ElemIsVertical(element, eType), Boolean) + Return iResult + End Function + Public Function EntIsHorizontal(ByVal element As Integer, ByVal eType As EntType) As Boolean + Dim iResult As Boolean = CType(m_GSAObject.ElemIsHorizontal(element, eType), Boolean) + Return iResult + + End Function + Public Function IsVertical(ByVal element As Integer) As Boolean + If (_IsVet.ContainsKey(element)) Then + Return _IsVet(element) + Else + Dim iResult As Integer = m_GSAObject.ElemIsVertical(element, m_eSelType) + _IsVet.Add(element, CType(iResult, Boolean)) + Return CType(iResult, Boolean) + End If + End Function + Public Function IsHorizontal(ByVal element As Integer) As Boolean + If (_IsHoz.ContainsKey(element)) Then + Return _IsHoz(element) + Else + Dim iResult As Integer = m_GSAObject.ElemIsHorizontal(element, m_eSelType) + _IsHoz.Add(element, CType(iResult, Boolean)) + Return CType(iResult, Boolean) + End If + End Function + Public Function SetProp2D(ByVal iProp As Integer, ByVal uid As String, ByVal usage As GsaComUtil.SectionUsage, ByVal sName As String, ByVal description As String, ByVal eType As Type2D, ByVal eMaterType As GsaComUtil.MembMat, ByVal iMat As Integer) As Integer + 'PROP_2D.8 | num | name | colour | type | axis | mat | mat_type | grade | design | profile | ref_pt | ref_z | + 'mass | flex | shear | inplane | weight | @end + If (iProp <= 0) Then + iProp = HighestProp2d() + 1 + End If + sName = sName.Replace("""", String.Empty) + Dim sid As String = "{" & GsaComUtil.SectionSid_Symbol & ":" & uid & "}{" & GsaComUtil.SectionSid_Usage & ":" & usage.ToString() & "}" + Dim sGwaCommand As String = "PROP_2D:" + sGwaCommand += "{RVT:" & sid & "}" + "," + sGwaCommand += iProp.ToString() + "," + sGwaCommand += sName + "," + sGwaCommand += "NO_RGB," 'colour + sGwaCommand += eType.ToString() + "," ' 2D element type + sGwaCommand += "GLOBAL," + sGwaCommand += "0," ' analysis material + sGwaCommand += eMaterType.ToString() + "," + sGwaCommand += iMat.ToString() + "," 'undefined + sGwaCommand += "0," 'slab design peoperty + sGwaCommand += description + "," + sGwaCommand += "CENTROID," 'refrence point centroid + sGwaCommand += "0.0," 'set defuault offset to 0 + sGwaCommand += "0.0,100%,100%,100%,100%" + m_GSAObject.GwaCommand(sGwaCommand) + Return iProp + End Function + 'write a GSA Material + Public Function SetMaterial(ByVal iMat As Integer, ByVal sName As String, ByVal sid As String, ByVal sDesc As String, + ByVal dE As Double, ByVal dNu As Double, ByVal dG As Double, ByVal dRho As Double, ByVal dAlpha As Double, + ByVal dDamp As Double) As Integer + Dim sGwaCommand As String = "" + + If (iMat <= 0) Then + iMat = HighestMaterial() + 1 + End If + ' ++ + 'MAT_ANAL | num | MAT_ELAS_ISO | name | colour | 6 | E | nu | rho | alpha | G | damp | 0 | 0 | env | rebar | + 'country | variant | grade | eE | eCO2 | recycle | user | + '{ country | variant | grade | eE | eCO2 | recycle | user } + sGwaCommand = "MAT_ANAL:" + sGwaCommand += "{RVT:" & sid & "}" + sGwaCommand += "," & iMat.ToString() 'number + sGwaCommand += ",MAT_ELAS_ISO" '@desc + sGwaCommand += "," & sName 'name + sGwaCommand += ",NO_RGB" 'color + sGwaCommand += ",6" 'number of parameter + sGwaCommand += "," & dE.ToString + sGwaCommand += "," & dNu.ToString + sGwaCommand += "," & dRho.ToString + sGwaCommand += "," & dAlpha.ToString + sGwaCommand += "," & dG.ToString + sGwaCommand += "," & dDamp.ToString + sGwaCommand += ",0,0" + m_GSAObject.GwaCommand(sGwaCommand) + Return iMat + End Function + + 'read a GSA Material + Public Function Material(ByVal iMat As Integer, ByRef sName As String, ByRef sid As String, ByRef sDesc As String, + ByRef dE As Double, ByRef dNu As Double, ByRef dG As Double, ByRef dRho As Double, ByRef dAlpha As Double, + ByRef dDamp As Double) As Boolean + If Not MaterialExists(iMat) Then + Return False + End If + ' ++ + 'MAT_ANAL | num | MAT_ELAS_ISO | name | colour | 6 | E | nu | rho | alpha | G | damp | 0 | 0 | env | rebar | + 'country | variant | grade | eE | eCO2 | recycle | user | + '{ country | variant | grade | eE | eCO2 | recycle | user } + + Dim sGwaCommand As String = "" + Dim sArg As String + + sGwaCommand = CStr(m_GSAObject.GwaCommand("GET,MAT_ANAL," & iMat.ToString)) + If String.IsNullOrEmpty(sGwaCommand) Then + Return False + End If + Dim iCount As Integer = 0 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) + sid = GsaComUtil.ExtractId(sArg) ' sid + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) 'number + Debug.Assert(Integer.Equals(iMat, CInt(sArg))) + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) 'description + sDesc = sArg + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) 'name + sName = sArg + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) 'color + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) 'num parameter + + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) + dE = Val(sArg) + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) + dNu = Val(sArg) + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) + dRho = Val(sArg) + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) + dAlpha = Val(sArg) + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) + dG = Val(sArg) + + iCount = iCount + 1 + sArg = GsaComUtil.Arg(iCount, sGwaCommand) + dDamp = Val(sArg) + + Return True + + End Function + Function RestraintOptID(ByVal opt As String) As Integer + Dim iOption As Integer = 0 + Select Case opt + Case "AUTOMATIC", "0" + iOption = 0 + Case "EXPLICIT", "1" + iOption = 1 + Case "EFF_LEN", "2" + iOption = 2 + Case Else + iOption = 0 + End Select + Return iOption + End Function + Function ElemTypeFromString(ByVal sKey As String) As ElemType + + ' strip the string of sid if any + If sKey.Contains(":") Then + sKey = sKey.Substring(0, sKey.IndexOf(":")) + End If + ' Get the element type corresponding to a keyword + Dim etype As ElemType = ElemType.EL_UNDEF + + Select Case sKey + Case "MEMB", "MEMB" + etype = ElemType.EL_BEAM + Case "BEAM" + etype = ElemType.EL_BEAM + Case "BAR" + etype = ElemType.EL_BAR + Case "TIE" + etype = ElemType.EL_TIE + Case "STRUT" + etype = ElemType.EL_STRUT + Case "SPRING" + etype = ElemType.EL_SPRING + Case "LINK" + etype = ElemType.EL_LINK + Case "CABLE" + etype = ElemType.EL_CABLE + Case "QUAD4" + etype = ElemType.EL_QUAD4 + Case "QUAD8" + etype = ElemType.EL_QUAD8 + Case "TRI3" + etype = ElemType.EL_TRI3 + Case "TRI6" + etype = ElemType.EL_TRI6 + Case Else + etype = ElemType.EL_UNDEF + End Select + + Return etype + End Function + + Public Sub SetGsaModelUnits(ByVal units As GsaComUtil.Units) + Select Case units + Case GsaComUtil.Units.IMPERIAL + m_GSAObject.GwaCommand("UNIT_DATA,FORCE,lbf") + m_GSAObject.GwaCommand("UNIT_DATA,LENGTH,ft") 'used for section property unit conversion: A, I... + m_GSAObject.GwaCommand("UNIT_DATA,DISP,in") 'Gen_SectionMatchDesc uses the DISP units for interpreting general section dimensions + m_GSAObject.GwaCommand("UNIT_DATA,SECTION,in") + m_GSAObject.GwaCommand("UNIT_DATA,MASS,lb") + m_GSAObject.GwaCommand("UNIT_DATA,TIME,s") + m_GSAObject.GwaCommand("UNIT_DATA,TEMP,°F") + m_GSAObject.GwaCommand("UNIT_DATA,STRESS,kip/in²") + m_GSAObject.GwaCommand("UNIT_DATA,ACCEL,ft/s²") + Case GsaComUtil.Units.METRIC + m_GSAObject.GwaCommand("UNIT_DATA,FORCE,N") + m_GSAObject.GwaCommand("UNIT_DATA,LENGTH,m") 'used for section property unit conversion: A, I... + m_GSAObject.GwaCommand("UNIT_DATA,DISP,m") 'Gen_SectionMatchDesc uses the DISP units for interpreting general section dimensions + m_GSAObject.GwaCommand("UNIT_DATA,SECTION,m") + m_GSAObject.GwaCommand("UNIT_DATA,MASS,kg") + m_GSAObject.GwaCommand("UNIT_DATA,TIME,s") + m_GSAObject.GwaCommand("UNIT_DATA,TEMP,°F") + m_GSAObject.GwaCommand("UNIT_DATA,STRESS,N/m²") + m_GSAObject.GwaCommand("UNIT_DATA,ACCEL,m/s²") + End Select + End Sub + Public Function GetGsaModelUnit(ByVal units As String) As String + Dim commandObj As Object = m_GSAObject.GwaCommand("GET,UNIT_DATA," + units.ToUpper()) + If commandObj Is Nothing Then + Return "" + End If + Dim commandResult As String = commandObj.ToString() + Return GsaComUtil.Arg(2, commandResult) + End Function + ''' + ''' CAUTION: Special function for use ONLY for setting material units + ''' + ''' + ''' + Public Sub SetGsaTemporaryUnitsMaterial(ByRef unitStrings As String()) + ' for setting material bizzare unit factors only + For Each unitString As String In unitStrings + m_GSAObject.GwaCommand(unitString) + Next + End Sub + Function ListName(ByVal iList As Integer) As String + 'LIST | num | name | type | list + If Not Me.ListExists(iList) Then + Return Nothing + End If + Dim result As String = CStr(m_GSAObject.GwaCommand("GET,LIST," & iList.ToString())) + Dim parts As String() = result.Split(New Char() {","c}) + Debug.Assert(parts.Length > 2) + Return parts(2) + + End Function + Public Function ListToString(ByRef lists As List(Of Integer)) As String + Dim cStrItem As String = "" + For Each it As Integer In lists + cStrItem = cStrItem + " " + it.ToString() + Next + Return cStrItem.Trim() + End Function + Public Function ListToArcString(ByRef lists As List(Of Integer)) As String + Debug.Assert(lists.Count.Equals(3)) + Dim cStrItem As String = lists(0).ToString() + " a " + lists(1).ToString() + " " + lists(2).ToString() + Return cStrItem.Trim() + End Function + Public Sub StringTolist(ByVal sTopo As String, ByRef orderedNodes As List(Of List(Of Integer)), ByRef arcNode As List(Of Integer), ByRef voids As List(Of List(Of Integer))) + + orderedNodes = New List(Of List(Of Integer)) + arcNode = New List(Of Integer) + voids = New List(Of List(Of Integer)) + If sTopo Is Nothing + Return + End If + Dim pattern As String = "(\(?[0-9a]\s*\)?)+|([AVLP][(]([0-9a]\s*)+[)])" + Dim rg As New Regex(pattern) + Dim items As New List(Of String) + For Each item As Match In rg.Matches(sTopo) + items.Add(item.Value) + Next + + + For Each item As String In items + Dim voidList As New List(Of Integer) + Dim solidList As New List(Of Integer) + Dim words As String() = item.Split(New Char() {" "c}) + Dim isAcrNode As Boolean = False + If item.Contains("P") OrElse item.Contains("L") Then + Continue For + End If + For Each word As String In words + If word.Trim().Equals("a") Then + isAcrNode = True + Continue For + End If + Dim wordString As String = word.Trim().Replace("(", "").Replace("V", "").Replace("A", "").Replace(")", "") + Dim nodeId As Integer = 0 + If Integer.TryParse(wordString, nodeId) Then + If item.Contains("V(") Then + voidList.Add(nodeId) + Else + solidList.Add(nodeId) + End If + If isAcrNode Then + arcNode.Add(nodeId) + isAcrNode = False + End If + End If + Next + If solidList.Count > 0 Then + orderedNodes.Add(solidList) + End If + If voidList.Count > 0 Then + voids.Add(voidList) + End If + Next + End Sub + Private Function ListString(ByVal iList As Integer) As String + If Not Me.ListExists(iList) Then + Return Nothing + End If + Dim list As String = CStr(m_GSAObject.GwaCommand("GET, LIST," & iList.ToString())) + Return list + End Function + Public Function ListTypeIsMember(ByVal iList As Integer) As Boolean + Dim listString As String = Me.ListString(iList) + If String.IsNullOrEmpty(listString) Then + Return False + End If + If listString.Contains("MEMB") Then + Return True + Else + Return False + End If + End Function + Public Function ListTypeIsElement(ByVal iList As Integer) As Boolean + Dim listString As String = Me.ListString(iList) + If String.IsNullOrEmpty(listString) Then + Return False + End If + If listString.Contains("ELEM") Then + Return True + Else + Return False + End If + End Function + Function ListItemsInList(ByVal iList As Integer) As List(Of Integer) + Dim check As Object = m_GSAObject.GwaCommand("EXIST,LIST," & iList.ToString()) + Dim iCheck As Integer = 0 + + Dim items As New List(Of Integer) + Int32.TryParse(check.ToString(), iCheck) + If 0 = iCheck Then + Return items + End If + + Dim resultObj As Object = m_GSAObject.GwaCommand("GET,LIST," & iList.ToString()) + If resultObj Is Nothing Then + Return items + End If + + Dim result As String = resultObj.ToString(), sEnt As String = "", listType As String = "" + If result.Contains("ELEMENT") Then + sEnt = "EL" + listType = "ELEM" + ElseIf result.Contains("MEMB") Then + listType = "MEMB" + sEnt = "MEMB" + Else + Return items + End If + + Dim parts As String() = result.Split(New Char() {","c}, StringSplitOptions.None) + + Dim nElem As Integer = CInt(m_GSAObject.GwaCommand("HIGHEST," & sEnt)) + If nElem = 0 Then + Return items + End If + For i As Integer = 1 To nElem + If Val(m_GSAObject.GwaCommand("EXIST," & sEnt & "," & i.ToString())) = 0 Then + Continue For + End If + If (CBool(m_GSAObject.IsItemIncluded(listType, i, parts(4)))) Then + items.Add(i) + End If + Next + Return items + End Function + Function ElemDesc(ByVal eType As ElemType) As String + + ' Get a string that describes the element + ElemDesc = "UNDEF" + If (eType = ElemType.EL_GROUND) Then + ElemDesc = "GROUND" + ElseIf (eType = ElemType.EL_MASS) Then + ElemDesc = "MASS" + ElseIf (eType = ElemType.EL_BEAM) Then + ElemDesc = "BEAM" + ElseIf (eType = ElemType.EL_BAR) Then + ElemDesc = "BAR" + ElseIf (eType = ElemType.EL_TIE) Then + ElemDesc = "TIE" + ElseIf (eType = ElemType.EL_STRUT) Then + ElemDesc = "STRUT" + ElseIf (eType = ElemType.EL_SPRING) Then + ElemDesc = "SPRING" + ElseIf (eType = ElemType.EL_LINK) Then + ElemDesc = "LINK" + ElseIf (eType = ElemType.EL_CABLE) Then + ElemDesc = "CABLE" + ElseIf (eType = ElemType.EL_SPACER) Then + ElemDesc = "SPACER" + ElseIf (eType = ElemType.EL_QUAD4) Then + ElemDesc = "QUAD4" + ElseIf (eType = ElemType.EL_QUAD8) Then + ElemDesc = "QUAD8" + ElseIf (eType = ElemType.EL_TRI3) Then + ElemDesc = "TRI3" + ElseIf (eType = ElemType.EL_TRI6) Then + ElemDesc = "TRI6" + End If + + End Function + + Function CATSectionToSNFamily(ByVal parts As String(), ByVal usage As SectionUsage, + ByRef familyName As String) As Boolean + + familyName = "" + Dim catAbr As String = parts(1) + If SectionUsage.FRAMING = usage Then + Select Case catAbr + Case "C", "HP", "L", "M", "MC", "MT", "P", "PX", "PXX", "S", "ST", "TS", "W", "WT" + familyName += "American_" + Case "A-CHS250", "A-CHS350", "A-EA", "A-PFC", "A-RHS350", "A-RHS450", "A-RSJs", "A-SHS350", "A-SHS450", "A-UA", "A-UB", "A-UBP", "A-UC" + familyName += "Australian_" + Case "BP", "CH", "CHS", "EA", "PFC", "RHS", "SHS", "TUB", "TUC", "UA", "UB", "UC", "UJ" + familyName += "British_" + Case "UKA", "UKB", "UKBP", "UKC", "UKPFC" + familyName += "Corus Advance_" + Case Else + familyName = "" + Return False + End Select + ElseIf SectionUsage.COLUMNS = usage Then + Select Case catAbr + Case "HP", "M", "P", "S", "W" + familyName += "American_" + Case "A-CHS250", "A-CHS350", "A-RHS350", "A-RHS450", "A-RSJs", "A-SHS350", "A-SHS450", "A-UB", "A-UBP", "A-UC" + familyName += "Australian_" + Case "BP", "CH", "CHS", "RHS", "SHS", "UB", "UC", "UJ" + familyName += "British_" + Case "UKB", "UKBP", "UKC" + familyName += "Corus Advance_" + Case Else + familyName = "" + Return False + End Select + End If + familyName += catAbr + "_" + usage.ToString().ToLower() + Return True + End Function + ' From an STD section, find out which rfa file is to be used + ' and the dimensions of the section + Function STDSectionToSNFamily(ByRef parts As String(), ByVal usage As SectionUsage, ByRef familyName As String) As Boolean + + Debug.Assert(String.Equals(parts(0), "STD")) + Dim cf As Double = 3.28 / 1000 + + Dim sShape As String = parts(1) + Dim shapeSubString As String() = sShape.Split(New Char() {"("c, ")"c}) + If shapeSubString.Length > 1 Then + sShape = shapeSubString(0) + Select Case shapeSubString(1) + Case "m" + cf = 1 / 3.28 + Case "mm" + cf = 1000 / 3.28 + Case "in" + cf = 12 + Case "ft" + cf = 1 + 'Case "" + End Select + End If + familyName = "" + + Select Case sShape + Case "GI", "I" + familyName = "Generic_I_" + Case "CH" + familyName = "Generic_CH_" + Case "CHS" + familyName = "Generic_CHS_" + Case "C" + familyName = "Generic_C_" + Case "RHS" + familyName = "Oasys_Generic_RHS_" + Case "R" + familyName = "Generic_R_" + Case "T" + familyName = "Generic_T_" + Case Else + Return False + End Select + + familyName += usage.ToString().ToLower() + Return True + End Function + ''' + ''' Given a descriptionm, return a map of dimension name to dimension value + ''' + ''' + ''' + ''' + ''' + Function SectionDimensions(ByVal desc As String, ByRef dimensions As SortedList) As Boolean + + Dim parts As String() = Nothing + parts = desc.Split(New [Char]() {"%"c, " "c}, StringSplitOptions.RemoveEmptyEntries) + + Debug.Assert(String.Equals(parts(0), "STD")) + Dim cf As Double = 3.28 / 1000 + + Dim sShape As String = parts(1) + Dim shapeSubString As String() = sShape.Split(New Char() {"("c, ")"c}) + If shapeSubString.Length > 1 Then + sShape = shapeSubString(0) + Select Case shapeSubString(1) + Case "m" + cf = 1 / 3.28 + Case "mm" + cf = 1000 / 3.28 + Case "in" + cf = 12 + Case "ft" + cf = 1 + 'Case "" + End Select + End If + Select Case sShape + Case "GI", "I" + ExtractDimensions_I(parts, dimensions, cf) + Case "CH" + ExtractDimensions_CH_T(parts, dimensions, cf) + Case "CHS" + ExtractDimensions_CHS(parts, dimensions, cf) + Case "C" + ExtractDimensions_C(parts, dimensions, cf) + Case "RHS" + ExtractDimensions_RECT(parts, dimensions, cf) + Case "R" + ExtractDimensions_RECT(parts, dimensions, cf) + Case "T" + ExtractDimensions_CH_T(parts, dimensions, cf) + Case Else + Return False + End Select + Return True + + End Function + + Function ExtractDimensions_I(ByRef parts As String(), ByRef dimensions As SortedList, ByVal cf As Double) As Boolean + Dim D As Double = 0.0, + Wt As Double = 0.0, + Wb As Double = 0.0, + Tt As Double = 0.0, + Tb As Double = 0.0, + t As Double = 0.0 + + Dim b1, b2, b3, b4, b5, b6 As Boolean + Select Case parts(1) + Case "GI" + ' D Wt Wb t Tt Tb + + Debug.Assert(8 = parts.Length) + b1 = Double.TryParse(parts(2), D) + dimensions.Add("D", D * cf) + + b2 = Double.TryParse(parts(3), Wt) + dimensions.Add("Wt", Wt * cf) + + b3 = Double.TryParse(parts(4), Wb) + dimensions.Add("Wb", Wb * cf) + + b4 = Double.TryParse(parts(5), t) + dimensions.Add("t", t * cf) + + b5 = Double.TryParse(parts(6), Tt) + dimensions.Add("Tt", Tt * cf) + + b6 = Double.TryParse(parts(7), Tb) + dimensions.Add("Tb", Tb * cf) + + Debug.Assert(b1 And b2 And b3 And b4 And b5 And b6) + + Case "I" + ' D W t T + 'STD I(m) 0.9 0.4 2.E-002 3.E-002 + Debug.Assert(6 = parts.Length) + b1 = Double.TryParse(parts(2), D) + dimensions.Add("D", D * cf) + + b2 = Double.TryParse(parts(3), Wt) + dimensions.Add("Wt", Wt * cf) + dimensions.Add("Wb", Wt * cf) + + b3 = Double.TryParse(parts(4), t) + dimensions.Add("t", t * cf) + + b4 = Double.TryParse(parts(5), Tt) + dimensions.Add("Tt", Tt * cf) + dimensions.Add("Tb", Tt * cf) + + Debug.Assert(b1 And b2 And b3 And b4) + End Select + Return True + End Function + Function ExtractDimensions_CH_T(ByRef parts As String(), ByRef dimensions As SortedList, ByVal cf As Double) As Boolean + + Dim D As Double = 0.0, + W As Double = 0.0, + T As Double = 0.0, + Tt As Double = 0.0 + 'STD CH(m) 0.5 0.25 2.E-002 3.E-002 + 'STD T(m) 0.5 0.25 3.E-002 2.E-002 + + Dim b1, b2, b3, b4 As Boolean + Debug.Assert(6 = parts.Length) + + b1 = Double.TryParse(parts(2), D) + dimensions.Add("D", D * cf) + + b2 = Double.TryParse(parts(3), W) + dimensions.Add("W", W * cf) + + b3 = Double.TryParse(parts(4), T) + dimensions.Add("T", T * cf) + + b4 = Double.TryParse(parts(5), Tt) + dimensions.Add("t", Tt * cf) + + Debug.Assert(b1 And b2 And b3 And b4) + Return True + + End Function + Function ExtractDimensions_CHS(ByRef parts As String(), ByRef dimensions As SortedList, ByVal cf As Double) As Boolean + + Dim D As Double = 0.0, + t As Double = 0.0 + 'STD CHS(m) 0.25 1.E-002 + + Dim b1, b2 As Boolean + Debug.Assert(4 = parts.Length) + + b1 = Double.TryParse(parts(2), D) + dimensions.Add("D", D * cf) + + b2 = Double.TryParse(parts(3), t) + dimensions.Add("t", t * cf) + + Debug.Assert(b1 And b2) + Return True + + End Function + Function ExtractDimensions_C(ByRef parts As String(), ByRef dimensions As SortedList, ByVal cf As Double) As Boolean + Dim D As Double = 0.0 + + Dim b1 As Boolean + Debug.Assert(3 = parts.Length) + + b1 = Double.TryParse(parts(2), D) + dimensions.Add("D", D * cf) + + Debug.Assert(b1) + Return True + + End Function + Function ExtractDimensions_RECT(ByRef parts As String(), ByRef dimensions As SortedList, ByVal cf As Double) As Boolean + + Dim D As Double = 0.0, + W As Double = 0.0, + T As Double = 0.0, + Tt As Double = 0.0 + 'STD RHS(m) 0.25 0.3 3.E-002 3.E-002 + + Dim b1, b2, b3, b4 As Boolean + Debug.Assert(6 = parts.Length Or 4 = parts.Length) + + b1 = Double.TryParse(parts(2), D) + dimensions.Add("D", D * cf) + + b2 = Double.TryParse(parts(3), W) + dimensions.Add("W", W * cf) + + Dim sShape As String = parts(1) + Dim shapeSubString As String() = sShape.Split(New [Char]() {"("c, ")"c}) + Debug.Assert(shapeSubString.Length > 0) + + If (String.Equals(shapeSubString(0), "RHS")) Then + b3 = Double.TryParse(parts(4), T) + dimensions.Add("T", T * cf) + + b4 = Double.TryParse(parts(5), Tt) + dimensions.Add("t", Tt * cf) + End If + + 'Debug.Assert(b1 And b2 And b3 And b4) + Return True + + End Function + + Function SetSid(ByVal keyword As String, ByVal record As Integer, ByVal sid As String) As Boolean + Debug.Assert(Not String.IsNullOrEmpty(keyword) And Not String.IsNullOrEmpty(sid) And Not (0 = record)) + + ' ensure record exists + Dim iCheck As Integer = CInt(m_GSAObject.GwaCommand("EXIST," & keyword & "," & record.ToString())) + If 1 <> iCheck Then + Return False + End If + m_GSAObject.WriteSidTagValue(keyword, record, "RVT", sid) + Return True + + End Function + + ''' + ''' Fetches value associated with the RVT key from the sid of the record + ''' + ''' + ''' + ''' + ''' + Private Function GetSid(ByRef keyword As String, ByRef record As Integer) As String + + Debug.Assert(Not String.IsNullOrEmpty(keyword) AndAlso Not 0 = record) + Dim iCheck As Integer = CInt(m_GSAObject.GwaCommand("EXIST," & keyword & "," & record.ToString())) + If iCheck <> 1 Then + Return Nothing + End If + Return m_GSAObject.GetSidTagValue(keyword, record, "RVT") + + End Function + Private Function GetSidMaterial(ByRef keyword As String, ByRef record As Integer) As String + + Debug.Assert(Not String.IsNullOrEmpty(keyword)) + Dim iCheck As Integer = CInt(m_GSAObject.GwaCommand("EXIST," & keyword & "," & record.ToString())) + If iCheck <> 1 Then + Return Nothing + End If + Return m_GSAObject.GetSidTagValue(keyword, record, "RVT") + + End Function + + Function ParseModelSid(ByRef sids As SortedList(Of String, String)) As Boolean + Dim sidString As String = m_GSAObject.GetSidTagValue("SID", 1, "RVT") + If String.IsNullOrEmpty(sidString) Then + Return False + End If + Return Me.ParseNestedSid(sidString, sids) + + End Function + + Function ParseNestedSid(ByRef sid_string As String, ByRef sids As SortedList(Of String, String)) As Boolean + 'sid is of format {RVT:{key1:value1}{key2:value2}...} + + 'sid = sid.Substring(5) + 'sid = sid.Remove(sid.Length - 1) + 'Dim params As New SortedList + + Dim parts As String() = sid_string.Split(New Char() {"{"c, "}"c}, System.StringSplitOptions.RemoveEmptyEntries) + If parts Is Nothing Then + Return False + End If + + For Each s As String In parts + Dim pair As String() = s.Split(New Char() {":"c}) + If pair.Length <> 2 Then + Continue For + End If + sids(pair(0)) = pair(1) + Next + Return True + + End Function + Sub SetModelSid(ByRef sid As String) + m_GSAObject.GwaCommand("SID," & sid) + End Sub + ''' + ''' Highest record number for a given module + ''' + ''' + ''' + ''' + Private Function HighestRecord(ByRef keyword As String) As Integer + Dim command As String = "HIGHEST," + keyword + Dim obj As Object = m_GSAObject.GwaCommand(command) + Dim nRecord As Integer = CType(obj, Integer) + If nRecord < 0 Then + nRecord = 0 + End If + Return nRecord + End Function + Function HighestGridPlane() As Integer + Return Me.HighestRecord("GRID_PLANE") + End Function + Function HighestGridSurface() As Integer + Return Me.HighestRecord("GRID_SURFACE") + End Function + Function HighestGridLine() As Integer + Return Me.HighestRecord("GRID_LINE") + End Function + Function HighestNode() As Integer + Return Me.HighestRecord("NODE") + End Function + Function HighestSection() As Integer + Return Me.HighestRecord("PROP_SEC") + End Function + Function HighestProp2d() As Integer + Return Me.HighestRecord("PROP_2D") + End Function + Function HighestMaterial() As Integer + Return Me.HighestRecord("MAT_ANAL") + End Function + Function HighestEnt(ByRef ent As String) As Integer + ent = ent.Replace("MEMBER", "MEMB") + Return Me.HighestRecord(ent) + End Function + Function HighestList() As Integer + Return Me.HighestRecord("LIST") + End Function + Function HighestPolyLine() As Integer + Return Me.HighestRecord("POLYLINE") + End Function + Function HighestGridAreaLoad() As Integer + Return Me.HighestRecord("LOAD_GRID_AREA") + End Function + Function HighestGridLineLoad() As Integer + Return Me.HighestRecord("LOAD_GRID_LINE") + End Function + Function HighestGridPointLoad() As Integer + Return Me.HighestRecord("LOAD_GRID_POINT") + End Function + Function HighestLoadCase() As Integer + Return Me.HighestRecord("LOAD_TITLE") + End Function + + + ''' + ''' Does record exist for keyword + ''' + ''' + ''' + ''' + ''' + Private Function ModuleRecordExists(ByRef keyword As String, ByVal record As Integer) As Boolean + Dim command As String = "EXIST," + keyword + "," + record.ToString() + Dim obj As Object = m_GSAObject.GwaCommand(command) + Dim bExist As Boolean = False + Dim iResult As Integer = CType(obj, Integer) + If 0 = iResult Then + Return False + Else + Return True + End If + + End Function + Function SectionExists(ByVal iSec As Integer, Optional ByVal bFresh As Boolean = False) As Boolean + If bFresh Then + Return Me.ModuleRecordExists("PROP_SEC", iSec) + Else + If Not _SecListExist.ContainsKey(iSec) Then + _SecListExist.Add(iSec, Me.ModuleRecordExists("PROP_SEC", iSec)) + End If + Return _SecListExist.Item(iSec) + End If + End Function + Function Section2DExists(ByVal iSec As Integer) As Boolean + Return Me.ModuleRecordExists("PROP_2D", iSec) + End Function + Function ClearSectionExistsInfo() As Boolean + _SecListExist.Clear() + _SecList.Clear() + Return True + End Function + Function MaterialExists(ByVal iMat As Integer) As Boolean + Return Me.ModuleRecordExists("MAT_ANAL", iMat) + End Function + Function GridPlaneExists(ByVal iGridPl As Integer) As Boolean + Return Me.ModuleRecordExists("GRID_PLANE", iGridPl) + End Function + Function GridLineExists(ByVal iGridLine As Integer) As Boolean + Return Me.ModuleRecordExists("GRID_LINE", iGridLine) + End Function + Function EntExists(ByRef ent As String, ByVal iEnt As Integer) As Boolean + If (ent.Equals("EL")) Then + If Not _EleListExist.ContainsKey(iEnt) Then + _EleListExist.Add(iEnt, Me.ModuleRecordExists(ent, iEnt)) + End If + Return _EleListExist.Item(iEnt) + Else + If Not _MemListExist.ContainsKey(iEnt) Then + _MemListExist.Add(iEnt, Me.ModuleRecordExists(ent, iEnt)) + End If + Return _MemListExist.Item(iEnt) + End If + + End Function + Function ListExists(ByRef iList As Integer) As Boolean + Return Me.ModuleRecordExists("LIST", iList) + End Function + + ''' + ''' gets revit id for the material record + ''' + ''' + ''' + ''' No need to extract RevitID again when using this + Function MaterialSid(ByRef record As Integer) As String + Return GetSidMaterial("MAT_ANAL", record) + End Function + ''' + ''' gets revit id for the grid plane record + ''' + ''' + ''' + ''' No need to extract RevitID again when using this + Function GridPlaneSid(ByRef record As Integer) As String + Return GetSid("GRID_PLANE", record) + End Function + ''' + ''' gets revit id for the grid line record + ''' + ''' + ''' + ''' No need to extract RevitID again when using this + Function GridLineSid(ByRef record As Integer) As String + Return GetSid("GRID_LINE", record) + End Function + ''' + ''' gets revit id for a member or element + ''' + ''' + ''' + ''' + ''' + Function EntSid(ByVal entity As String, ByVal record As Integer) As String + Return GetSid(entity, record) + End Function + + Function EntSection(ByVal entity As String, ByVal iEnt As Integer) As Integer + Debug.Assert(String.Equals(entity, "EL") Or String.Equals(entity, "MEMB")) + If Not Me.EntExists(entity, iEnt) Then + Debug.Assert(False) + Return 0 + End If + + Dim sName As String = "", sTopo As String = "", iProp As Integer = 0 + Dim type As MembType = MembType.UNDEF, Mat As MembMat = MembMat.UNDEF + Dim eMembtype As MembType = MembType.UNDEF + Dim eMembMattype As MembMat = MembMat.UNDEF + Dim uid As String = "", strDummy As String = "" + Dim iOrNode As Integer = 0, dBeta As Double = 0.0, + iTopoList As List(Of Integer) = Nothing, + dOffset As List(Of Double()) = Nothing, + release As List(Of String) = Nothing + Dim eleType As ElemType = ElemType.EL_BAR + Dim endRestraint1 As String = "" + Dim endRestraint2 As String = "" + If String.Equals(entity, "EL") Then + Me.Elem1d(iEnt, sName, iProp, uid, iTopoList, iOrNode, dBeta, release, dOffset, eleType, strDummy) + Else + Me.Member(iEnt, sName, iProp, uid, sTopo, iOrNode, dBeta, release, dOffset, eMembtype, endRestraint1, endRestraint2) + End If + + Return iProp + End Function + Private Shared Function ElemTypeIsBeamOrTruss(ByVal eType As ElemType) As Boolean + If (ElemType.EL_BEAM = eType _ + Or ElemType.EL_BAR = eType _ + Or ElemType.EL_STRUT = eType _ + Or ElemType.EL_TIE = eType) Then + Return True + Else + Return False + End If + End Function + ''' + ''' returns sid from string {RVT:sid} + ''' + ''' + ''' + ''' sid can be of form {tag1:{subtag1:data}{subtag2:data}}{tag2:data} + Public Shared Function ExtractId(ByVal sArg As String) As String + + Dim tag As String = "RVT:" + Dim value As String = "" + If Not sArg.Contains(tag) Then + 'Debug.Assert(False) + Return value + End If + + Dim pos_tag As Integer = sArg.IndexOf(tag) + ' sid will be of form {tag1:{subtag1:data}{subtag2:data}}{tag2:data} + Dim pos_value As Integer = pos_tag + tag.Length + Dim nBraces As Integer = 1 + Dim sOpn As String = "{", sCls As String = "}" + 'Debug.Assert(Char.Equals(sArg.Chars(pos_value), sOpn.Chars(0))) + + Dim i As Integer = 0 + While nBraces > 0 + If Char.Equals(sArg.Chars(pos_value + i), sOpn.Chars(0)) Then + nBraces += 1 + End If + If Char.Equals(sArg.Chars(pos_value + i), sCls.Chars(0)) Then + nBraces -= 1 + End If + i += 1 + End While + If sArg.Length < pos_value + i Then + Debug.Assert(False) ' something's wrong + Return value + End If + value = sArg.Substring(pos_value, i - 1) + Return value + End Function + Public Shared Function ExtractVesrion(ByVal sArg As String) As String + Dim tag As String = "RVT:" + If Not sArg.Contains(tag) Then + Return sArg + End If + Dim pos_tag As Integer = sArg.IndexOf(tag) + Return sArg.Substring(0, pos_tag - 2) + End Function + Public Property SelType() As EntType + Get + Return m_eSelType + End Get + Set(ByVal value As EntType) + m_eSelType = value + End Set + End Property + Public Shared Function DisplacementUnitFactor(ByVal unit As String) As Double + Dim dSectionDispFactor As Double = 1.0 + If unit.Contains("(m)") Then + dSectionDispFactor = ToMilliMeter.FromMeter + ElseIf unit.Contains("(ft)") Then + dSectionDispFactor = ToMilliMeter.FromFeet + ElseIf unit.Contains("in") Then + dSectionDispFactor = ToMilliMeter.FromInch + ElseIf unit.Contains("cm") Then + dSectionDispFactor = ToMilliMeter.FromCentimeter + Else + dSectionDispFactor = 1.0 + End If + Return dSectionDispFactor + End Function +End Class diff --git a/GSA/COM API/.NET/GsaComHelper/My Project/Application.Designer.vb b/GSA/COM API/.NET/GsaComHelper/My Project/Application.Designer.vb index be0d89d..3eb6153 100644 --- a/GSA/COM API/.NET/GsaComHelper/My Project/Application.Designer.vb +++ b/GSA/COM API/.NET/GsaComHelper/My Project/Application.Designer.vb @@ -1,13 +1,13 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.18052 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.18052 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/GSA/COM API/.NET/GsaComHelper/My Project/Application.myapp b/GSA/COM API/.NET/GsaComHelper/My Project/Application.myapp index 0167050..758895d 100644 --- a/GSA/COM API/.NET/GsaComHelper/My Project/Application.myapp +++ b/GSA/COM API/.NET/GsaComHelper/My Project/Application.myapp @@ -1,10 +1,10 @@ - - - false - false - 0 - true - 0 - 1 - true - + + + false + false + 0 + true + 0 + 1 + true + diff --git a/GSA/COM API/.NET/GsaComHelper/My Project/AssemblyInfo.vb b/GSA/COM API/.NET/GsaComHelper/My Project/AssemblyInfo.vb index a128ee7..df9dc93 100644 --- a/GSA/COM API/.NET/GsaComHelper/My Project/AssemblyInfo.vb +++ b/GSA/COM API/.NET/GsaComHelper/My Project/AssemblyInfo.vb @@ -1,35 +1,35 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' 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. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/GSA/COM API/.NET/GsaComHelper/My Project/Resources.Designer.vb b/GSA/COM API/.NET/GsaComHelper/My Project/Resources.Designer.vb index 41ac891..b5d4caa 100644 --- a/GSA/COM API/.NET/GsaComHelper/My Project/Resources.Designer.vb +++ b/GSA/COM API/.NET/GsaComHelper/My Project/Resources.Designer.vb @@ -1,63 +1,63 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.18052 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - -Imports System - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Oasys.Gsa.DotNetHelpers.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set - resourceCulture = value - End Set - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.18052 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Oasys.Gsa.DotNetHelpers.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/GSA/COM API/.NET/GsaComHelper/My Project/Resources.resx b/GSA/COM API/.NET/GsaComHelper/My Project/Resources.resx index ffecec8..71f7165 100644 --- a/GSA/COM API/.NET/GsaComHelper/My Project/Resources.resx +++ b/GSA/COM API/.NET/GsaComHelper/My Project/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GSA/COM API/.NET/GsaComHelper/My Project/Settings.Designer.vb b/GSA/COM API/.NET/GsaComHelper/My Project/Settings.Designer.vb index e8763e6..419834f 100644 --- a/GSA/COM API/.NET/GsaComHelper/My Project/Settings.Designer.vb +++ b/GSA/COM API/.NET/GsaComHelper/My Project/Settings.Designer.vb @@ -1,73 +1,73 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.18052 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.Oasys.Gsa.DotNetHelpers.My.MySettings - Get - Return Global.Oasys.Gsa.DotNetHelpers.My.MySettings.Default - End Get - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.18052 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.Oasys.Gsa.DotNetHelpers.My.MySettings + Get + Return Global.Oasys.Gsa.DotNetHelpers.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/GSA/COM API/.NET/GsaComHelper/My Project/Settings.settings b/GSA/COM API/.NET/GsaComHelper/My Project/Settings.settings index 377f56d..85b890b 100644 --- a/GSA/COM API/.NET/GsaComHelper/My Project/Settings.settings +++ b/GSA/COM API/.NET/GsaComHelper/My Project/Settings.settings @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/GSA/COM API/.NET/GsaComHelper/Utils.vb b/GSA/COM API/.NET/GsaComHelper/Utils.vb index 83d33ae..00446b0 100644 --- a/GSA/COM API/.NET/GsaComHelper/Utils.vb +++ b/GSA/COM API/.NET/GsaComHelper/Utils.vb @@ -1,594 +1,594 @@ - -Imports System -Imports System.IO -Imports System.Data -Imports System.Text -Imports System.Collections -Imports System.Collections.Generic -Imports System.Math -Imports System.Net - -Public Structure OasysPoint - Dim x As Integer - Dim y As Integer -End Structure - -''' -''' Class to store one CSV row -''' -Public Class CsvRow - Inherits List(Of String) - Public Property LineText() As String - Get - Return m_LineText - End Get - Set(value As String) - m_LineText = value - End Set - End Property - Private m_LineText As String -End Class - -''' -''' Class to write data to a CSV file -''' -Public Class CsvFileWriter - Inherits StreamWriter - Public Sub New(stream As Stream) - MyBase.New(stream) - End Sub - - Public Sub New(filename As String) - MyBase.New(filename) - End Sub - - ''' - ''' Writes a single row to a CSV file. - ''' - ''' The row to be written - Public Sub WriteRow(row As CsvRow) - Dim builder As New StringBuilder() - Dim firstColumn As Boolean = True - For Each value As String In row - ' Add separator if this isn't the first value - If Not firstColumn Then - builder.Append(","c) - End If - ' Implement special handling for values that contain comma or quote - ' Enclose in quotes and double up any double quotes - If value.IndexOfAny(New Char() {""""c, ","c}) <> -1 Then - builder.AppendFormat("""{0}""", value.Replace("""", """""")) - Else - builder.Append(value) - End If - firstColumn = False - Next - row.LineText = builder.ToString() - WriteLine(row.LineText) - End Sub -End Class - -''' -''' Class to read data from a CSV file -''' -Public Class CsvFileReader - Inherits StreamReader - Public Sub New(stream As Stream) - MyBase.New(stream) - End Sub - - Public Sub New(filename As String) - MyBase.New(filename) - End Sub - - ''' - ''' Reads a row of data from a CSV file - ''' - ''' - ''' - Public Function ReadRow(row As CsvRow) As Boolean - row.LineText = ReadLine() - If [String].IsNullOrEmpty(row.LineText) Then - Return False - End If - - Dim pos As Integer = 0 - Dim rows As Integer = 0 - - While pos < row.LineText.Length - Dim value As String - - ' Special handling for quoted field - If row.LineText(pos) = """"c Then - ' Skip initial quote - pos += 1 - - ' Parse quoted value - Dim start As Integer = pos - While pos < row.LineText.Length - ' Test for quote character - If row.LineText(pos) = """"c Then - ' Found one - pos += 1 - - ' If two quotes together, keep one - ' Otherwise, indicates end of value - If pos >= row.LineText.Length OrElse row.LineText(pos) <> """"c Then - pos -= 1 - Exit While - End If - End If - pos += 1 - End While - value = row.LineText.Substring(start, pos - start) - value = value.Replace("""""", """") - Else - ' Parse unquoted value - Dim start As Integer = pos - While pos < row.LineText.Length AndAlso row.LineText(pos) <> ","c - pos += 1 - End While - value = row.LineText.Substring(start, pos - start) - End If - - ' Add field to list - If rows < row.Count Then - row(rows) = value - Else - row.Add(value) - End If - rows += 1 - - ' Eat up to and including next comma - While pos < row.LineText.Length AndAlso row.LineText(pos) <> ","c - pos += 1 - End While - If pos < row.LineText.Length Then - pos += 1 - End If - End While - ' Delete any unused items - While row.Count > rows - row.RemoveAt(rows) - End While - - ' Return true if any columns read - Return (row.Count > 0) - End Function -End Class - -Public Class GSASection - Public Sub New() - - End Sub - Private _Sid As String - Public Property Sid() As String - Get - Return _Sid - End Get - Set(ByVal value As String) - _Sid = value - End Set - End Property - Private _Num As Integer - Public Property Number() As Integer - Get - Return _Num - End Get - Set(ByVal value As Integer) - _Num = value - End Set - End Property - Private _Name As String - Public Property Name() As String - Get - Return _Name - End Get - Set(ByVal value As String) - _Name = value - End Set - End Property - Private _AnalysisMat As Integer - Public Property AnalysisMat() As Integer - Get - Return _AnalysisMat - End Get - Set(ByVal value As Integer) - _AnalysisMat = value - End Set - End Property - Private _Desc As String - Public Property Desc() As String - Get - Return _Desc - End Get - Set(ByVal value As String) - _Desc = value - End Set - End Property - Private _MapOp As String - Public Property MapOp() As String - Get - Return _MapOp - End Get - Set(ByVal value As String) - _MapOp = value - End Set - End Property - Private _iSecUsage As Integer - Public Property SecUsage() As Integer - Get - Return _iSecUsage - End Get - Set(ByVal value As Integer) - _iSecUsage = value - End Set - End Property - - Private _typeMaterial As GsaComUtil.MembMat - Public Property MaterialType() As GsaComUtil.MembMat - Get - Return _typeMaterial - End Get - Set(ByVal value As GsaComUtil.MembMat) - _typeMaterial = value - End Set - End Property - Private _justification As String - Public Property justification() As String - Get - Return _justification - End Get - Set(ByVal value As String) - _justification = value - End Set - End Property - -End Class -Public Class MemberElement - Public Sub New() - - End Sub - Public Sub New(ByVal cIn As MemberElement) - _iEle = cIn.Element - _Name = cIn.Name - _dummy = cIn.Dummy - _iProp = cIn.SecPro - _iOrNode = cIn.OrientationNode - _uid = cIn.UID - _sRelease = cIn.Release - _dOffset = cIn.Offset - _TopoList = New List(Of Integer)(cIn.Topo) - _dBeta = cIn.Beta - _mtype = cIn.MemberType - End Sub - - Private _iEle As Integer - Public Property Element() As Integer - Get - Return _iEle - End Get - Set(ByVal value As Integer) - _iEle = value - End Set - End Property - Private _Name As String - Public Property Name() As String - Get - Return _Name - End Get - Set(ByVal value As String) - _Name = value - End Set - End Property - Private _dummy As String - Public Property Dummy() As String - Get - Return _dummy - End Get - Set(ByVal value As String) - _dummy = value - End Set - End Property - - Private _iProp As Integer - Public Property SecPro() As Integer - Get - Return _iProp - End Get - Set(ByVal value As Integer) - _iProp = value - End Set - End Property - - Private _iOrNode As Integer - Public Property OrientationNode() As Integer - Get - Return _iOrNode - End Get - Set(ByVal value As Integer) - _iOrNode = value - End Set - End Property - Private _uid As String - Public Property UID() As String - Get - Return _uid - End Get - Set(ByVal value As String) - _uid = value - End Set - End Property - Private _sTop As String - Public Property sTopo() As String - Get - Return _sTop - End Get - Set(ByVal value As String) - _sTop = value - End Set - End Property - - Private _sRelease As List(Of String) - Public Property Release() As List(Of String) - Get - Return _sRelease - End Get - Set(ByVal value As List(Of String)) - _sRelease = value - End Set - End Property - - Private _TopoList As List(Of Integer) - Public Property Topo() As List(Of Integer) - Get - Return _TopoList - End Get - Set(ByVal value As List(Of Integer)) - Dim i As Integer - _TopoList = New List(Of Integer) - For Each i In value - _TopoList.Add(i) - Next - End Set - End Property - - Private _dBeta As Double - Public Property Beta() As Double - Get - Return _dBeta - End Get - Set(ByVal value As Double) - _dBeta = value - End Set - End Property - - Private _dOffset As List(Of Double()) - Public Property Offset() As List(Of Double()) - Get - Return _dOffset - End Get - Set(ByVal value As List(Of Double())) - _dOffset = value - End Set - End Property - Private _etype As GsaComUtil.ElemType - Public Property ElementType() As GsaComUtil.ElemType - Get - Return _etype - End Get - Set(ByVal value As GsaComUtil.ElemType) - _etype = value - End Set - End Property - Private _mtype As GsaComUtil.MembType - Public Property MemberType() As GsaComUtil.MembType - Get - Return _mtype - End Get - Set(ByVal value As GsaComUtil.MembType) - _mtype = value - End Set - End Property - Private _endrestraint1 As String - Public Property Endrestraint1() As String - Get - Return _endrestraint1 - End Get - Set(ByVal value As String) - _endrestraint1 = value - End Set - End Property - Private _endrestraint2 As String - Public Property Endrestraint2() As String - Get - Return _endrestraint2 - End Get - Set(ByVal value As String) - _endrestraint2 = value - End Set - End Property - -End Class - -Public Class Utils - - Public Sub New() - - End Sub - - '/ - '/ Returns true for a precision - '/ - '/ - '/ - '/ - Public Shared Function IsApproxEqual(ByVal s As Double, ByVal t As Double, ByVal precision As Double) As Boolean - If Math.Abs(s - t) < precision Then - Return True - Else - Return False - End If - End Function - - 'append an extension to a filename removing the existing extension if there is one - Shared Function ChangeFileExt(ByVal filenameIn As String, ByVal extIn As String) As String - ChangeFileExt = filenameIn - Dim i As Integer = ChangeFileExt.LastIndexOf(".") - If (i >= 0) Then - ChangeFileExt = ChangeFileExt.Remove(i, ChangeFileExt.Length() - i) 'strip extension - End If - ChangeFileExt &= "." - ChangeFileExt &= extIn - End Function - - - ' Helper function - recursively search the given file name under the current directory. - ' - Public Shared Function SearchFile(ByVal path As String, ByVal fileName As String) As String - ' recursively search child directories. - Dim directoryName As String - For Each directoryName In Directory.GetDirectories(path, "*", SearchOption.AllDirectories) - If Not directoryName.Contains("Structural") Then - Continue For - End If - - For Each revitRFAfileName As String In Directory.GetFiles(directoryName) - If (fileName.Equals(System.IO.Path.GetFileName(revitRFAfileName))) Then - Return revitRFAfileName - End If - Next - Next - Return Nothing - End Function - Public Shared Function TrimSpace(ByVal source As String) As String - Dim sReturn As String = "" - Dim arr As String() = source.Split(New Char() {" "c}, System.StringSplitOptions.RemoveEmptyEntries) - For Each str As String In arr - sReturn = sReturn + str - Next - Return sReturn - End Function - - Public Shared Function CreateDirectory(ByVal path As String) As Boolean - - Dim info As System.IO.DirectoryInfo = Nothing - Try - info = System.IO.Directory.CreateDirectory(path) - If True = info.Exists Then - Return True - Else - Return False - End If - Catch ex As Exception - Return False - End Try - End Function - - Public Shared Function OnSegment(ByRef p As Double(), ByRef q As Double(), ByRef r As Double()) As Boolean - If q(0) <= Max(p(0), r(0)) AndAlso q(0) >= Min(p(0), r(0)) AndAlso q(1) <= Max(p(1), r(1)) AndAlso q(1) >= Min(p(1), r(1)) Then - Return True - End If - Return False - End Function - Public Shared Function Orientation(ByRef p As Double(), ByRef q As Double(), ByRef r As Double()) As Integer - Dim val As Double = (q(1) - p(1)) * (r(0) - q(0)) - (q(0) - p(0)) * (r(1) - q(1)) - If IsApproxEqual(val, 0, 0.0001) Then - Return 0 - End If - If val > 0 Then - Return 1 - Else - Return 2 - End If - End Function - Public Shared Function DoInterSect(ByRef p1 As Double(), ByRef q1 As Double(), ByRef p2 As Double(), ByRef q2 As Double()) As Boolean - 'Find the four orientations needed for general and - 'special cases - 'http://www.geeksforgeeks.org/how-to-check-if-a-given-point-lies-inside-a-polygon/ - Dim o1 As Integer = Orientation(p1, q1, p2) - Dim o2 As Integer = Orientation(p1, q1, q2) - Dim o3 As Integer = Orientation(p2, q2, p1) - Dim o4 As Integer = Orientation(p2, q2, q1) - 'General case - If Not o1.Equals(o2) AndAlso Not o3.Equals(o4) Then - Return True - End If - 'Special Cases - 'p1, q1 and p2 are collinear and p2 lies on segment p1q1 - If o1.Equals(0) AndAlso OnSegment(p1, p2, q1) Then - Return True - End If - 'p1, q1 and q2 are collinear and q2 lies on segment p1q1 - If o2.Equals(0) AndAlso OnSegment(p1, q2, q1) Then - Return True - End If - 'p2, q2 and p1 are collinear and p1 lies on segment p2q2 - If o3.Equals(0) AndAlso OnSegment(p2, p1, q2) Then - Return True - End If - ' p2, q2 and q1 are collinear and q1 lies on segment p2q2 - If o4.Equals(0) AndAlso OnSegment(p2, q1, q2) Then - Return True - End If - Return False 'Doesn't fall in any of the above cases - End Function - Public Shared Function IsInsidePolygon(ByVal points As List(Of Double()), ByVal point As Double()) As Boolean - Dim n As Integer = points.Count - If n < 3 Then - Return False - End If - Dim extreme As Double() = New Double() {10000, point(1), 0} - Dim count As Integer = 0 - Dim i As Integer = 0 - Do - Dim j As Integer = ((i + 1) Mod n) - If DoInterSect(points.Item(i), points.Item(j), point, extreme) Then - If Orientation(points.Item(i), point, points.Item(j)) = 0 Then - Return OnSegment(points.Item(i), point, points.Item(j)) - End If - count = count + 1 - End If - i = j - Loop While i <> 0 - Return CType(count And 1, Boolean) - End Function - Public Shared Function DisplacementUnitLabel(ByVal description As String) As String - Dim dSectionDispFactor As Double = 1.0 - If description.Contains("(m)") Then - Return "(m)" - ElseIf description.Contains("(mm)") Then - Return "(mm)" - ElseIf description.Contains("(ft)") Then - Return "(ft)" - ElseIf description.Contains("in") Then - Return "(in)" - ElseIf description.Contains("cm") Then - Return "(cm)" - End If - Return "(m)" - End Function - - Public Shared Function SectionDescription2D(ByVal thickness As Double, ByVal unitDescription As String) As String - Return thickness.ToString() + unitDescription - End Function - - Public Shared Function thinknessFrom2dProfile(ByVal profile As String) As Double - Dim profiles As String() = profile.Split(New Char() {"("c, ")"c}) - Dim thinkness As Double = 0.0 - If profiles.Length > 1 Then - Double.TryParse(profiles(0), thinkness) - Return thinkness - End If - Return 0.0 - End Function - - Public Shared Function DownloadExampleFile(ByVal file_name_to_be_download_from_general_folder As String, ByVal file_name_to_be_saved As String) As String - System.IO.Directory.CreateDirectory(Environment.CurrentDirectory) - Dim webClient As WebClient = New WebClient() - Dim path As String = Environment.CurrentDirectory & "\" & file_name_to_be_saved - Dim uri As Uri = New Uri("https://samples.oasys-software.com/gsa/10.2/General/" & file_name_to_be_download_from_general_folder) - webClient.DownloadFile(uri, path) - Return path - End Function -End Class + +Imports System +Imports System.IO +Imports System.Data +Imports System.Text +Imports System.Collections +Imports System.Collections.Generic +Imports System.Math +Imports System.Net + +Public Structure OasysPoint + Dim x As Integer + Dim y As Integer +End Structure + +''' +''' Class to store one CSV row +''' +Public Class CsvRow + Inherits List(Of String) + Public Property LineText() As String + Get + Return m_LineText + End Get + Set(value As String) + m_LineText = value + End Set + End Property + Private m_LineText As String +End Class + +''' +''' Class to write data to a CSV file +''' +Public Class CsvFileWriter + Inherits StreamWriter + Public Sub New(stream As Stream) + MyBase.New(stream) + End Sub + + Public Sub New(filename As String) + MyBase.New(filename) + End Sub + + ''' + ''' Writes a single row to a CSV file. + ''' + ''' The row to be written + Public Sub WriteRow(row As CsvRow) + Dim builder As New StringBuilder() + Dim firstColumn As Boolean = True + For Each value As String In row + ' Add separator if this isn't the first value + If Not firstColumn Then + builder.Append(","c) + End If + ' Implement special handling for values that contain comma or quote + ' Enclose in quotes and double up any double quotes + If value.IndexOfAny(New Char() {""""c, ","c}) <> -1 Then + builder.AppendFormat("""{0}""", value.Replace("""", """""")) + Else + builder.Append(value) + End If + firstColumn = False + Next + row.LineText = builder.ToString() + WriteLine(row.LineText) + End Sub +End Class + +''' +''' Class to read data from a CSV file +''' +Public Class CsvFileReader + Inherits StreamReader + Public Sub New(stream As Stream) + MyBase.New(stream) + End Sub + + Public Sub New(filename As String) + MyBase.New(filename) + End Sub + + ''' + ''' Reads a row of data from a CSV file + ''' + ''' + ''' + Public Function ReadRow(row As CsvRow) As Boolean + row.LineText = ReadLine() + If [String].IsNullOrEmpty(row.LineText) Then + Return False + End If + + Dim pos As Integer = 0 + Dim rows As Integer = 0 + + While pos < row.LineText.Length + Dim value As String + + ' Special handling for quoted field + If row.LineText(pos) = """"c Then + ' Skip initial quote + pos += 1 + + ' Parse quoted value + Dim start As Integer = pos + While pos < row.LineText.Length + ' Test for quote character + If row.LineText(pos) = """"c Then + ' Found one + pos += 1 + + ' If two quotes together, keep one + ' Otherwise, indicates end of value + If pos >= row.LineText.Length OrElse row.LineText(pos) <> """"c Then + pos -= 1 + Exit While + End If + End If + pos += 1 + End While + value = row.LineText.Substring(start, pos - start) + value = value.Replace("""""", """") + Else + ' Parse unquoted value + Dim start As Integer = pos + While pos < row.LineText.Length AndAlso row.LineText(pos) <> ","c + pos += 1 + End While + value = row.LineText.Substring(start, pos - start) + End If + + ' Add field to list + If rows < row.Count Then + row(rows) = value + Else + row.Add(value) + End If + rows += 1 + + ' Eat up to and including next comma + While pos < row.LineText.Length AndAlso row.LineText(pos) <> ","c + pos += 1 + End While + If pos < row.LineText.Length Then + pos += 1 + End If + End While + ' Delete any unused items + While row.Count > rows + row.RemoveAt(rows) + End While + + ' Return true if any columns read + Return (row.Count > 0) + End Function +End Class + +Public Class GSASection + Public Sub New() + + End Sub + Private _Sid As String + Public Property Sid() As String + Get + Return _Sid + End Get + Set(ByVal value As String) + _Sid = value + End Set + End Property + Private _Num As Integer + Public Property Number() As Integer + Get + Return _Num + End Get + Set(ByVal value As Integer) + _Num = value + End Set + End Property + Private _Name As String + Public Property Name() As String + Get + Return _Name + End Get + Set(ByVal value As String) + _Name = value + End Set + End Property + Private _AnalysisMat As Integer + Public Property AnalysisMat() As Integer + Get + Return _AnalysisMat + End Get + Set(ByVal value As Integer) + _AnalysisMat = value + End Set + End Property + Private _Desc As String + Public Property Desc() As String + Get + Return _Desc + End Get + Set(ByVal value As String) + _Desc = value + End Set + End Property + Private _MapOp As String + Public Property MapOp() As String + Get + Return _MapOp + End Get + Set(ByVal value As String) + _MapOp = value + End Set + End Property + Private _iSecUsage As Integer + Public Property SecUsage() As Integer + Get + Return _iSecUsage + End Get + Set(ByVal value As Integer) + _iSecUsage = value + End Set + End Property + + Private _typeMaterial As GsaComUtil.MembMat + Public Property MaterialType() As GsaComUtil.MembMat + Get + Return _typeMaterial + End Get + Set(ByVal value As GsaComUtil.MembMat) + _typeMaterial = value + End Set + End Property + Private _justification As String + Public Property justification() As String + Get + Return _justification + End Get + Set(ByVal value As String) + _justification = value + End Set + End Property + +End Class +Public Class MemberElement + Public Sub New() + + End Sub + Public Sub New(ByVal cIn As MemberElement) + _iEle = cIn.Element + _Name = cIn.Name + _dummy = cIn.Dummy + _iProp = cIn.SecPro + _iOrNode = cIn.OrientationNode + _uid = cIn.UID + _sRelease = cIn.Release + _dOffset = cIn.Offset + _TopoList = New List(Of Integer)(cIn.Topo) + _dBeta = cIn.Beta + _mtype = cIn.MemberType + End Sub + + Private _iEle As Integer + Public Property Element() As Integer + Get + Return _iEle + End Get + Set(ByVal value As Integer) + _iEle = value + End Set + End Property + Private _Name As String + Public Property Name() As String + Get + Return _Name + End Get + Set(ByVal value As String) + _Name = value + End Set + End Property + Private _dummy As String + Public Property Dummy() As String + Get + Return _dummy + End Get + Set(ByVal value As String) + _dummy = value + End Set + End Property + + Private _iProp As Integer + Public Property SecPro() As Integer + Get + Return _iProp + End Get + Set(ByVal value As Integer) + _iProp = value + End Set + End Property + + Private _iOrNode As Integer + Public Property OrientationNode() As Integer + Get + Return _iOrNode + End Get + Set(ByVal value As Integer) + _iOrNode = value + End Set + End Property + Private _uid As String + Public Property UID() As String + Get + Return _uid + End Get + Set(ByVal value As String) + _uid = value + End Set + End Property + Private _sTop As String + Public Property sTopo() As String + Get + Return _sTop + End Get + Set(ByVal value As String) + _sTop = value + End Set + End Property + + Private _sRelease As List(Of String) + Public Property Release() As List(Of String) + Get + Return _sRelease + End Get + Set(ByVal value As List(Of String)) + _sRelease = value + End Set + End Property + + Private _TopoList As List(Of Integer) + Public Property Topo() As List(Of Integer) + Get + Return _TopoList + End Get + Set(ByVal value As List(Of Integer)) + Dim i As Integer + _TopoList = New List(Of Integer) + For Each i In value + _TopoList.Add(i) + Next + End Set + End Property + + Private _dBeta As Double + Public Property Beta() As Double + Get + Return _dBeta + End Get + Set(ByVal value As Double) + _dBeta = value + End Set + End Property + + Private _dOffset As List(Of Double()) + Public Property Offset() As List(Of Double()) + Get + Return _dOffset + End Get + Set(ByVal value As List(Of Double())) + _dOffset = value + End Set + End Property + Private _etype As GsaComUtil.ElemType + Public Property ElementType() As GsaComUtil.ElemType + Get + Return _etype + End Get + Set(ByVal value As GsaComUtil.ElemType) + _etype = value + End Set + End Property + Private _mtype As GsaComUtil.MembType + Public Property MemberType() As GsaComUtil.MembType + Get + Return _mtype + End Get + Set(ByVal value As GsaComUtil.MembType) + _mtype = value + End Set + End Property + Private _endrestraint1 As String + Public Property Endrestraint1() As String + Get + Return _endrestraint1 + End Get + Set(ByVal value As String) + _endrestraint1 = value + End Set + End Property + Private _endrestraint2 As String + Public Property Endrestraint2() As String + Get + Return _endrestraint2 + End Get + Set(ByVal value As String) + _endrestraint2 = value + End Set + End Property + +End Class + +Public Class Utils + + Public Sub New() + + End Sub + + '/ + '/ Returns true for a precision + '/ + '/ + '/ + '/ + Public Shared Function IsApproxEqual(ByVal s As Double, ByVal t As Double, ByVal precision As Double) As Boolean + If Math.Abs(s - t) < precision Then + Return True + Else + Return False + End If + End Function + + 'append an extension to a filename removing the existing extension if there is one + Shared Function ChangeFileExt(ByVal filenameIn As String, ByVal extIn As String) As String + ChangeFileExt = filenameIn + Dim i As Integer = ChangeFileExt.LastIndexOf(".") + If (i >= 0) Then + ChangeFileExt = ChangeFileExt.Remove(i, ChangeFileExt.Length() - i) 'strip extension + End If + ChangeFileExt &= "." + ChangeFileExt &= extIn + End Function + + + ' Helper function - recursively search the given file name under the current directory. + ' + Public Shared Function SearchFile(ByVal path As String, ByVal fileName As String) As String + ' recursively search child directories. + Dim directoryName As String + For Each directoryName In Directory.GetDirectories(path, "*", SearchOption.AllDirectories) + If Not directoryName.Contains("Structural") Then + Continue For + End If + + For Each revitRFAfileName As String In Directory.GetFiles(directoryName) + If (fileName.Equals(System.IO.Path.GetFileName(revitRFAfileName))) Then + Return revitRFAfileName + End If + Next + Next + Return Nothing + End Function + Public Shared Function TrimSpace(ByVal source As String) As String + Dim sReturn As String = "" + Dim arr As String() = source.Split(New Char() {" "c}, System.StringSplitOptions.RemoveEmptyEntries) + For Each str As String In arr + sReturn = sReturn + str + Next + Return sReturn + End Function + + Public Shared Function CreateDirectory(ByVal path As String) As Boolean + + Dim info As System.IO.DirectoryInfo = Nothing + Try + info = System.IO.Directory.CreateDirectory(path) + If True = info.Exists Then + Return True + Else + Return False + End If + Catch ex As Exception + Return False + End Try + End Function + + Public Shared Function OnSegment(ByRef p As Double(), ByRef q As Double(), ByRef r As Double()) As Boolean + If q(0) <= Max(p(0), r(0)) AndAlso q(0) >= Min(p(0), r(0)) AndAlso q(1) <= Max(p(1), r(1)) AndAlso q(1) >= Min(p(1), r(1)) Then + Return True + End If + Return False + End Function + Public Shared Function Orientation(ByRef p As Double(), ByRef q As Double(), ByRef r As Double()) As Integer + Dim val As Double = (q(1) - p(1)) * (r(0) - q(0)) - (q(0) - p(0)) * (r(1) - q(1)) + If IsApproxEqual(val, 0, 0.0001) Then + Return 0 + End If + If val > 0 Then + Return 1 + Else + Return 2 + End If + End Function + Public Shared Function DoInterSect(ByRef p1 As Double(), ByRef q1 As Double(), ByRef p2 As Double(), ByRef q2 As Double()) As Boolean + 'Find the four orientations needed for general and + 'special cases + 'http://www.geeksforgeeks.org/how-to-check-if-a-given-point-lies-inside-a-polygon/ + Dim o1 As Integer = Orientation(p1, q1, p2) + Dim o2 As Integer = Orientation(p1, q1, q2) + Dim o3 As Integer = Orientation(p2, q2, p1) + Dim o4 As Integer = Orientation(p2, q2, q1) + 'General case + If Not o1.Equals(o2) AndAlso Not o3.Equals(o4) Then + Return True + End If + 'Special Cases + 'p1, q1 and p2 are collinear and p2 lies on segment p1q1 + If o1.Equals(0) AndAlso OnSegment(p1, p2, q1) Then + Return True + End If + 'p1, q1 and q2 are collinear and q2 lies on segment p1q1 + If o2.Equals(0) AndAlso OnSegment(p1, q2, q1) Then + Return True + End If + 'p2, q2 and p1 are collinear and p1 lies on segment p2q2 + If o3.Equals(0) AndAlso OnSegment(p2, p1, q2) Then + Return True + End If + ' p2, q2 and q1 are collinear and q1 lies on segment p2q2 + If o4.Equals(0) AndAlso OnSegment(p2, q1, q2) Then + Return True + End If + Return False 'Doesn't fall in any of the above cases + End Function + Public Shared Function IsInsidePolygon(ByVal points As List(Of Double()), ByVal point As Double()) As Boolean + Dim n As Integer = points.Count + If n < 3 Then + Return False + End If + Dim extreme As Double() = New Double() {10000, point(1), 0} + Dim count As Integer = 0 + Dim i As Integer = 0 + Do + Dim j As Integer = ((i + 1) Mod n) + If DoInterSect(points.Item(i), points.Item(j), point, extreme) Then + If Orientation(points.Item(i), point, points.Item(j)) = 0 Then + Return OnSegment(points.Item(i), point, points.Item(j)) + End If + count = count + 1 + End If + i = j + Loop While i <> 0 + Return CType(count And 1, Boolean) + End Function + Public Shared Function DisplacementUnitLabel(ByVal description As String) As String + Dim dSectionDispFactor As Double = 1.0 + If description.Contains("(m)") Then + Return "(m)" + ElseIf description.Contains("(mm)") Then + Return "(mm)" + ElseIf description.Contains("(ft)") Then + Return "(ft)" + ElseIf description.Contains("in") Then + Return "(in)" + ElseIf description.Contains("cm") Then + Return "(cm)" + End If + Return "(m)" + End Function + + Public Shared Function SectionDescription2D(ByVal thickness As Double, ByVal unitDescription As String) As String + Return thickness.ToString() + unitDescription + End Function + + Public Shared Function thinknessFrom2dProfile(ByVal profile As String) As Double + Dim profiles As String() = profile.Split(New Char() {"("c, ")"c}) + Dim thinkness As Double = 0.0 + If profiles.Length > 1 Then + Double.TryParse(profiles(0), thinkness) + Return thinkness + End If + Return 0.0 + End Function + + Public Shared Function DownloadExampleFile(ByVal file_name_to_be_download_from_general_folder As String, ByVal file_name_to_be_saved As String) As String + System.IO.Directory.CreateDirectory(Environment.CurrentDirectory) + Dim webClient As WebClient = New WebClient() + Dim path As String = Environment.CurrentDirectory & "\" & file_name_to_be_saved + Dim uri As Uri = New Uri("https://samples.oasys-software.com/gsa/10.2/General/" & file_name_to_be_download_from_general_folder) + webClient.DownloadFile(uri, path) + Return path + End Function +End Class diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2.sln b/GSA/COM API/.NET/Views/ConsoleApplication2.sln index 5c54784..dc46304 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2.sln +++ b/GSA/COM API/.NET/Views/ConsoleApplication2.sln @@ -1,22 +1,22 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.6.33723.286 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ConsoleApplication2", "ConsoleApplication2\ConsoleApplication2.vbproj", "{C697E022-627B-4C2F-B3B0-44B47CE0E2E0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|X64 = Debug|X64 - Release|X64 = Release|X64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Debug|X64.ActiveCfg = Debug|x64 - {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Debug|X64.Build.0 = Debug|x64 - {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Release|X64.ActiveCfg = Release|Any CPU - {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Release|X64.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33723.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ConsoleApplication2", "ConsoleApplication2\ConsoleApplication2.vbproj", "{C697E022-627B-4C2F-B3B0-44B47CE0E2E0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|X64 = Debug|X64 + Release|X64 = Release|X64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Debug|X64.ActiveCfg = Debug|x64 + {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Debug|X64.Build.0 = Debug|x64 + {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Release|X64.ActiveCfg = Release|Any CPU + {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Release|X64.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2/App.config b/GSA/COM API/.NET/Views/ConsoleApplication2/App.config index d740e88..737ed23 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2/App.config +++ b/GSA/COM API/.NET/Views/ConsoleApplication2/App.config @@ -1,6 +1,6 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2/ConsoleApplication2.vbproj b/GSA/COM API/.NET/Views/ConsoleApplication2/ConsoleApplication2.vbproj index 136d605..270e5aa 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2/ConsoleApplication2.vbproj +++ b/GSA/COM API/.NET/Views/ConsoleApplication2/ConsoleApplication2.vbproj @@ -1,120 +1,120 @@ - - - - - Debug - x64 - {C697E022-627B-4C2F-B3B0-44B47CE0E2E0} - Exe - ConsoleApplication2.Module1 - ConsoleApplication2 - ConsoleApplication2 - 512 - Console - v4.6.1 - true - - - x64 - true - full - true - true - bin\Debug\ - ConsoleApplication2.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - x64 - pdbonly - false - true - true - bin\Release\ - ConsoleApplication2.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - On - - - Binary - - - Off - - - On - - - - C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - - - \ No newline at end of file + + + + + Debug + x64 + {C697E022-627B-4C2F-B3B0-44B47CE0E2E0} + Exe + ConsoleApplication2.Module1 + ConsoleApplication2 + ConsoleApplication2 + 512 + Console + v4.6.1 + true + + + x64 + true + full + true + true + bin\Debug\ + ConsoleApplication2.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + x64 + pdbonly + false + true + true + bin\Release\ + ConsoleApplication2.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2/Module1.vb b/GSA/COM API/.NET/Views/ConsoleApplication2/Module1.vb index 86e1fc7..f600d6c 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2/Module1.vb +++ b/GSA/COM API/.NET/Views/ConsoleApplication2/Module1.vb @@ -1,74 +1,74 @@ -Imports System.IO -Imports Interop.Gsa_10_2 - -Module Module1 - Dim sv_gwa As String = "GR_VIEW.17 134218690 63 test 0 0 755 296 1 9 \ - 4 1 1 1 1 -4 2 1 -4 3 1 -4 8 1 -4 2 \ - 0 \ - 0.000000000000 90.0000000000 90.0000000000 0.000000000000 6.50000000000 9.00000000000 2.00000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 0.0272383000000 1 0.000000000000 0.000000000000 1.00000000000 0 0.000000000000 1.00000000000 0 1.00000000000 30.0000000000 2 0.000000000000 0.000000000000 1000000.00000 WHITE RGB(0xaa0000) 0 0.850000000000 0.750000000000 0.950000000000 2 1 -5 3 1 -5 \ - 0 0 1.00000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 1.00000000000 1.00000000000 1.00000000000 1.00000000000 3.00000000000 1.20000000000 55.0000000000 3 2 0 1 \ - 2 \ - 25231545 9 0 10 0 8 0 0 0 1 0 1 2 2 1 1 1 7 0 0 2 0 3 1 0 1 0 2 0 3 0 6 0 7 0 8 0 1 0 2 0 3 0 6 0 7 0 8 0 0 1 -4 0 1 -4 \ - 0 0 GLOBAL 0.000000000000 0 - \ - 0 \ - N 4.e-311 m 4.e-311 kg 4.e-311 s 4.e-311 °C 4.e-311 m 4.e-311 Pa 4.e-311 m/s² 4.e-311 m 4.e-311 \ - 1 4 2 4 4.94066e-324 \ - 1.00000000000 - 8 \ - 0 \ - 3 5 2 1 \ - 25231364 1 0 0 0 0 0 0 0 1 0 1 2 2 1 1 1 7 0 0 2 0 3 1 0 1 0 2 0 3 0 6 0 7 0 8 0 1 0 2 0 3 0 6 0 7 0 8 0 0 1 -4 0 1 -4 \ - 12001003 6 GLOBAL 0.0500000000000 1 -0.0197872761637 0.00167759228498 \ - 0 \ - N 4.e-311 m 4.e-311 kg 4.e-311 s 4.e-311 °C 4.e-311 m 4.e-311 Pa 4.e-311 m/s² 4.e-311 m 4.e-311 \ - 1 4 2 4 4.94066e-324 \ - 1.00000000000 - 8 \ - 0 \ - 3 5 2 1" - Sub Main() - Dim gsa As New ComAuto - ' this is the GSA file that has our view templates - - Dim current_directory As String = Directory.GetCurrentDirectory() - Dim template_relative_path As String = "..\..\sample_files\view_templates.gwb" - Dim gsa_file_relative_path As String = "..\..\sample_files\steel_design_medium.gwb" - Dim full_path As String = Path.Combine(current_directory, template_relative_path) - - gsa.Open(full_path) - Dim ref_template_contour = gsa.ViewRefFromName("SGV", "template-contour") - Dim ref_template_labels = gsa.ViewRefFromName("SGV", "template-labels") - - Dim contour_template As String = gsa.GwaCommand("GET, GR_VIEW," & ref_template_contour) - Dim label_template As String = gsa.GwaCommand("GET, GR_VIEW," & ref_template_labels) - gsa.Close() - - full_path = Path.Combine(current_directory, gsa_file_relative_path) - gsa.Open(full_path) - - ' Create a new saved view that will display a contour - Dim viewRef As Integer = gsa.CreateNewView("contour") - - ' Now "apply" contour_template to this view and set - ' the result component to nodal displacement, z - gsa.SetViewContour(viewRef, 12001003, contour_template) - - ' Turn labels on by apply the labels template - gsa.SetViewLabels(viewRef, label_template) - - viewRef = gsa.CreateNewView("diag") - - ' Rescale and - gsa.RescaleViewData(viewRef) - - gsa.UpdateViews() - - gsa.SaveViewToFile("ALL_SGV", "PNG") - - Console.ReadKey() - gsa.Save() - - - gsa.Close() - - End Sub - -End Module +Imports System.IO +Imports Interop.Gsa_10_2 + +Module Module1 + Dim sv_gwa As String = "GR_VIEW.17 134218690 63 test 0 0 755 296 1 9 \ + 4 1 1 1 1 -4 2 1 -4 3 1 -4 8 1 -4 2 \ + 0 \ + 0.000000000000 90.0000000000 90.0000000000 0.000000000000 6.50000000000 9.00000000000 2.00000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 0.0272383000000 1 0.000000000000 0.000000000000 1.00000000000 0 0.000000000000 1.00000000000 0 1.00000000000 30.0000000000 2 0.000000000000 0.000000000000 1000000.00000 WHITE RGB(0xaa0000) 0 0.850000000000 0.750000000000 0.950000000000 2 1 -5 3 1 -5 \ + 0 0 1.00000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 0.000000000000 1.00000000000 1.00000000000 1.00000000000 1.00000000000 3.00000000000 1.20000000000 55.0000000000 3 2 0 1 \ + 2 \ + 25231545 9 0 10 0 8 0 0 0 1 0 1 2 2 1 1 1 7 0 0 2 0 3 1 0 1 0 2 0 3 0 6 0 7 0 8 0 1 0 2 0 3 0 6 0 7 0 8 0 0 1 -4 0 1 -4 \ + 0 0 GLOBAL 0.000000000000 0 - \ + 0 \ + N 4.e-311 m 4.e-311 kg 4.e-311 s 4.e-311 °C 4.e-311 m 4.e-311 Pa 4.e-311 m/s² 4.e-311 m 4.e-311 \ + 1 4 2 4 4.94066e-324 \ + 1.00000000000 - 8 \ + 0 \ + 3 5 2 1 \ + 25231364 1 0 0 0 0 0 0 0 1 0 1 2 2 1 1 1 7 0 0 2 0 3 1 0 1 0 2 0 3 0 6 0 7 0 8 0 1 0 2 0 3 0 6 0 7 0 8 0 0 1 -4 0 1 -4 \ + 12001003 6 GLOBAL 0.0500000000000 1 -0.0197872761637 0.00167759228498 \ + 0 \ + N 4.e-311 m 4.e-311 kg 4.e-311 s 4.e-311 °C 4.e-311 m 4.e-311 Pa 4.e-311 m/s² 4.e-311 m 4.e-311 \ + 1 4 2 4 4.94066e-324 \ + 1.00000000000 - 8 \ + 0 \ + 3 5 2 1" + Sub Main() + Dim gsa As New ComAuto + ' this is the GSA file that has our view templates + + Dim current_directory As String = Directory.GetCurrentDirectory() + Dim template_relative_path As String = "..\..\sample_files\view_templates.gwb" + Dim gsa_file_relative_path As String = "..\..\sample_files\steel_design_medium.gwb" + Dim full_path As String = Path.Combine(current_directory, template_relative_path) + + gsa.Open(full_path) + Dim ref_template_contour = gsa.ViewRefFromName("SGV", "template-contour") + Dim ref_template_labels = gsa.ViewRefFromName("SGV", "template-labels") + + Dim contour_template As String = gsa.GwaCommand("GET, GR_VIEW," & ref_template_contour) + Dim label_template As String = gsa.GwaCommand("GET, GR_VIEW," & ref_template_labels) + gsa.Close() + + full_path = Path.Combine(current_directory, gsa_file_relative_path) + gsa.Open(full_path) + + ' Create a new saved view that will display a contour + Dim viewRef As Integer = gsa.CreateNewView("contour") + + ' Now "apply" contour_template to this view and set + ' the result component to nodal displacement, z + gsa.SetViewContour(viewRef, 12001003, contour_template) + + ' Turn labels on by apply the labels template + gsa.SetViewLabels(viewRef, label_template) + + viewRef = gsa.CreateNewView("diag") + + ' Rescale and + gsa.RescaleViewData(viewRef) + + gsa.UpdateViews() + + gsa.SaveViewToFile("ALL_SGV", "PNG") + + Console.ReadKey() + gsa.Save() + + + gsa.Close() + + End Sub + +End Module diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Application.Designer.vb b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Application.Designer.vb index db8b8b3..88dd01c 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Application.Designer.vb +++ b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Application.Designer.vb @@ -1,13 +1,13 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Application.myapp b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Application.myapp index 23b627f..e62f1a5 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Application.myapp +++ b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Application.myapp @@ -1,10 +1,10 @@ - - - false - false - 0 - true - 0 - 2 - true - + + + false + false + 0 + true + 0 + 2 + true + diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/AssemblyInfo.vb b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/AssemblyInfo.vb index c9a76c6..bf93d21 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/AssemblyInfo.vb +++ b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/AssemblyInfo.vb @@ -1,35 +1,35 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' 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. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Resources.Designer.vb b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Resources.Designer.vb index d9e5ec6..0a00a9e 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Resources.Designer.vb +++ b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Resources.Designer.vb @@ -1,62 +1,62 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ConsoleApplication2.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set(ByVal value As Global.System.Globalization.CultureInfo) - resourceCulture = value - End Set - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ConsoleApplication2.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Resources.resx b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Resources.resx index ffecec8..71f7165 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Resources.resx +++ b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Settings.Designer.vb b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Settings.Designer.vb index b4f76b5..2ecb502 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Settings.Designer.vb +++ b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Settings.Designer.vb @@ -1,73 +1,73 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.ConsoleApplication2.My.MySettings - Get - Return Global.ConsoleApplication2.My.MySettings.Default - End Get - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.ConsoleApplication2.My.MySettings + Get + Return Global.ConsoleApplication2.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Settings.settings b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Settings.settings index 377f56d..85b890b 100644 --- a/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Settings.settings +++ b/GSA/COM API/.NET/Views/ConsoleApplication2/My Project/Settings.settings @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof.sln b/GSA/COM API/.NET/demo_sinosoidal_roof.sln index 3af2482..7e7c1c0 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof.sln +++ b/GSA/COM API/.NET/demo_sinosoidal_roof.sln @@ -1,43 +1,43 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.6.33815.320 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demo_sinosoidal_roof", "demo_sinosoidal_roof\demo_sinosoidal_roof.csproj", "{E80ABE7B-18D0-47CC-A4EA-441126BEA7C0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demo_sinosoidal_roof_Forces", "demo_sinosoidal_roof_Forces\demo_sinosoidal_roof_Forces.csproj", "{4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC}" -EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DotNetHelpers", "GsaComHelper\DotNetHelpers.vbproj", "{544A079C-AAB4-4DB4-91B8-77FA245167AA}" -EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ConsoleApplication2", "Views\ConsoleApplication2\ConsoleApplication2.vbproj", "{C697E022-627B-4C2F-B3B0-44B47CE0E2E0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E80ABE7B-18D0-47CC-A4EA-441126BEA7C0}.Debug|x64.ActiveCfg = Debug|x64 - {E80ABE7B-18D0-47CC-A4EA-441126BEA7C0}.Debug|x64.Build.0 = Debug|x64 - {E80ABE7B-18D0-47CC-A4EA-441126BEA7C0}.Release|x64.ActiveCfg = Release|x64 - {E80ABE7B-18D0-47CC-A4EA-441126BEA7C0}.Release|x64.Build.0 = Release|x64 - {4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC}.Debug|x64.ActiveCfg = Debug|x64 - {4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC}.Debug|x64.Build.0 = Debug|x64 - {4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC}.Release|x64.ActiveCfg = Release|x64 - {4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC}.Release|x64.Build.0 = Release|x64 - {544A079C-AAB4-4DB4-91B8-77FA245167AA}.Debug|x64.ActiveCfg = Debug|x64 - {544A079C-AAB4-4DB4-91B8-77FA245167AA}.Debug|x64.Build.0 = Debug|x64 - {544A079C-AAB4-4DB4-91B8-77FA245167AA}.Release|x64.ActiveCfg = Release|x64 - {544A079C-AAB4-4DB4-91B8-77FA245167AA}.Release|x64.Build.0 = Release|x64 - {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Debug|x64.ActiveCfg = Debug|x64 - {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Debug|x64.Build.0 = Debug|x64 - {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Release|x64.ActiveCfg = Release|x64 - {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {23E869D3-A499-477A-8229-99E0D78887C1} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33815.320 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demo_sinosoidal_roof", "demo_sinosoidal_roof\demo_sinosoidal_roof.csproj", "{E80ABE7B-18D0-47CC-A4EA-441126BEA7C0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demo_sinosoidal_roof_Forces", "demo_sinosoidal_roof_Forces\demo_sinosoidal_roof_Forces.csproj", "{4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DotNetHelpers", "GsaComHelper\DotNetHelpers.vbproj", "{544A079C-AAB4-4DB4-91B8-77FA245167AA}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ConsoleApplication2", "Views\ConsoleApplication2\ConsoleApplication2.vbproj", "{C697E022-627B-4C2F-B3B0-44B47CE0E2E0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E80ABE7B-18D0-47CC-A4EA-441126BEA7C0}.Debug|x64.ActiveCfg = Debug|x64 + {E80ABE7B-18D0-47CC-A4EA-441126BEA7C0}.Debug|x64.Build.0 = Debug|x64 + {E80ABE7B-18D0-47CC-A4EA-441126BEA7C0}.Release|x64.ActiveCfg = Release|x64 + {E80ABE7B-18D0-47CC-A4EA-441126BEA7C0}.Release|x64.Build.0 = Release|x64 + {4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC}.Debug|x64.ActiveCfg = Debug|x64 + {4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC}.Debug|x64.Build.0 = Debug|x64 + {4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC}.Release|x64.ActiveCfg = Release|x64 + {4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC}.Release|x64.Build.0 = Release|x64 + {544A079C-AAB4-4DB4-91B8-77FA245167AA}.Debug|x64.ActiveCfg = Debug|x64 + {544A079C-AAB4-4DB4-91B8-77FA245167AA}.Debug|x64.Build.0 = Debug|x64 + {544A079C-AAB4-4DB4-91B8-77FA245167AA}.Release|x64.ActiveCfg = Release|x64 + {544A079C-AAB4-4DB4-91B8-77FA245167AA}.Release|x64.Build.0 = Release|x64 + {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Debug|x64.ActiveCfg = Debug|x64 + {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Debug|x64.Build.0 = Debug|x64 + {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Release|x64.ActiveCfg = Release|x64 + {C697E022-627B-4C2F-B3B0-44B47CE0E2E0}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {23E869D3-A499-477A-8229-99E0D78887C1} + EndGlobalSection +EndGlobal diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof/Program.cs b/GSA/COM API/.NET/demo_sinosoidal_roof/Program.cs index 394e77e..2c2c59b 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof/Program.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof/Program.cs @@ -1,259 +1,259 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Diagnostics; -using Oasys.Gsa.DotNetHelpers; -using Interop.Gsa_10_2; -using System.Xml.Linq; - -namespace demo_sinosoidal_roof -{ - class Program - { - 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 SavefilePath = @"C:\temp\updated_sinosoidal_roof.gwb"; - GsaComUtil m_gsaObj = new GsaComUtil(); - - m_gsaObj.GsaOpenFile(ref filePath); - m_gsaObj.GsaDeleteResults(); - - #region Node & Element operatopn(Old method) - - for (int i = 0; i <= 50; i++) - { - double x = pi_by_32 * i * scale; - double z = Math.Sin(x) * scale / 4; - - double y = 0; - - int n1 = m_gsaObj.NodeAt(x, y, z, tol); - y += 10; - int n2 = m_gsaObj.NodeAt(x, y, z, tol); - - int elem = m_gsaObj.HighestEnt(ref strEnt) + 1; - - List _topo = new List(); - _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 - ); - - 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 - ); - } - - 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 - ); - } - 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); - List lstElem = new List(); - List lstNode = new List(); - double[] Stiff = { 0, 0, 0, 0, 0, 0 }; - int[] restraint = { 0, 0, 0, 0, 0, 1 }; - - for (int i = 51; i <= 100; i++) - { - double x = pi_by_32 * i * scale; - double z = Math.Sin(x) * scale / 4; - double y = 0; - - //start node - double[] Coor0 = { x, y, z }; - GsaNode gNode0 = new GsaNode(); - gNode0.Coor = Coor0; - gNode0.SpringProperty = 1; - gNode0.Restraint = restraint; - gNode0.Ref = ++nodeHigh; - lstNode.Add(gNode0); - - //end node - y += 10; - double[] Coor1 = { x, y, z }; - GsaNode gNode1 = new GsaNode(); - gNode1.Coor = Coor1; - gNode1.SpringProperty = 1; - gNode1.Restraint = restraint; - gNode1.Ref = ++nodeHigh; - lstNode.Add(gNode1); - - int[] iTop = { gNode0.Ref, gNode1.Ref }; - GsaElement gElem = new GsaElement(); - gElem.eType = (int)ElementType.BAR; - gElem.Ref = ++elemHigh; - gElem.Property = 1; - gElem.Topo = iTop; - gElem.NumTopo = iTop.Count(); - lstElem.Add(gElem); - - if ((n1_previous != 0)) - { - GsaElement gElemSide1 = new GsaElement(); - gElemSide1.Ref = ++elemHigh; - gElemSide1.eType = (int)ElementType.BAR; - gElemSide1.Property = 1; - int[] iTopSide1 = { gNode0.Ref, n1_previous }; - gElemSide1.Topo = iTopSide1; - gElemSide1.NumTopo = iTopSide1.Count(); - lstElem.Add(gElemSide1); - } - - if ((n2_previous != 0)) - { - GsaElement gElemSide2 = new GsaElement(); - gElemSide2.Ref = ++elemHigh; - gElemSide2.eType = (int)ElementType.BAR; - gElemSide2.Property = 1; - int[] iTopSide2 = { gNode1.Ref, n2_previous }; - gElemSide2.Topo = iTopSide2; - gElemSide2.NumTopo = iTopSide2.Count(); - lstElem.Add(gElemSide2); - } - n1_previous = gNode0.Ref; - n2_previous = gNode1.Ref; - } - m_gsaObj.GsaObj().SetNodes(lstNode.ToArray(), true); - m_gsaObj.GsaObj().SetElements(lstElem.ToArray(), true); - - #endregion Node & Element operatopn(New method) - - #region Node Manipulation - - - int[] nodeRefs = null; - GsaNode[] nodes = null; - GsaEntity Ent = GsaEntity.NODE; - - 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); - - for (Int32 i = 0; i <= nodes.GetUpperBound(0); i++) - { - GsaNode node = (GsaNode)nodes.GetValue(i); - double z = node.Coor[2]; - node.Coor.SetValue(-z, 2); - nodes.SetValue(node, i); - } - s = m_gsaObj.GsaObj().SetNodes(nodes, true); - m_gsaObj.GsaObj().SaveAs(SavefilePath); - - #endregion Node Manipulation - - #region Adding new section - - GsaSection cNewSec = new GsaSection(); - 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")); - cNewSec.Ref = iNewSec + 1; - GsaSection[] cArrNewSec = { cNewSec }; - s = m_gsaObj.GsaObj().SetSections(cArrNewSec, true); - Debug.Assert(s.Equals(0)); - m_gsaObj.GsaObj().SaveAs(SavefilePath); - - #endregion Adding new section - - #region Element Manipulation - - 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); - Debug.Assert(s.Equals(0) && (ElemRefs != null)); - s = m_gsaObj.GsaObj().Elements(ElemRefs, out elements); - for (int i = 0; i <= elements.GetUpperBound(0); i++) - { - GsaElement elem = (GsaElement)elements.GetValue(i); - elem.Property = (int)cArrNewSec[cArrNewSec.Count() - 1].Ref; - elem.eType = (int)ElementType.BAR; - elements.SetValue(elem, i); - } - s = m_gsaObj.GsaObj().SetElements(elements, true); - - #endregion Node Manipulation - - - m_gsaObj.GsaSaveFile(SavefilePath); - m_gsaObj.GsaCloseFile(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Diagnostics; +using Oasys.Gsa.DotNetHelpers; +using Interop.Gsa_10_2; +using System.Xml.Linq; + +namespace demo_sinosoidal_roof +{ + class Program + { + 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 SavefilePath = @"C:\temp\updated_sinosoidal_roof.gwb"; + GsaComUtil m_gsaObj = new GsaComUtil(); + + m_gsaObj.GsaOpenFile(ref filePath); + m_gsaObj.GsaDeleteResults(); + + #region Node & Element operatopn(Old method) + + for (int i = 0; i <= 50; i++) + { + double x = pi_by_32 * i * scale; + double z = Math.Sin(x) * scale / 4; + + double y = 0; + + int n1 = m_gsaObj.NodeAt(x, y, z, tol); + y += 10; + int n2 = m_gsaObj.NodeAt(x, y, z, tol); + + int elem = m_gsaObj.HighestEnt(ref strEnt) + 1; + + List _topo = new List(); + _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 + ); + + 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 + ); + } + + 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 + ); + } + 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); + List lstElem = new List(); + List lstNode = new List(); + double[] Stiff = { 0, 0, 0, 0, 0, 0 }; + int[] restraint = { 0, 0, 0, 0, 0, 1 }; + + for (int i = 51; i <= 100; i++) + { + double x = pi_by_32 * i * scale; + double z = Math.Sin(x) * scale / 4; + double y = 0; + + //start node + double[] Coor0 = { x, y, z }; + GsaNode gNode0 = new GsaNode(); + gNode0.Coor = Coor0; + gNode0.SpringProperty = 1; + gNode0.Restraint = restraint; + gNode0.Ref = ++nodeHigh; + lstNode.Add(gNode0); + + //end node + y += 10; + double[] Coor1 = { x, y, z }; + GsaNode gNode1 = new GsaNode(); + gNode1.Coor = Coor1; + gNode1.SpringProperty = 1; + gNode1.Restraint = restraint; + gNode1.Ref = ++nodeHigh; + lstNode.Add(gNode1); + + int[] iTop = { gNode0.Ref, gNode1.Ref }; + GsaElement gElem = new GsaElement(); + gElem.eType = (int)ElementType.BAR; + gElem.Ref = ++elemHigh; + gElem.Property = 1; + gElem.Topo = iTop; + gElem.NumTopo = iTop.Count(); + lstElem.Add(gElem); + + if ((n1_previous != 0)) + { + GsaElement gElemSide1 = new GsaElement(); + gElemSide1.Ref = ++elemHigh; + gElemSide1.eType = (int)ElementType.BAR; + gElemSide1.Property = 1; + int[] iTopSide1 = { gNode0.Ref, n1_previous }; + gElemSide1.Topo = iTopSide1; + gElemSide1.NumTopo = iTopSide1.Count(); + lstElem.Add(gElemSide1); + } + + if ((n2_previous != 0)) + { + GsaElement gElemSide2 = new GsaElement(); + gElemSide2.Ref = ++elemHigh; + gElemSide2.eType = (int)ElementType.BAR; + gElemSide2.Property = 1; + int[] iTopSide2 = { gNode1.Ref, n2_previous }; + gElemSide2.Topo = iTopSide2; + gElemSide2.NumTopo = iTopSide2.Count(); + lstElem.Add(gElemSide2); + } + n1_previous = gNode0.Ref; + n2_previous = gNode1.Ref; + } + m_gsaObj.GsaObj().SetNodes(lstNode.ToArray(), true); + m_gsaObj.GsaObj().SetElements(lstElem.ToArray(), true); + + #endregion Node & Element operatopn(New method) + + #region Node Manipulation + + + int[] nodeRefs = null; + GsaNode[] nodes = null; + GsaEntity Ent = GsaEntity.NODE; + + 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); + + for (Int32 i = 0; i <= nodes.GetUpperBound(0); i++) + { + GsaNode node = (GsaNode)nodes.GetValue(i); + double z = node.Coor[2]; + node.Coor.SetValue(-z, 2); + nodes.SetValue(node, i); + } + s = m_gsaObj.GsaObj().SetNodes(nodes, true); + m_gsaObj.GsaObj().SaveAs(SavefilePath); + + #endregion Node Manipulation + + #region Adding new section + + GsaSection cNewSec = new GsaSection(); + 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")); + cNewSec.Ref = iNewSec + 1; + GsaSection[] cArrNewSec = { cNewSec }; + s = m_gsaObj.GsaObj().SetSections(cArrNewSec, true); + Debug.Assert(s.Equals(0)); + m_gsaObj.GsaObj().SaveAs(SavefilePath); + + #endregion Adding new section + + #region Element Manipulation + + 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); + Debug.Assert(s.Equals(0) && (ElemRefs != null)); + s = m_gsaObj.GsaObj().Elements(ElemRefs, out elements); + for (int i = 0; i <= elements.GetUpperBound(0); i++) + { + GsaElement elem = (GsaElement)elements.GetValue(i); + elem.Property = (int)cArrNewSec[cArrNewSec.Count() - 1].Ref; + elem.eType = (int)ElementType.BAR; + elements.SetValue(elem, i); + } + s = m_gsaObj.GsaObj().SetElements(elements, true); + + #endregion Node Manipulation + + + 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 bad2447..ae5b726 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof/Properties/AssemblyInfo.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof/Properties/AssemblyInfo.cs @@ -1,36 +1,36 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 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")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("demo_sinosoidal_roof")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] -[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 -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("b8c05df6-523e-41af-bd85-1ed5a9038fcd")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// 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")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("demo_sinosoidal_roof")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] +[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 +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b8c05df6-523e-41af-bd85-1ed5a9038fcd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof/app.config b/GSA/COM API/.NET/demo_sinosoidal_roof/app.config index 801c873..51278a4 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof/app.config +++ b/GSA/COM API/.NET/demo_sinosoidal_roof/app.config @@ -1,3 +1,3 @@ - - - + + + diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof/demo_sinosoidal_roof.csproj b/GSA/COM API/.NET/demo_sinosoidal_roof/demo_sinosoidal_roof.csproj index 7136ce3..a3197a1 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof/demo_sinosoidal_roof.csproj +++ b/GSA/COM API/.NET/demo_sinosoidal_roof/demo_sinosoidal_roof.csproj @@ -1,95 +1,95 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {E80ABE7B-18D0-47CC-A4EA-441126BEA7C0} - Exe - Properties - demo_sinosoidal_roof - demo_sinosoidal_roof - v4.6.1 - - - 512 - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - true - true - false - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - false - false - - - - C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll - False - - - - - - - - - - - - - - - - - - - - {544a079c-aab4-4db4-91b8-77fa245167aa} - DotNetHelpers - - - - - \ No newline at end of file + + + + Debug + x86 + 8.0.30703 + 2.0 + {E80ABE7B-18D0-47CC-A4EA-441126BEA7C0} + Exe + Properties + demo_sinosoidal_roof + demo_sinosoidal_roof + v4.6.1 + + + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + true + true + false + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + false + false + + + + C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll + False + + + + + + + + + + + + + + + + + + + + {544a079c-aab4-4db4-91b8-77fa245167aa} + DotNetHelpers + + + + + diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.Designer.cs b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.Designer.cs index 5aecef8..4bec120 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.Designer.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.Designer.cs @@ -1,203 +1,203 @@ -using Oasys.Gsa.DotNetHelpers; -using System.Net; - -namespace demo_sinosoidal_roof_Forces -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.grdResult = new System.Windows.Forms.DataGridView(); - this.txtFilePath = new System.Windows.Forms.TextBox(); - this.btnBrowse = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.btnResult = new System.Windows.Forms.Button(); - this.txtElementNumber = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.txtLoadCase = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.txtResultPos = new System.Windows.Forms.TextBox(); - this.chkInter = new System.Windows.Forms.CheckBox(); - ((System.ComponentModel.ISupportInitialize)(this.grdResult)).BeginInit(); - this.SuspendLayout(); - // - // grdResult - // - this.grdResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.grdResult.Location = new System.Drawing.Point(41, 241); - this.grdResult.Name = "grdResult"; - this.grdResult.Size = new System.Drawing.Size(703, 191); - this.grdResult.TabIndex = 0; - // - // txtFilePath - // - this.txtFilePath.Location = new System.Drawing.Point(161, 21); - this.txtFilePath.Name = "txtFilePath"; - this.txtFilePath.Size = new System.Drawing.Size(507, 20); - this.txtFilePath.TabIndex = 1; - this.txtFilePath.Text = Utils.DownloadExampleFile("Env.gwb", "sinosoidal_roof_forces.gwb"); - // - // btnBrowse - // - this.btnBrowse.Location = new System.Drawing.Point(674, 20); - this.btnBrowse.Name = "btnBrowse"; - this.btnBrowse.Size = new System.Drawing.Size(28, 23); - this.btnBrowse.TabIndex = 2; - this.btnBrowse.Text = "..."; - this.btnBrowse.UseVisualStyleBackColor = true; - this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(39, 25); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(73, 13); - this.label1.TabIndex = 3; - this.label1.Text = "GSA File Path"; - // - // btnResult - // - this.btnResult.Location = new System.Drawing.Point(310, 212); - this.btnResult.Name = "btnResult"; - this.btnResult.Size = new System.Drawing.Size(87, 23); - this.btnResult.TabIndex = 4; - this.btnResult.Text = "Get Result"; - this.btnResult.UseVisualStyleBackColor = true; - this.btnResult.Click += new System.EventHandler(this.btnResult_Click); - // - // txtElementNumber - // - this.txtElementNumber.Location = new System.Drawing.Point(161, 65); - this.txtElementNumber.Name = "txtElementNumber"; - this.txtElementNumber.Size = new System.Drawing.Size(52, 20); - this.txtElementNumber.TabIndex = 5; - this.txtElementNumber.Text = "All"; - this.txtElementNumber.TextChanged += new System.EventHandler(this.txtElementNumber_TextChanged); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(39, 69); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(85, 13); - this.label2.TabIndex = 6; - this.label2.Text = "Element Number"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(39, 113); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(58, 13); - this.label3.TabIndex = 8; - this.label3.Text = "Load Case"; - // - // txtLoadCase - // - this.txtLoadCase.Location = new System.Drawing.Point(161, 109); - this.txtLoadCase.Name = "txtLoadCase"; - this.txtLoadCase.Size = new System.Drawing.Size(52, 20); - this.txtLoadCase.TabIndex = 7; - this.txtLoadCase.Text = "A1"; - this.txtLoadCase.TextChanged += new System.EventHandler(this.txtLoadCase_TextChanged); - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(39, 157); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(106, 13); - this.label4.TabIndex = 10; - this.label4.Text = "No of Result Position"; - // - // txtResultPos - // - this.txtResultPos.Location = new System.Drawing.Point(161, 153); - this.txtResultPos.Name = "txtResultPos"; - this.txtResultPos.Size = new System.Drawing.Size(52, 20); - this.txtResultPos.TabIndex = 9; - this.txtResultPos.Text = "2"; - this.txtResultPos.TextChanged += new System.EventHandler(this.txtResultPos_TextChanged); - // - // chkInter - // - this.chkInter.AutoSize = true; - this.chkInter.Checked = true; - this.chkInter.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkInter.Location = new System.Drawing.Point(42, 196); - this.chkInter.Name = "chkInter"; - this.chkInter.Size = new System.Drawing.Size(149, 17); - this.chkInter.TabIndex = 11; - this.chkInter.Text = "Include intersecting points"; - this.chkInter.UseVisualStyleBackColor = true; - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(771, 445); - this.Controls.Add(this.chkInter); - this.Controls.Add(this.label4); - this.Controls.Add(this.txtResultPos); - this.Controls.Add(this.label3); - this.Controls.Add(this.txtLoadCase); - this.Controls.Add(this.label2); - this.Controls.Add(this.txtElementNumber); - this.Controls.Add(this.btnResult); - this.Controls.Add(this.label1); - this.Controls.Add(this.btnBrowse); - this.Controls.Add(this.txtFilePath); - this.Controls.Add(this.grdResult); - this.MaximizeBox = false; - this.MinimumSize = new System.Drawing.Size(787, 483); - this.Name = "Form1"; - this.Text = "Forces"; - ((System.ComponentModel.ISupportInitialize)(this.grdResult)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.DataGridView grdResult; - private System.Windows.Forms.TextBox txtFilePath; - private System.Windows.Forms.Button btnBrowse; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button btnResult; - private System.Windows.Forms.TextBox txtElementNumber; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtLoadCase; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox txtResultPos; - private System.Windows.Forms.CheckBox chkInter; - } -} - +using Oasys.Gsa.DotNetHelpers; +using System.Net; + +namespace demo_sinosoidal_roof_Forces +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.grdResult = new System.Windows.Forms.DataGridView(); + this.txtFilePath = new System.Windows.Forms.TextBox(); + this.btnBrowse = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.btnResult = new System.Windows.Forms.Button(); + this.txtElementNumber = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.txtLoadCase = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.txtResultPos = new System.Windows.Forms.TextBox(); + this.chkInter = new System.Windows.Forms.CheckBox(); + ((System.ComponentModel.ISupportInitialize)(this.grdResult)).BeginInit(); + this.SuspendLayout(); + // + // grdResult + // + this.grdResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.grdResult.Location = new System.Drawing.Point(41, 241); + this.grdResult.Name = "grdResult"; + this.grdResult.Size = new System.Drawing.Size(703, 191); + this.grdResult.TabIndex = 0; + // + // txtFilePath + // + this.txtFilePath.Location = new System.Drawing.Point(161, 21); + this.txtFilePath.Name = "txtFilePath"; + this.txtFilePath.Size = new System.Drawing.Size(507, 20); + this.txtFilePath.TabIndex = 1; + this.txtFilePath.Text = Utils.DownloadExampleFile("Env.gwb", "sinosoidal_roof_forces.gwb"); + // + // btnBrowse + // + this.btnBrowse.Location = new System.Drawing.Point(674, 20); + this.btnBrowse.Name = "btnBrowse"; + this.btnBrowse.Size = new System.Drawing.Size(28, 23); + this.btnBrowse.TabIndex = 2; + this.btnBrowse.Text = "..."; + this.btnBrowse.UseVisualStyleBackColor = true; + this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(39, 25); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(73, 13); + this.label1.TabIndex = 3; + this.label1.Text = "GSA File Path"; + // + // btnResult + // + this.btnResult.Location = new System.Drawing.Point(310, 212); + this.btnResult.Name = "btnResult"; + this.btnResult.Size = new System.Drawing.Size(87, 23); + this.btnResult.TabIndex = 4; + this.btnResult.Text = "Get Result"; + this.btnResult.UseVisualStyleBackColor = true; + this.btnResult.Click += new System.EventHandler(this.btnResult_Click); + // + // txtElementNumber + // + this.txtElementNumber.Location = new System.Drawing.Point(161, 65); + this.txtElementNumber.Name = "txtElementNumber"; + this.txtElementNumber.Size = new System.Drawing.Size(52, 20); + this.txtElementNumber.TabIndex = 5; + this.txtElementNumber.Text = "All"; + this.txtElementNumber.TextChanged += new System.EventHandler(this.txtElementNumber_TextChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(39, 69); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(85, 13); + this.label2.TabIndex = 6; + this.label2.Text = "Element Number"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(39, 113); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(58, 13); + this.label3.TabIndex = 8; + this.label3.Text = "Load Case"; + // + // txtLoadCase + // + this.txtLoadCase.Location = new System.Drawing.Point(161, 109); + this.txtLoadCase.Name = "txtLoadCase"; + this.txtLoadCase.Size = new System.Drawing.Size(52, 20); + this.txtLoadCase.TabIndex = 7; + this.txtLoadCase.Text = "A1"; + this.txtLoadCase.TextChanged += new System.EventHandler(this.txtLoadCase_TextChanged); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(39, 157); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(106, 13); + this.label4.TabIndex = 10; + this.label4.Text = "No of Result Position"; + // + // txtResultPos + // + this.txtResultPos.Location = new System.Drawing.Point(161, 153); + this.txtResultPos.Name = "txtResultPos"; + this.txtResultPos.Size = new System.Drawing.Size(52, 20); + this.txtResultPos.TabIndex = 9; + this.txtResultPos.Text = "2"; + this.txtResultPos.TextChanged += new System.EventHandler(this.txtResultPos_TextChanged); + // + // chkInter + // + this.chkInter.AutoSize = true; + this.chkInter.Checked = true; + this.chkInter.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkInter.Location = new System.Drawing.Point(42, 196); + this.chkInter.Name = "chkInter"; + this.chkInter.Size = new System.Drawing.Size(149, 17); + this.chkInter.TabIndex = 11; + this.chkInter.Text = "Include intersecting points"; + this.chkInter.UseVisualStyleBackColor = true; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(771, 445); + this.Controls.Add(this.chkInter); + this.Controls.Add(this.label4); + this.Controls.Add(this.txtResultPos); + this.Controls.Add(this.label3); + this.Controls.Add(this.txtLoadCase); + this.Controls.Add(this.label2); + this.Controls.Add(this.txtElementNumber); + this.Controls.Add(this.btnResult); + this.Controls.Add(this.label1); + this.Controls.Add(this.btnBrowse); + this.Controls.Add(this.txtFilePath); + this.Controls.Add(this.grdResult); + this.MaximizeBox = false; + this.MinimumSize = new System.Drawing.Size(787, 483); + this.Name = "Form1"; + this.Text = "Forces"; + ((System.ComponentModel.ISupportInitialize)(this.grdResult)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataGridView grdResult; + private System.Windows.Forms.TextBox txtFilePath; + private System.Windows.Forms.Button btnBrowse; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnResult; + private System.Windows.Forms.TextBox txtElementNumber; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox txtLoadCase; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox txtResultPos; + private System.Windows.Forms.CheckBox chkInter; + } +} + 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 a2d7805..50226d4 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.cs @@ -1,194 +1,194 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using Interop.Gsa_10_2; -using Oasys.Gsa.DotNetHelpers; - -namespace demo_sinosoidal_roof_Forces -{ - public partial class Form1 : Form - { - public GsaComUtil m_gsaObj = null; - private string strLoadcase = "A1"; - private string strElemenNo = "All"; - 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("FY(kN)", typeof(string)); - table.Columns.Add("FZ(kN)", typeof(string)); - table.Columns.Add("FRC(kN)", typeof(string)); - table.Columns.Add("MXX(kN-m)", typeof(string)); - table.Columns.Add("MYY(kN-m)", typeof(string)); - table.Columns.Add("MZZ(kN-m)", typeof(string)); - table.Columns.Add("MOM(kN-m)", typeof(string)); - } - - 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 - }; - - public void GetResult() - { - string filePath = txtFilePath.Text.ToString(); - int nComponent = 0; - int Highest = 0; - m_gsaObj = new GsaComUtil(); - m_gsaObj.GsaOpenFile(ref filePath); - try - { - int iStart = 1; - if (strElemenNo == "All") - { - Highest = (int)m_gsaObj.GsaObj().GwaCommand("HIGHEST,EL"); - } - else - { - int.TryParse(strElemenNo, out Highest); - iStart = Highest; - } - - List exist_element = new List(); - for (int i = iStart; i <= Highest; i++) - { - if ((int)m_gsaObj.GsaObj().GwaCommand("EXIST,EL," + i.ToString()) != 0) - { - exist_element.Add(i); - } - } - 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 - ); - 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 - ) - { - for (int j = 0; j < gsResult.Count(); j++) - { - List strList = new List(); - strList.Add(element_id.ToString()); - strList.Add((j + 1).ToString()); - for (int k = 0; k < nComponent; k++) - { - strList.Add(gsResult[j].dynaResults[k].ToString()); - } - table.Rows.Add(strList.ToArray()); - } - } - } - } - grdResult.AutoGenerateColumns = true; - grdResult.DataSource = table; - } - m_gsaObj.GsaCloseFile(); - } - catch - { - MessageBox.Show("Check for correct input parameter"); - m_gsaObj.GsaCloseFile(); - } - } - - private void txtLoadCase_TextChanged(object sender, EventArgs e) - { - if (!string.IsNullOrEmpty(txtLoadCase.Text)) - { - strLoadcase = txtLoadCase.Text; - } - else - { - strLoadcase = ""; - } - } - - private void txtElementNumber_TextChanged(object sender, EventArgs e) - { - if (!string.IsNullOrEmpty(txtElementNumber.Text)) - { - if (txtResultPos.Text == "All") - { - strElemenNo = txtElementNumber.Text.ToString(); - } - else - { - try - { - Convert.ToInt16(txtElementNumber.Text); - strElemenNo = txtElementNumber.Text.ToString(); - } - catch - { - MessageBox.Show("Input value is not in correct format"); - strElemenNo = ""; - } - } - } - } - - private void txtResultPos_TextChanged(object sender, EventArgs e) - { - if (!string.IsNullOrEmpty(txtResultPos.Text)) - { - try - { - iResPos = Convert.ToInt16(txtResultPos.Text); - } - catch - { - MessageBox.Show("Input value is not in correct format"); - } - } - } - - private void btnBrowse_Click(object sender, EventArgs e) - { - OpenFileDialog flgOpen = new OpenFileDialog(); - DialogResult result = flgOpen.ShowDialog(); - if (result == DialogResult.OK) // Test result. - { - string file = flgOpen.FileName; - txtFilePath.Text = file; - } - } - } -} +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Interop.Gsa_10_2; +using Oasys.Gsa.DotNetHelpers; + +namespace demo_sinosoidal_roof_Forces +{ + public partial class Form1 : Form + { + public GsaComUtil m_gsaObj = null; + private string strLoadcase = "A1"; + private string strElemenNo = "All"; + 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("FY(kN)", typeof(string)); + table.Columns.Add("FZ(kN)", typeof(string)); + table.Columns.Add("FRC(kN)", typeof(string)); + table.Columns.Add("MXX(kN-m)", typeof(string)); + table.Columns.Add("MYY(kN-m)", typeof(string)); + table.Columns.Add("MZZ(kN-m)", typeof(string)); + table.Columns.Add("MOM(kN-m)", typeof(string)); + } + + 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 + }; + + public void GetResult() + { + string filePath = txtFilePath.Text.ToString(); + int nComponent = 0; + int Highest = 0; + m_gsaObj = new GsaComUtil(); + m_gsaObj.GsaOpenFile(ref filePath); + try + { + int iStart = 1; + if (strElemenNo == "All") + { + Highest = (int)m_gsaObj.GsaObj().GwaCommand("HIGHEST,EL"); + } + else + { + int.TryParse(strElemenNo, out Highest); + iStart = Highest; + } + + List exist_element = new List(); + for (int i = iStart; i <= Highest; i++) + { + if ((int)m_gsaObj.GsaObj().GwaCommand("EXIST,EL," + i.ToString()) != 0) + { + exist_element.Add(i); + } + } + 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 + ); + 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 + ) + { + for (int j = 0; j < gsResult.Count(); j++) + { + List strList = new List(); + strList.Add(element_id.ToString()); + strList.Add((j + 1).ToString()); + for (int k = 0; k < nComponent; k++) + { + strList.Add(gsResult[j].dynaResults[k].ToString()); + } + table.Rows.Add(strList.ToArray()); + } + } + } + } + grdResult.AutoGenerateColumns = true; + grdResult.DataSource = table; + } + m_gsaObj.GsaCloseFile(); + } + catch + { + MessageBox.Show("Check for correct input parameter"); + m_gsaObj.GsaCloseFile(); + } + } + + private void txtLoadCase_TextChanged(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(txtLoadCase.Text)) + { + strLoadcase = txtLoadCase.Text; + } + else + { + strLoadcase = ""; + } + } + + private void txtElementNumber_TextChanged(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(txtElementNumber.Text)) + { + if (txtResultPos.Text == "All") + { + strElemenNo = txtElementNumber.Text.ToString(); + } + else + { + try + { + Convert.ToInt16(txtElementNumber.Text); + strElemenNo = txtElementNumber.Text.ToString(); + } + catch + { + MessageBox.Show("Input value is not in correct format"); + strElemenNo = ""; + } + } + } + } + + private void txtResultPos_TextChanged(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(txtResultPos.Text)) + { + try + { + iResPos = Convert.ToInt16(txtResultPos.Text); + } + catch + { + MessageBox.Show("Input value is not in correct format"); + } + } + } + + private void btnBrowse_Click(object sender, EventArgs e) + { + OpenFileDialog flgOpen = new OpenFileDialog(); + DialogResult result = flgOpen.ShowDialog(); + if (result == DialogResult.OK) // Test result. + { + string file = flgOpen.FileName; + txtFilePath.Text = file; + } + } + } +} diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.resx b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.resx index 29dcb1b..4848987 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.resx +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Form1.resx @@ -1,120 +1,120 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Program.cs b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Program.cs index 9c1b634..70c22d8 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Program.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Program.cs @@ -1,21 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; - -namespace demo_sinosoidal_roof_Forces -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace demo_sinosoidal_roof_Forces +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} 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 1817f80..9c3ed88 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 @@ -1,36 +1,36 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 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")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("demo_sinosoidal_roof_Forces")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] -[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 -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("3b3b0632-8f9e-4c74-971f-60cc53ef7843")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// 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")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("demo_sinosoidal_roof_Forces")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] +[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 +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3b3b0632-8f9e-4c74-971f-60cc53ef7843")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Resources.Designer.cs b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Resources.Designer.cs index 5f64db5..d1458cd 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Resources.Designer.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Resources.Designer.cs @@ -1,63 +1,63 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace demo_sinosoidal_roof_Forces.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("demo_sinosoidal_roof_Forces.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace demo_sinosoidal_roof_Forces.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("demo_sinosoidal_roof_Forces.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Resources.resx b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Resources.resx index ffecec8..71f7165 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Resources.resx +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Settings.Designer.cs b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Settings.Designer.cs index cb6cdb3..264bbbd 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Settings.Designer.cs +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Settings.Designer.cs @@ -1,26 +1,26 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace demo_sinosoidal_roof_Forces.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace demo_sinosoidal_roof_Forces.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Settings.settings b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Settings.settings index abf36c5..3964565 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Settings.settings +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/Properties/Settings.settings @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/app.config b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/app.config index 801c873..51278a4 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/app.config +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/app.config @@ -1,3 +1,3 @@ - - - + + + diff --git a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/demo_sinosoidal_roof_Forces.csproj b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/demo_sinosoidal_roof_Forces.csproj index b145cde..33b0220 100644 --- a/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/demo_sinosoidal_roof_Forces.csproj +++ b/GSA/COM API/.NET/demo_sinosoidal_roof_Forces/demo_sinosoidal_roof_Forces.csproj @@ -1,122 +1,122 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC} - WinExe - Properties - demo_sinosoidal_roof_Forces - demo_sinosoidal_roof_Forces - v4.6.1 - - - 512 - - - x64 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - false - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - true - true - false - - - - C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll - False - - - - - - - - - - - - - - - Form - - - Form1.cs - - - - - Form1.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - {544a079c-aab4-4db4-91b8-77fa245167aa} - DotNetHelpers - - - - - \ No newline at end of file + + + + Debug + x86 + 8.0.30703 + 2.0 + {4CD5F8E8-D02F-4FE1-B341-B0D9C8C312BC} + WinExe + Properties + demo_sinosoidal_roof_Forces + demo_sinosoidal_roof_Forces + v4.6.1 + + + 512 + + + x64 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + false + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + true + true + false + + + + C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll + False + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {544a079c-aab4-4db4-91b8-77fa245167aa} + DotNetHelpers + + + + + diff --git a/GSA/COM API/C++/ComClient_Output_Extract/ComClient_Output_Extract.vcxproj b/GSA/COM API/C++/ComClient_Output_Extract/ComClient_Output_Extract.vcxproj index 355ea9a..eb1f095 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/ComClient_Output_Extract.vcxproj +++ b/GSA/COM API/C++/ComClient_Output_Extract/ComClient_Output_Extract.vcxproj @@ -1,128 +1,128 @@ - - - - - Debug - x64 - - - Release - x64 - - - - {A97124FE-5C30-4CE9-ACB5-2FEBC850E444} - GsaComClient - MFCProj - ComClient_Output_Extract - 10.0 - - - - Application - Dynamic - Unicode - true - v143 - - - Application - Dynamic - Unicode - v143 - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - true - false - - - - _DEBUG;%(PreprocessorDefinitions) - false - - - Disabled - WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Use - Level3 - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - $(IntDir);%(AdditionalIncludeDirectories) - - - true - Windows - - - - - NDEBUG;%(PreprocessorDefinitions) - false - - - WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) - false - MultiThreadedDLL - Use - Level3 - ProgramDatabase - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - $(IntDir);%(AdditionalIncludeDirectories) - - - true - Windows - true - true - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + Debug + x64 + + + Release + x64 + + + + {A97124FE-5C30-4CE9-ACB5-2FEBC850E444} + GsaComClient + MFCProj + ComClient_Output_Extract + 10.0 + + + + Application + Dynamic + Unicode + true + v143 + + + Application + Dynamic + Unicode + v143 + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + true + false + + + + _DEBUG;%(PreprocessorDefinitions) + false + + + Disabled + WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + + + true + Windows + + + + + NDEBUG;%(PreprocessorDefinitions) + false + + + WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) + false + MultiThreadedDLL + Use + Level3 + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + + + true + Windows + true + true + + + + + + + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.cpp b/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.cpp index 48a51d4..0c2d00f 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.cpp +++ b/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.cpp @@ -1,212 +1,212 @@ -// GsaComClient.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" - -#include "GsaComClient.h" - -#include - -#import "C:\\Program Files\\Oasys\\GSA 10.2\\Gsa.tlb" no_namespace -#include "GsaComClientDlg.h" -// replace the above with path to GSA.tlb in the program files folder - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -// CGsaComClientApp - -BEGIN_MESSAGE_MAP(CGsaComClientApp, CWinApp) -ON_COMMAND(ID_HELP, &CWinApp::OnHelp) -END_MESSAGE_MAP() - -// CGsaComClientApp construction - -CGsaComClientApp::CGsaComClientApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -// The one and only CGsaComClientApp object - -CGsaComClientApp theApp; - -enum Output_Init_Flags -{ - OP_INIT_2D_BOTTOM = 0x01, // output 2D stresses at bottom layer - OP_INIT_2D_MIDDLE = 0x02, // output 2D stresses at middle layer - OP_INIT_2D_TOP = 0x04, // output 2D stresses at top layer - OP_INIT_2D_BENDING = 0x08, // output 2D stresses at bending layer - OP_INIT_2D_AVGE = 0x10, // average 2D element stresses at nodes - OP_INIT_1D_AUTO_PTS = 0x20, // calculate 1D results at interesting points -}; - -// CGsaComClientApp initialization - -BOOL CGsaComClientApp::InitInstance() -{ - CWinApp::InitInstance(); - - SetRegistryKey(_T("GSA Com Client")); - - CGsaComClientDlg dlg; - m_pMainWnd = &dlg; - INT_PTR nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - try - { - invokeGsa(dlg.m_filename, dlg.m_analysed_filename, dlg.m_analysed_filename_report); - } - catch (_com_error* e) - { - std::string error(e->Description()); - TRACE(error.c_str()); - } - } - else if (nResponse == IDCANCEL) - { - // TODO: Place code here to handle when the dialog is - // dismissed with Cancel - } - - // Since the dialog has been closed, return FALSE so that we exit the - // application, rather than start the application's message pump. - return FALSE; -} - -void CGsaComClientApp::invokeGsa(CString filename, CString analysed_filename, - CString analysed_filename_report) -{ - if (FAILED(CoInitializeEx(0, COINIT_APARTMENTTHREADED))) - { - return; - } - - IComAutoPtr pObj(__uuidof(ComAuto)); - short ret_code = 0; - - _bstr_t bsFileName = (LPCTSTR)filename; - ret_code = pObj->Open(bsFileName); - if (ret_code == 1) - { - return; - } - - _bstr_t bsContent(_T("RESULTS")); - ret_code = pObj->Delete(bsContent); - ASSERT(ret_code != 1); // file not open! - - _variant_t vCase(0L); - ret_code = pObj->Analyse(vCase); - ASSERT(ret_code == 0); - long NumberOfIntermediatPoint = 3; - CFile theFile; - _variant_t vt = pObj->GwaCommand("HIGHEST,EL"); - vt.ChangeType(VT_I4); - long Highest = vt.iVal; - try - { - theFile.Open(analysed_filename_report, CFile::modeCreate | CFile::modeWrite); - for (int ele = 1; ele <= Highest; ele++) - { - CString strEle; - strEle.Format(_T("%d"), ele); - CString gwa = _T("EXIST,EL,") + strEle; - BSTR bstrUser = gwa.AllocSysString(); - vt = pObj->GwaCommand(bstrUser); - vt.ChangeType(VT_BOOL); - bool elemExist = vt.iVal; - ::SysFreeString(bstrUser); - if (elemExist) - { - //FX - WriteString(theFile, _T("Forces in Element: " + strEle)); - HRESULT iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002001, - NumberOfIntermediatPoint); - long Totpos = pObj->Output_NumElemPos(ele); - for (int pos = 0; pos < Totpos; pos++) - { - CString val = pObj->Output_Extract(ele, pos); - CString Location; - Location.Format(_T("%d"), pos); - WriteString(theFile, _T("At location ") + Location + _T(": FX(kN)=") + val); - } - //FY - iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002002, - NumberOfIntermediatPoint); - Totpos = pObj->Output_NumElemPos(ele); - for (int pos = 0; pos < Totpos; pos++) - { - CString val = pObj->Output_Extract(ele, pos); - CString Location; - Location.Format(_T("%d"), pos); - WriteString(theFile, _T("At location ") + Location + _T(": FY(kN)=") + val); - } - //FZ - iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002003, - NumberOfIntermediatPoint); - Totpos = pObj->Output_NumElemPos(ele); - for (int pos = 0; pos < Totpos; pos++) - { - CString val = pObj->Output_Extract(ele, pos); - CString Location; - Location.Format(_T("%d"), pos); - WriteString(theFile, _T("At location ") + Location + _T(": FZ(kN)=") + val); - } - - //MXX - iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002005, - NumberOfIntermediatPoint); - Totpos = pObj->Output_NumElemPos(ele); - for (int pos = 0; pos < Totpos; pos++) - { - CString val = pObj->Output_Extract(ele, pos); - CString Location; - Location.Format(_T("%d"), pos); - WriteString(theFile, _T("At location ") + Location + _T(": MXX(kN-m)=") + val); - } - //MYY - iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002006, - NumberOfIntermediatPoint); - Totpos = pObj->Output_NumElemPos(ele); - for (int pos = 0; pos < Totpos; pos++) - { - CString val = pObj->Output_Extract(ele, pos); - CString Location; - Location.Format(_T("%d"), pos); - WriteString(theFile, _T("At location ") + Location + _T(": MYY(kN-m)=") + val); - } - //MZZ - iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002007, - NumberOfIntermediatPoint); - Totpos = pObj->Output_NumElemPos(ele); - for (int pos = 0; pos < Totpos; pos++) - { - CString val = pObj->Output_Extract(ele, pos); - CString Location; - Location.Format(_T("%d"), pos); - WriteString(theFile, _T("At location ") + Location + _T(": MZZ(kN-m)=") + val); - } - } - } - theFile.Close(); - } - catch (...) - { - theFile.Abort(); - } - _bstr_t bsAnalysedFileName = (LPCTSTR)analysed_filename; - ret_code = pObj->SaveAs(bsAnalysedFileName); - ASSERT(ret_code == 0); - pObj->Close(); -} - -void CGsaComClientApp::WriteString(CFile& cfile, CString str) -{ - CString cstr = _T("\r\n"); - cfile.Write((LPCTSTR)str, str.GetLength() * sizeof(TCHAR)); - cfile.Write((LPCTSTR)cstr, cstr.GetLength() * sizeof(TCHAR)); -} +// GsaComClient.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" + +#include "GsaComClient.h" + +#include + +#import "C:\\Program Files\\Oasys\\GSA 10.2\\Gsa.tlb" no_namespace +#include "GsaComClientDlg.h" +// replace the above with path to GSA.tlb in the program files folder + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +// CGsaComClientApp + +BEGIN_MESSAGE_MAP(CGsaComClientApp, CWinApp) +ON_COMMAND(ID_HELP, &CWinApp::OnHelp) +END_MESSAGE_MAP() + +// CGsaComClientApp construction + +CGsaComClientApp::CGsaComClientApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +// The one and only CGsaComClientApp object + +CGsaComClientApp theApp; + +enum Output_Init_Flags +{ + OP_INIT_2D_BOTTOM = 0x01, // output 2D stresses at bottom layer + OP_INIT_2D_MIDDLE = 0x02, // output 2D stresses at middle layer + OP_INIT_2D_TOP = 0x04, // output 2D stresses at top layer + OP_INIT_2D_BENDING = 0x08, // output 2D stresses at bending layer + OP_INIT_2D_AVGE = 0x10, // average 2D element stresses at nodes + OP_INIT_1D_AUTO_PTS = 0x20, // calculate 1D results at interesting points +}; + +// CGsaComClientApp initialization + +BOOL CGsaComClientApp::InitInstance() +{ + CWinApp::InitInstance(); + + SetRegistryKey(_T("GSA Com Client")); + + CGsaComClientDlg dlg; + m_pMainWnd = &dlg; + INT_PTR nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + try + { + invokeGsa(dlg.m_filename, dlg.m_analysed_filename, dlg.m_analysed_filename_report); + } + catch (_com_error* e) + { + std::string error(e->Description()); + TRACE(error.c_str()); + } + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} + +void CGsaComClientApp::invokeGsa(CString filename, CString analysed_filename, + CString analysed_filename_report) +{ + if (FAILED(CoInitializeEx(0, COINIT_APARTMENTTHREADED))) + { + return; + } + + IComAutoPtr pObj(__uuidof(ComAuto)); + short ret_code = 0; + + _bstr_t bsFileName = (LPCTSTR)filename; + ret_code = pObj->Open(bsFileName); + if (ret_code == 1) + { + return; + } + + _bstr_t bsContent(_T("RESULTS")); + ret_code = pObj->Delete(bsContent); + ASSERT(ret_code != 1); // file not open! + + _variant_t vCase(0L); + ret_code = pObj->Analyse(vCase); + ASSERT(ret_code == 0); + long NumberOfIntermediatPoint = 3; + CFile theFile; + _variant_t vt = pObj->GwaCommand("HIGHEST,EL"); + vt.ChangeType(VT_I4); + long Highest = vt.iVal; + try + { + theFile.Open(analysed_filename_report, CFile::modeCreate | CFile::modeWrite); + for (int ele = 1; ele <= Highest; ele++) + { + CString strEle; + strEle.Format(_T("%d"), ele); + CString gwa = _T("EXIST,EL,") + strEle; + BSTR bstrUser = gwa.AllocSysString(); + vt = pObj->GwaCommand(bstrUser); + vt.ChangeType(VT_BOOL); + bool elemExist = vt.iVal; + ::SysFreeString(bstrUser); + if (elemExist) + { + //FX + WriteString(theFile, _T("Forces in Element: " + strEle)); + HRESULT iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002001, + NumberOfIntermediatPoint); + long Totpos = pObj->Output_NumElemPos(ele); + for (int pos = 0; pos < Totpos; pos++) + { + CString val = pObj->Output_Extract(ele, pos); + CString Location; + Location.Format(_T("%d"), pos); + WriteString(theFile, _T("At location ") + Location + _T(": FX(kN)=") + val); + } + //FY + iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002002, + NumberOfIntermediatPoint); + Totpos = pObj->Output_NumElemPos(ele); + for (int pos = 0; pos < Totpos; pos++) + { + CString val = pObj->Output_Extract(ele, pos); + CString Location; + Location.Format(_T("%d"), pos); + WriteString(theFile, _T("At location ") + Location + _T(": FY(kN)=") + val); + } + //FZ + iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002003, + NumberOfIntermediatPoint); + Totpos = pObj->Output_NumElemPos(ele); + for (int pos = 0; pos < Totpos; pos++) + { + CString val = pObj->Output_Extract(ele, pos); + CString Location; + Location.Format(_T("%d"), pos); + WriteString(theFile, _T("At location ") + Location + _T(": FZ(kN)=") + val); + } + + //MXX + iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002005, + NumberOfIntermediatPoint); + Totpos = pObj->Output_NumElemPos(ele); + for (int pos = 0; pos < Totpos; pos++) + { + CString val = pObj->Output_Extract(ele, pos); + CString Location; + Location.Format(_T("%d"), pos); + WriteString(theFile, _T("At location ") + Location + _T(": MXX(kN-m)=") + val); + } + //MYY + iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002006, + NumberOfIntermediatPoint); + Totpos = pObj->Output_NumElemPos(ele); + for (int pos = 0; pos < Totpos; pos++) + { + CString val = pObj->Output_Extract(ele, pos); + CString Location; + Location.Format(_T("%d"), pos); + WriteString(theFile, _T("At location ") + Location + _T(": MYY(kN-m)=") + val); + } + //MZZ + iStat = pObj->Output_Init(OP_INIT_1D_AUTO_PTS, "default", _bstr_t("A1"), 14002007, + NumberOfIntermediatPoint); + Totpos = pObj->Output_NumElemPos(ele); + for (int pos = 0; pos < Totpos; pos++) + { + CString val = pObj->Output_Extract(ele, pos); + CString Location; + Location.Format(_T("%d"), pos); + WriteString(theFile, _T("At location ") + Location + _T(": MZZ(kN-m)=") + val); + } + } + } + theFile.Close(); + } + catch (...) + { + theFile.Abort(); + } + _bstr_t bsAnalysedFileName = (LPCTSTR)analysed_filename; + ret_code = pObj->SaveAs(bsAnalysedFileName); + ASSERT(ret_code == 0); + pObj->Close(); +} + +void CGsaComClientApp::WriteString(CFile& cfile, CString str) +{ + CString cstr = _T("\r\n"); + cfile.Write((LPCTSTR)str, str.GetLength() * sizeof(TCHAR)); + cfile.Write((LPCTSTR)cstr, cstr.GetLength() * sizeof(TCHAR)); +} diff --git a/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.h b/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.h index fc6feab..2754f5c 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.h +++ b/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.h @@ -1,34 +1,34 @@ -// GsaComClient.h : main header file for the PROJECT_NAME application -// - -#pragma once - -#ifndef __AFXWIN_H__ -#error "include 'stdafx.h' before including this file for PCH" -#endif - -#include "resource.h" // main symbols - -// CGsaComClientApp: -// See GsaComClient.cpp for the implementation of this class -// - -class CGsaComClientApp : public CWinApp -{ - public: - CGsaComClientApp(); - void invokeGsa(CString filename, CString analysed_filename, CString analysed_filename_report); - - // Overrides - public: - virtual BOOL InitInstance(); - - private: - void WriteString(CFile& cfile, CString str); - - // Implementation - - DECLARE_MESSAGE_MAP() -}; - -extern CGsaComClientApp theApp; +// GsaComClient.h : main header file for the PROJECT_NAME application +// + +#pragma once + +#ifndef __AFXWIN_H__ +#error "include 'stdafx.h' before including this file for PCH" +#endif + +#include "resource.h" // main symbols + +// CGsaComClientApp: +// See GsaComClient.cpp for the implementation of this class +// + +class CGsaComClientApp : public CWinApp +{ + public: + CGsaComClientApp(); + void invokeGsa(CString filename, CString analysed_filename, CString analysed_filename_report); + + // Overrides + public: + virtual BOOL InitInstance(); + + private: + void WriteString(CFile& cfile, CString str); + + // Implementation + + DECLARE_MESSAGE_MAP() +}; + +extern CGsaComClientApp theApp; diff --git a/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.rc b/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.rc index 0ec0d8a..415f7ab 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.rc +++ b/GSA/COM API/C++/ComClient_Output_Extract/GsaComClient.rc @@ -1,210 +1,210 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About GsaComClient" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 - LTEXT "GsaComClient Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX - LTEXT "Copyright (C) 2009",IDC_STATIC,40,25,119,8 - DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP -END - -IDD_GSACOMCLIENT_DIALOG DIALOGEX 0, 0, 268, 130 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "GsaComClient" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,73,104,50,16 - PUSHBUTTON "Cancel",IDCANCEL,137,104,50,16 - EDITTEXT IDC_EDIT_FILENAME,36,30,204,12,ES_AUTOHSCROLL - LTEXT "Select a GSA model to open...",IDC_STATIC,38,12,112,8 - LTEXT "After analysis, the file & text report will be saved to:",IDC_STATIC,36,54,176,8 - PUSHBUTTON "...",IDC_BUTTON_FILEOPEN,244,30,12,12 - LTEXT "Static",IDC_STATIC_ANALYSEDFILENAME,36,69,204,10 - LTEXT "Static",IDC_STATIC_ANALYS_REPORT,36,81,204,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "TODO: " - VALUE "FileDescription", "TODO: " - VALUE "FileVersion", "1.0.0.1" - VALUE "InternalName", "GsaComClient.exe" - VALUE "LegalCopyright", "TODO: (c) . All rights reserved." - VALUE "OriginalFilename", "GsaComClient.exe" - VALUE "ProductName", "TODO: " - VALUE "ProductVersion", "1.0.0.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 228 - TOPMARGIN, 7 - BOTTOMMARGIN, 48 - END - - IDD_GSACOMCLIENT_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 261 - TOPMARGIN, 7 - BOTTOMMARGIN, 123 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_ABOUTBOX "&About GsaComClient..." -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (United Kingdom) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#include ""res\\GsaComClient.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON "res\\GsaComClient.ico" -#endif // English (United Kingdom) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 -#pragma code_page(1252) -#include "res\GsaComClient.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About GsaComClient" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 + LTEXT "GsaComClient Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC,40,25,119,8 + DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP +END + +IDD_GSACOMCLIENT_DIALOG DIALOGEX 0, 0, 268, 130 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "GsaComClient" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,73,104,50,16 + PUSHBUTTON "Cancel",IDCANCEL,137,104,50,16 + EDITTEXT IDC_EDIT_FILENAME,36,30,204,12,ES_AUTOHSCROLL + LTEXT "Select a GSA model to open...",IDC_STATIC,38,12,112,8 + LTEXT "After analysis, the file & text report will be saved to:",IDC_STATIC,36,54,176,8 + PUSHBUTTON "...",IDC_BUTTON_FILEOPEN,244,30,12,12 + LTEXT "Static",IDC_STATIC_ANALYSEDFILENAME,36,69,204,10 + LTEXT "Static",IDC_STATIC_ANALYS_REPORT,36,81,204,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "TODO: " + VALUE "FileDescription", "TODO: " + VALUE "FileVersion", "1.0.0.1" + VALUE "InternalName", "GsaComClient.exe" + VALUE "LegalCopyright", "TODO: (c) . All rights reserved." + VALUE "OriginalFilename", "GsaComClient.exe" + VALUE "ProductName", "TODO: " + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 228 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END + + IDD_GSACOMCLIENT_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 261 + TOPMARGIN, 7 + BOTTOMMARGIN, 123 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_ABOUTBOX "&About GsaComClient..." +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (United Kingdom) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""res\\GsaComClient.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON "res\\GsaComClient.ico" +#endif // English (United Kingdom) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "res\GsaComClient.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/GSA/COM API/C++/ComClient_Output_Extract/GsaComClientDlg.cpp b/GSA/COM API/C++/ComClient_Output_Extract/GsaComClientDlg.cpp index 6c361e4..c95bc45 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/GsaComClientDlg.cpp +++ b/GSA/COM API/C++/ComClient_Output_Extract/GsaComClientDlg.cpp @@ -1,169 +1,169 @@ -// GsaComClientDlg.cpp : implementation file -// - -#include "stdafx.h" - -#include "GsaComClientDlg.h" - -#include "GsaComClient.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -// CAboutDlg dialog used for App About - -class CAboutDlg : public CDialog -{ - public: - CAboutDlg(); - - // Dialog Data - enum - { - IDD = IDD_ABOUTBOX - }; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - // Implementation - protected: - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) {} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) -END_MESSAGE_MAP() - -// CGsaComClientDlg dialog - -CGsaComClientDlg::CGsaComClientDlg(CWnd* pParent /*=NULL*/) - : CDialog(CGsaComClientDlg::IDD, pParent), m_filename(_T("")), m_analysed_filename(_T("")) -{ - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CGsaComClientDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Text(pDX, IDC_EDIT_FILENAME, m_filename); - DDX_Text(pDX, IDC_STATIC_ANALYSEDFILENAME, m_analysed_filename); - DDX_Text(pDX, IDC_STATIC_ANALYS_REPORT, m_analysed_filename_report); -} - -BEGIN_MESSAGE_MAP(CGsaComClientDlg, CDialog) -ON_WM_SYSCOMMAND() -ON_WM_PAINT() -ON_WM_QUERYDRAGICON() -//}}AFX_MSG_MAP -ON_BN_CLICKED(IDC_BUTTON_FILEOPEN, &CGsaComClientDlg::OnBnClickedButtonFileopen) -END_MESSAGE_MAP() - -// CGsaComClientDlg message handlers - -BOOL CGsaComClientDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // Add "About..." menu item to system menu. - - // IDM_ABOUTBOX must be in the system command range. - ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); - ASSERT(IDM_ABOUTBOX < 0xF000); - - CMenu* pSysMenu = GetSystemMenu(FALSE); - if (pSysMenu != NULL) - { - CString strAboutMenu; - strAboutMenu.LoadString(IDS_ABOUTBOX); - if (!strAboutMenu.IsEmpty()) - { - pSysMenu->AppendMenu(MF_SEPARATOR); - pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); - } - } - - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon - - // TODO: Add extra initialization here - - return TRUE; // return TRUE unless you set the focus to a control -} - -void CGsaComClientDlg::OnSysCommand(UINT nID, LPARAM lParam) -{ - if ((nID & 0xFFF0) == IDM_ABOUTBOX) - { - CAboutDlg dlgAbout; - dlgAbout.DoModal(); - } - else - { - CDialog::OnSysCommand(nID, lParam); - } -} - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CGsaComClientDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -// The system calls this function to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CGsaComClientDlg::OnQueryDragIcon() -{ - return static_cast(m_hIcon); -} - -void CGsaComClientDlg::OnBnClickedButtonFileopen() -{ - CFileDialog dialog(TRUE); - dialog.m_ofn.lpstrFilter = _T("*.gwb"); - dialog.DoModal(); - m_filename = dialog.GetPathName(); - if (m_filename.IsEmpty()) - { - return; - } - - m_analysed_filename = m_filename; - m_analysed_filename.Delete(m_filename.Find(_T(".gwb")), 4); - m_analysed_filename_report = m_analysed_filename; - m_analysed_filename += "_analysed.gwb"; - m_analysed_filename_report = m_analysed_filename_report + _T("_analysed.txt"); - UpdateData(FALSE); -} +// GsaComClientDlg.cpp : implementation file +// + +#include "stdafx.h" + +#include "GsaComClientDlg.h" + +#include "GsaComClient.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ + public: + CAboutDlg(); + + // Dialog Data + enum + { + IDD = IDD_ABOUTBOX + }; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + // Implementation + protected: + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) {} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) +END_MESSAGE_MAP() + +// CGsaComClientDlg dialog + +CGsaComClientDlg::CGsaComClientDlg(CWnd* pParent /*=NULL*/) + : CDialog(CGsaComClientDlg::IDD, pParent), m_filename(_T("")), m_analysed_filename(_T("")) +{ + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); +} + +void CGsaComClientDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Text(pDX, IDC_EDIT_FILENAME, m_filename); + DDX_Text(pDX, IDC_STATIC_ANALYSEDFILENAME, m_analysed_filename); + DDX_Text(pDX, IDC_STATIC_ANALYS_REPORT, m_analysed_filename_report); +} + +BEGIN_MESSAGE_MAP(CGsaComClientDlg, CDialog) +ON_WM_SYSCOMMAND() +ON_WM_PAINT() +ON_WM_QUERYDRAGICON() +//}}AFX_MSG_MAP +ON_BN_CLICKED(IDC_BUTTON_FILEOPEN, &CGsaComClientDlg::OnBnClickedButtonFileopen) +END_MESSAGE_MAP() + +// CGsaComClientDlg message handlers + +BOOL CGsaComClientDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Add "About..." menu item to system menu. + + // IDM_ABOUTBOX must be in the system command range. + ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); + ASSERT(IDM_ABOUTBOX < 0xF000); + + CMenu* pSysMenu = GetSystemMenu(FALSE); + if (pSysMenu != NULL) + { + CString strAboutMenu; + strAboutMenu.LoadString(IDS_ABOUTBOX); + if (!strAboutMenu.IsEmpty()) + { + pSysMenu->AppendMenu(MF_SEPARATOR); + pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); + } + } + + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + // TODO: Add extra initialization here + + return TRUE; // return TRUE unless you set the focus to a control +} + +void CGsaComClientDlg::OnSysCommand(UINT nID, LPARAM lParam) +{ + if ((nID & 0xFFF0) == IDM_ABOUTBOX) + { + CAboutDlg dlgAbout; + dlgAbout.DoModal(); + } + else + { + CDialog::OnSysCommand(nID, lParam); + } +} + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CGsaComClientDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialog::OnPaint(); + } +} + +// The system calls this function to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR CGsaComClientDlg::OnQueryDragIcon() +{ + return static_cast(m_hIcon); +} + +void CGsaComClientDlg::OnBnClickedButtonFileopen() +{ + CFileDialog dialog(TRUE); + dialog.m_ofn.lpstrFilter = _T("*.gwb"); + dialog.DoModal(); + m_filename = dialog.GetPathName(); + if (m_filename.IsEmpty()) + { + return; + } + + m_analysed_filename = m_filename; + m_analysed_filename.Delete(m_filename.Find(_T(".gwb")), 4); + m_analysed_filename_report = m_analysed_filename; + m_analysed_filename += "_analysed.gwb"; + m_analysed_filename_report = m_analysed_filename_report + _T("_analysed.txt"); + UpdateData(FALSE); +} diff --git a/GSA/COM API/C++/ComClient_Output_Extract/GsaComClientDlg.h b/GSA/COM API/C++/ComClient_Output_Extract/GsaComClientDlg.h index 9667190..31e45ad 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/GsaComClientDlg.h +++ b/GSA/COM API/C++/ComClient_Output_Extract/GsaComClientDlg.h @@ -1,41 +1,41 @@ -// GsaComClientDlg.h : header file -// - -#pragma once -#include "afxwin.h" - -// CGsaComClientDlg dialog -class CGsaComClientDlg : public CDialog -{ - // Construction - public: - CGsaComClientDlg(CWnd* pParent = NULL); // standard constructor - - // Dialog Data - enum - { - IDD = IDD_GSACOMCLIENT_DIALOG - }; - - //CString m_filename; - //CString m_analysed_filename; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - // Implementation - protected: - HICON m_hIcon; - - // Generated message map functions - virtual BOOL OnInitDialog(); - afx_msg void OnSysCommand(UINT nID, LPARAM lParam); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - DECLARE_MESSAGE_MAP() - public: - afx_msg void OnBnClickedButtonFileopen(); - CString m_filename; - CString m_analysed_filename; - CString m_analysed_filename_report; -}; +// GsaComClientDlg.h : header file +// + +#pragma once +#include "afxwin.h" + +// CGsaComClientDlg dialog +class CGsaComClientDlg : public CDialog +{ + // Construction + public: + CGsaComClientDlg(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + enum + { + IDD = IDD_GSACOMCLIENT_DIALOG + }; + + //CString m_filename; + //CString m_analysed_filename; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + // Implementation + protected: + HICON m_hIcon; + + // Generated message map functions + virtual BOOL OnInitDialog(); + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + DECLARE_MESSAGE_MAP() + public: + afx_msg void OnBnClickedButtonFileopen(); + CString m_filename; + CString m_analysed_filename; + CString m_analysed_filename_report; +}; diff --git a/GSA/COM API/C++/ComClient_Output_Extract/ReadMe.txt b/GSA/COM API/C++/ComClient_Output_Extract/ReadMe.txt index ec5d1f4..849c7e6 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/ReadMe.txt +++ b/GSA/COM API/C++/ComClient_Output_Extract/ReadMe.txt @@ -1,79 +1,79 @@ -================================================================================ - MICROSOFT FOUNDATION CLASS LIBRARY : GsaComClient Project Overview -=============================================================================== - -The application wizard has created this GsaComClient application for -you. This application not only demonstrates the basics of using the Microsoft -Foundation Classes but is also a starting point for writing your application. - -This file contains a summary of what you will find in each of the files that -make up your GsaComClient application. - -GsaComClient.vcproj - This is the main project file for VC++ projects generated using an application wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - application wizard. - -GsaComClient.h - This is the main header file for the application. It includes other - project specific headers (including Resource.h) and declares the - CGsaComClientApp application class. - -GsaComClient.cpp - This is the main application source file that contains the application - class CGsaComClientApp. - -GsaComClient.rc - This is a listing of all of the Microsoft Windows resources that the - program uses. It includes the icons, bitmaps, and cursors that are stored - in the RES subdirectory. This file can be directly edited in Microsoft - Visual C++. Your project resources are in 1033. - -res\GsaComClient.ico - This is an icon file, which is used as the application's icon. This - icon is included by the main resource file GsaComClient.rc. - -res\GsaComClient.rc2 - This file contains resources that are not edited by Microsoft - Visual C++. You should place all resources not editable by - the resource editor in this file. - - -///////////////////////////////////////////////////////////////////////////// - -The application wizard creates one dialog class: - -GsaComClientDlg.h, GsaComClientDlg.cpp - the dialog - These files contain your CGsaComClientDlg class. This class defines - the behavior of your application's main dialog. The dialog's template is - in GsaComClient.rc, which can be edited in Microsoft Visual C++. - - -///////////////////////////////////////////////////////////////////////////// - -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named GsaComClient.pch and a precompiled types file named StdAfx.obj. - -Resource.h - This is the standard header file, which defines new resource IDs. - Microsoft Visual C++ reads and updates this file. - -///////////////////////////////////////////////////////////////////////////// - -Other notes: - -The application wizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - -If your application uses MFC in a shared DLL, you will need -to redistribute the MFC DLLs. If your application is in a language -other than the operating system's locale, you will also have to -redistribute the corresponding localized resources MFC80XXX.DLL. -For more information on both of these topics, please see the section on -redistributing Visual C++ applications in MSDN documentation. - -///////////////////////////////////////////////////////////////////////////// +================================================================================ + MICROSOFT FOUNDATION CLASS LIBRARY : GsaComClient Project Overview +=============================================================================== + +The application wizard has created this GsaComClient application for +you. This application not only demonstrates the basics of using the Microsoft +Foundation Classes but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your GsaComClient application. + +GsaComClient.vcproj + This is the main project file for VC++ projects generated using an application wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + application wizard. + +GsaComClient.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CGsaComClientApp application class. + +GsaComClient.cpp + This is the main application source file that contains the application + class CGsaComClientApp. + +GsaComClient.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. Your project resources are in 1033. + +res\GsaComClient.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file GsaComClient.rc. + +res\GsaComClient.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. + + +///////////////////////////////////////////////////////////////////////////// + +The application wizard creates one dialog class: + +GsaComClientDlg.h, GsaComClientDlg.cpp - the dialog + These files contain your CGsaComClientDlg class. This class defines + the behavior of your application's main dialog. The dialog's template is + in GsaComClient.rc, which can be edited in Microsoft Visual C++. + + +///////////////////////////////////////////////////////////////////////////// + +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named GsaComClient.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// + +Other notes: + +The application wizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, you will need +to redistribute the MFC DLLs. If your application is in a language +other than the operating system's locale, you will also have to +redistribute the corresponding localized resources MFC80XXX.DLL. +For more information on both of these topics, please see the section on +redistributing Visual C++ applications in MSDN documentation. + +///////////////////////////////////////////////////////////////////////////// diff --git a/GSA/COM API/C++/ComClient_Output_Extract/res/GsaComClient.rc2 b/GSA/COM API/C++/ComClient_Output_Extract/res/GsaComClient.rc2 index 20a0d6a..1f459c5 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/res/GsaComClient.rc2 +++ b/GSA/COM API/C++/ComClient_Output_Extract/res/GsaComClient.rc2 @@ -1,13 +1,13 @@ -// -// GsaComClient.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// +// +// GsaComClient.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/GSA/COM API/C++/ComClient_Output_Extract/resource.h b/GSA/COM API/C++/ComClient_Output_Extract/resource.h index 8e83335..dc29785 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/resource.h +++ b/GSA/COM API/C++/ComClient_Output_Extract/resource.h @@ -1,26 +1,26 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by GsaComClient.rc -// -#define IDM_ABOUTBOX 0x0010 -#define IDD_ABOUTBOX 100 -#define IDS_ABOUTBOX 101 -#define IDD_GSACOMCLIENT_DIALOG 102 -#define IDR_MAINFRAME 128 -#define IDC_EDIT_FILENAME 1000 -#define IDC_BUTTON1 1001 -#define IDC_BUTTON_FILEOPEN 1001 -#define IDC_STATIC_ANALYSEDFILENAME 1002 -#define IDC_STATIC_ANALYSEDFILENAME2 1003 -#define IDC_STATIC_ANALYS_REPORT 1003 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1003 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by GsaComClient.rc +// +#define IDM_ABOUTBOX 0x0010 +#define IDD_ABOUTBOX 100 +#define IDS_ABOUTBOX 101 +#define IDD_GSACOMCLIENT_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDC_EDIT_FILENAME 1000 +#define IDC_BUTTON1 1001 +#define IDC_BUTTON_FILEOPEN 1001 +#define IDC_STATIC_ANALYSEDFILENAME 1002 +#define IDC_STATIC_ANALYSEDFILENAME2 1003 +#define IDC_STATIC_ANALYS_REPORT 1003 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1003 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/GSA/COM API/C++/ComClient_Output_Extract/stdafx.cpp b/GSA/COM API/C++/ComClient_Output_Extract/stdafx.cpp index b646eae..9ce7107 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/stdafx.cpp +++ b/GSA/COM API/C++/ComClient_Output_Extract/stdafx.cpp @@ -1,5 +1,5 @@ -// stdafx.cpp : source file that includes just the standard includes -// GsaComClient.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" +// stdafx.cpp : source file that includes just the standard includes +// GsaComClient.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" diff --git a/GSA/COM API/C++/ComClient_Output_Extract/stdafx.h b/GSA/COM API/C++/ComClient_Output_Extract/stdafx.h index c57cc1a..759aaed 100644 --- a/GSA/COM API/C++/ComClient_Output_Extract/stdafx.h +++ b/GSA/COM API/C++/ComClient_Output_Extract/stdafx.h @@ -1,46 +1,46 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#pragma once - -#ifndef _SECURE_ATL -#define _SECURE_ATL 1 -#endif - -#ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers -#endif - -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit - -// turns off MFC's hiding of some common and often safely ignored warning messages -#define _AFX_ALL_WARNINGS - -#include // MFC extensions -#include // MFC core and standard components - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC support for Internet Explorer 4 Common Controls -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +#ifndef _SECURE_ATL +#define _SECURE_ATL 1 +#endif + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows XP or later. +#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. +#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. +#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#endif + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include // MFC extensions +#include // MFC core and standard components + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC support for Internet Explorer 4 Common Controls +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/Comclient_Output_Extract_Arr.vcxproj b/GSA/COM API/C++/Comclient_Output_Extract_Arr/Comclient_Output_Extract_Arr.vcxproj index 42bd23c..8b838f4 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/Comclient_Output_Extract_Arr.vcxproj +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/Comclient_Output_Extract_Arr.vcxproj @@ -1,136 +1,136 @@ - - - - - Debug - x64 - - - Release - x64 - - - - {0A9F0CF1-896D-4F36-BB43-6E83FA444B2F} - GsaComClient - MFCProj - Comclient_Output_Extract_Arr - 10.0 - - - - Application - v143 - Dynamic - Unicode - true - - - Application - v143 - Dynamic - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - true - - - false - - - - _DEBUG;%(PreprocessorDefinitions) - false - - - Disabled - WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Use - Level3 - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - $(IntDir);%(AdditionalIncludeDirectories) - - - true - Windows - - - - - NDEBUG;%(PreprocessorDefinitions) - false - - - WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) - false - MultiThreadedDLL - Use - Level3 - ProgramDatabase - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - $(IntDir);%(AdditionalIncludeDirectories) - - - true - Windows - true - true - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + Debug + x64 + + + Release + x64 + + + + {0A9F0CF1-896D-4F36-BB43-6E83FA444B2F} + GsaComClient + MFCProj + Comclient_Output_Extract_Arr + 10.0 + + + + Application + v143 + Dynamic + Unicode + true + + + Application + v143 + Dynamic + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.50727.1 + + + true + + + false + + + + _DEBUG;%(PreprocessorDefinitions) + false + + + Disabled + WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + + + true + Windows + + + + + NDEBUG;%(PreprocessorDefinitions) + false + + + WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) + false + MultiThreadedDLL + Use + Level3 + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + + + true + Windows + true + true + + + + + + + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.cpp b/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.cpp index aec5734..6c88aaf 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.cpp +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.cpp @@ -1,180 +1,180 @@ -// GsaComClient.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" - -#include "GsaComClient.h" - -#include - -#import "C:\\Program Files\\Oasys\\GSA 10.2\\Gsa.tlb" no_namespace -#include "GsaComClientDlg.h" -// replace the above with path to GSA.tlb in the program files folder - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -// CGsaComClientApp - -BEGIN_MESSAGE_MAP(CGsaComClientApp, CWinApp) -ON_COMMAND(ID_HELP, &CWinApp::OnHelp) -END_MESSAGE_MAP() - -// CGsaComClientApp construction - -CGsaComClientApp::CGsaComClientApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -// The one and only CGsaComClientApp object - -CGsaComClientApp theApp; - -// CGsaComClientApp initialization -enum Output_Init_Flags -{ - OP_INIT_2D_BOTTOM = 0x01, // output 2D stresses at bottom layer - OP_INIT_2D_MIDDLE = 0x02, // output 2D stresses at middle layer - OP_INIT_2D_TOP = 0x04, // output 2D stresses at top layer - OP_INIT_2D_BENDING = 0x08, // output 2D stresses at bending layer - OP_INIT_2D_AVGE = 0x10, // average 2D element stresses at nodes - OP_INIT_1D_AUTO_PTS = 0x20, // calculate 1D results at interesting points -}; - -BOOL CGsaComClientApp::InitInstance() -{ - CWinApp::InitInstance(); - - SetRegistryKey(_T("GSA Com Client")); - - CGsaComClientDlg dlg; - m_pMainWnd = &dlg; - INT_PTR nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - try - { - invokeGsa(dlg.m_filename, dlg.m_analysed_filename, dlg.m_analysed_filename_report); - } - catch (_com_error* e) - { - std::string error(e->Description()); - TRACE(error.c_str()); - } - } - else if (nResponse == IDCANCEL) - { - // TODO: Place code here to handle when the dialog is - // dismissed with Cancel - } - - // Since the dialog has been closed, return FALSE so that we exit the - // application, rather than start the application's message pump. - return FALSE; -} - -void CGsaComClientApp::invokeGsa(CString filename, CString analysed_filename, - CString analysed_filename_report) -{ - if (FAILED(CoInitializeEx(0, COINIT_APARTMENTTHREADED))) - { - return; - } - - IComAutoPtr pObj(__uuidof(ComAuto)); - short ret_code = 0; - - _bstr_t bsFileName = (LPCTSTR)filename; - ret_code = pObj->Open(bsFileName); - if (ret_code == 1) - { - return; - } - - _bstr_t bsContent(_T("RESULTS")); - ret_code = pObj->Delete(bsContent); - ASSERT(ret_code != 1); // file not open! - - _variant_t vCase(0L); - ret_code = pObj->Analyse(vCase); - ASSERT(ret_code == 0); - long NumberOfIntermediatPoint = 4; - CFile theFile; - - _variant_t vt = pObj->GwaCommand("HIGHEST,EL"); - vt.ChangeType(VT_I4); - long Highest = vt.iVal; - try - { - theFile.Open(analysed_filename_report, CFile::modeCreate | CFile::modeWrite); - for (int ele = 0; ele <= Highest; ele++) - { - SAFEARRAY* arryResult = nullptr; - long component; - GsaResults* gsRes = nullptr; - CString strEle(std::to_string(ele + 1).c_str()); - CString gwa = _T("EXIST,EL,") + strEle; - BSTR bstrUser = gwa.AllocSysString(); - vt = pObj->GwaCommand(bstrUser); - vt.ChangeType(VT_BOOL); - bool elemExist = vt.iVal; - ::SysFreeString(bstrUser); - if (elemExist) - { - WriteString(theFile, _T("Forces in Element: " + strEle)); - pObj->Output_Init_Arr((long)Output_Init_Flags::OP_INIT_1D_AUTO_PTS, _bstr_t(L"default"), - _bstr_t("A1"), ResHeader::REF_DISP_EL1D, NumberOfIntermediatPoint); - pObj->Output_Extract_Arr(ele + 1, &arryResult, &component); - HRESULT hr = SafeArrayAccessData(arryResult, (void**)&gsRes); - - long lowerBound, upperBound; // get array bounds - SafeArrayGetLBound(arryResult, 1, &lowerBound); - SafeArrayGetUBound(arryResult, 1, &upperBound); - const int cnt_elements = upperBound - lowerBound + 1; - - for (int i = 0; i < cnt_elements; ++i) // iterate through returned values - { - CString Location(std::to_string(i + 1).c_str()); - WriteString( - theFile, - _T("At location ") + Location + - _T(": FX(kN),FY(kN),FZ(kN),FRC(kN),MXX(kN-m),MYY(kN-m),MZZ(kN-m),MOM(kN-m)")); - SAFEARRAY* dynaRes = gsRes[i].dynaResults; - double* gsDynaRes = nullptr; - hr = SafeArrayAccessData(dynaRes, (void**)&gsDynaRes); - CString append = _T(""); - for (int j = 0; j < component; j++) - { - CString val(std::to_string(gsDynaRes[j]).c_str()); - append = append + val; - } - WriteString(theFile, append); - SafeArrayUnaccessData(dynaRes); - } - SafeArrayUnaccessData(arryResult); - } - } - theFile.Close(); - } - catch (...) - { - theFile.Abort(); - } - - // - - bstr_t bsAnalysedFileName = (LPCTSTR)analysed_filename; - ret_code = pObj->SaveAs(bsAnalysedFileName); - ASSERT(ret_code == 0); - pObj->Close(); -} - -void CGsaComClientApp::WriteString(CFile& cfile, CString str) -{ - CString cstr = _T("\r\n"); - cfile.Write((LPCTSTR)str, str.GetLength() * sizeof(TCHAR)); - cfile.Write((LPCTSTR)cstr, cstr.GetLength() * sizeof(TCHAR)); -} +// GsaComClient.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" + +#include "GsaComClient.h" + +#include + +#import "C:\\Program Files\\Oasys\\GSA 10.2\\Gsa.tlb" no_namespace +#include "GsaComClientDlg.h" +// replace the above with path to GSA.tlb in the program files folder + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +// CGsaComClientApp + +BEGIN_MESSAGE_MAP(CGsaComClientApp, CWinApp) +ON_COMMAND(ID_HELP, &CWinApp::OnHelp) +END_MESSAGE_MAP() + +// CGsaComClientApp construction + +CGsaComClientApp::CGsaComClientApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +// The one and only CGsaComClientApp object + +CGsaComClientApp theApp; + +// CGsaComClientApp initialization +enum Output_Init_Flags +{ + OP_INIT_2D_BOTTOM = 0x01, // output 2D stresses at bottom layer + OP_INIT_2D_MIDDLE = 0x02, // output 2D stresses at middle layer + OP_INIT_2D_TOP = 0x04, // output 2D stresses at top layer + OP_INIT_2D_BENDING = 0x08, // output 2D stresses at bending layer + OP_INIT_2D_AVGE = 0x10, // average 2D element stresses at nodes + OP_INIT_1D_AUTO_PTS = 0x20, // calculate 1D results at interesting points +}; + +BOOL CGsaComClientApp::InitInstance() +{ + CWinApp::InitInstance(); + + SetRegistryKey(_T("GSA Com Client")); + + CGsaComClientDlg dlg; + m_pMainWnd = &dlg; + INT_PTR nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + try + { + invokeGsa(dlg.m_filename, dlg.m_analysed_filename, dlg.m_analysed_filename_report); + } + catch (_com_error* e) + { + std::string error(e->Description()); + TRACE(error.c_str()); + } + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} + +void CGsaComClientApp::invokeGsa(CString filename, CString analysed_filename, + CString analysed_filename_report) +{ + if (FAILED(CoInitializeEx(0, COINIT_APARTMENTTHREADED))) + { + return; + } + + IComAutoPtr pObj(__uuidof(ComAuto)); + short ret_code = 0; + + _bstr_t bsFileName = (LPCTSTR)filename; + ret_code = pObj->Open(bsFileName); + if (ret_code == 1) + { + return; + } + + _bstr_t bsContent(_T("RESULTS")); + ret_code = pObj->Delete(bsContent); + ASSERT(ret_code != 1); // file not open! + + _variant_t vCase(0L); + ret_code = pObj->Analyse(vCase); + ASSERT(ret_code == 0); + long NumberOfIntermediatPoint = 4; + CFile theFile; + + _variant_t vt = pObj->GwaCommand("HIGHEST,EL"); + vt.ChangeType(VT_I4); + long Highest = vt.iVal; + try + { + theFile.Open(analysed_filename_report, CFile::modeCreate | CFile::modeWrite); + for (int ele = 0; ele <= Highest; ele++) + { + SAFEARRAY* arryResult = nullptr; + long component; + GsaResults* gsRes = nullptr; + CString strEle(std::to_string(ele + 1).c_str()); + CString gwa = _T("EXIST,EL,") + strEle; + BSTR bstrUser = gwa.AllocSysString(); + vt = pObj->GwaCommand(bstrUser); + vt.ChangeType(VT_BOOL); + bool elemExist = vt.iVal; + ::SysFreeString(bstrUser); + if (elemExist) + { + WriteString(theFile, _T("Forces in Element: " + strEle)); + pObj->Output_Init_Arr((long)Output_Init_Flags::OP_INIT_1D_AUTO_PTS, _bstr_t(L"default"), + _bstr_t("A1"), ResHeader::REF_DISP_EL1D, NumberOfIntermediatPoint); + pObj->Output_Extract_Arr(ele + 1, &arryResult, &component); + HRESULT hr = SafeArrayAccessData(arryResult, (void**)&gsRes); + + long lowerBound, upperBound; // get array bounds + SafeArrayGetLBound(arryResult, 1, &lowerBound); + SafeArrayGetUBound(arryResult, 1, &upperBound); + const int cnt_elements = upperBound - lowerBound + 1; + + for (int i = 0; i < cnt_elements; ++i) // iterate through returned values + { + CString Location(std::to_string(i + 1).c_str()); + WriteString( + theFile, + _T("At location ") + Location + + _T(": FX(kN),FY(kN),FZ(kN),FRC(kN),MXX(kN-m),MYY(kN-m),MZZ(kN-m),MOM(kN-m)")); + SAFEARRAY* dynaRes = gsRes[i].dynaResults; + double* gsDynaRes = nullptr; + hr = SafeArrayAccessData(dynaRes, (void**)&gsDynaRes); + CString append = _T(""); + for (int j = 0; j < component; j++) + { + CString val(std::to_string(gsDynaRes[j]).c_str()); + append = append + val; + } + WriteString(theFile, append); + SafeArrayUnaccessData(dynaRes); + } + SafeArrayUnaccessData(arryResult); + } + } + theFile.Close(); + } + catch (...) + { + theFile.Abort(); + } + + // + + bstr_t bsAnalysedFileName = (LPCTSTR)analysed_filename; + ret_code = pObj->SaveAs(bsAnalysedFileName); + ASSERT(ret_code == 0); + pObj->Close(); +} + +void CGsaComClientApp::WriteString(CFile& cfile, CString str) +{ + CString cstr = _T("\r\n"); + cfile.Write((LPCTSTR)str, str.GetLength() * sizeof(TCHAR)); + cfile.Write((LPCTSTR)cstr, cstr.GetLength() * sizeof(TCHAR)); +} diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.h b/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.h index fc6feab..2754f5c 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.h +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.h @@ -1,34 +1,34 @@ -// GsaComClient.h : main header file for the PROJECT_NAME application -// - -#pragma once - -#ifndef __AFXWIN_H__ -#error "include 'stdafx.h' before including this file for PCH" -#endif - -#include "resource.h" // main symbols - -// CGsaComClientApp: -// See GsaComClient.cpp for the implementation of this class -// - -class CGsaComClientApp : public CWinApp -{ - public: - CGsaComClientApp(); - void invokeGsa(CString filename, CString analysed_filename, CString analysed_filename_report); - - // Overrides - public: - virtual BOOL InitInstance(); - - private: - void WriteString(CFile& cfile, CString str); - - // Implementation - - DECLARE_MESSAGE_MAP() -}; - -extern CGsaComClientApp theApp; +// GsaComClient.h : main header file for the PROJECT_NAME application +// + +#pragma once + +#ifndef __AFXWIN_H__ +#error "include 'stdafx.h' before including this file for PCH" +#endif + +#include "resource.h" // main symbols + +// CGsaComClientApp: +// See GsaComClient.cpp for the implementation of this class +// + +class CGsaComClientApp : public CWinApp +{ + public: + CGsaComClientApp(); + void invokeGsa(CString filename, CString analysed_filename, CString analysed_filename_report); + + // Overrides + public: + virtual BOOL InitInstance(); + + private: + void WriteString(CFile& cfile, CString str); + + // Implementation + + DECLARE_MESSAGE_MAP() +}; + +extern CGsaComClientApp theApp; diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.rc b/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.rc index 0ec0d8a..415f7ab 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.rc +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClient.rc @@ -1,210 +1,210 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About GsaComClient" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 - LTEXT "GsaComClient Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX - LTEXT "Copyright (C) 2009",IDC_STATIC,40,25,119,8 - DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP -END - -IDD_GSACOMCLIENT_DIALOG DIALOGEX 0, 0, 268, 130 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "GsaComClient" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,73,104,50,16 - PUSHBUTTON "Cancel",IDCANCEL,137,104,50,16 - EDITTEXT IDC_EDIT_FILENAME,36,30,204,12,ES_AUTOHSCROLL - LTEXT "Select a GSA model to open...",IDC_STATIC,38,12,112,8 - LTEXT "After analysis, the file & text report will be saved to:",IDC_STATIC,36,54,176,8 - PUSHBUTTON "...",IDC_BUTTON_FILEOPEN,244,30,12,12 - LTEXT "Static",IDC_STATIC_ANALYSEDFILENAME,36,69,204,10 - LTEXT "Static",IDC_STATIC_ANALYS_REPORT,36,81,204,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "TODO: " - VALUE "FileDescription", "TODO: " - VALUE "FileVersion", "1.0.0.1" - VALUE "InternalName", "GsaComClient.exe" - VALUE "LegalCopyright", "TODO: (c) . All rights reserved." - VALUE "OriginalFilename", "GsaComClient.exe" - VALUE "ProductName", "TODO: " - VALUE "ProductVersion", "1.0.0.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 228 - TOPMARGIN, 7 - BOTTOMMARGIN, 48 - END - - IDD_GSACOMCLIENT_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 261 - TOPMARGIN, 7 - BOTTOMMARGIN, 123 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_ABOUTBOX "&About GsaComClient..." -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (United Kingdom) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -#pragma code_page(1252) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#include ""res\\GsaComClient.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON "res\\GsaComClient.ico" -#endif // English (United Kingdom) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 -#pragma code_page(1252) -#include "res\GsaComClient.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About GsaComClient" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 + LTEXT "GsaComClient Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC,40,25,119,8 + DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP +END + +IDD_GSACOMCLIENT_DIALOG DIALOGEX 0, 0, 268, 130 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "GsaComClient" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,73,104,50,16 + PUSHBUTTON "Cancel",IDCANCEL,137,104,50,16 + EDITTEXT IDC_EDIT_FILENAME,36,30,204,12,ES_AUTOHSCROLL + LTEXT "Select a GSA model to open...",IDC_STATIC,38,12,112,8 + LTEXT "After analysis, the file & text report will be saved to:",IDC_STATIC,36,54,176,8 + PUSHBUTTON "...",IDC_BUTTON_FILEOPEN,244,30,12,12 + LTEXT "Static",IDC_STATIC_ANALYSEDFILENAME,36,69,204,10 + LTEXT "Static",IDC_STATIC_ANALYS_REPORT,36,81,204,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "TODO: " + VALUE "FileDescription", "TODO: " + VALUE "FileVersion", "1.0.0.1" + VALUE "InternalName", "GsaComClient.exe" + VALUE "LegalCopyright", "TODO: (c) . All rights reserved." + VALUE "OriginalFilename", "GsaComClient.exe" + VALUE "ProductName", "TODO: " + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 228 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END + + IDD_GSACOMCLIENT_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 261 + TOPMARGIN, 7 + BOTTOMMARGIN, 123 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_ABOUTBOX "&About GsaComClient..." +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (United Kingdom) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""res\\GsaComClient.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON "res\\GsaComClient.ico" +#endif // English (United Kingdom) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "res\GsaComClient.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClientDlg.cpp b/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClientDlg.cpp index 6c361e4..c95bc45 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClientDlg.cpp +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClientDlg.cpp @@ -1,169 +1,169 @@ -// GsaComClientDlg.cpp : implementation file -// - -#include "stdafx.h" - -#include "GsaComClientDlg.h" - -#include "GsaComClient.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -// CAboutDlg dialog used for App About - -class CAboutDlg : public CDialog -{ - public: - CAboutDlg(); - - // Dialog Data - enum - { - IDD = IDD_ABOUTBOX - }; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - // Implementation - protected: - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) {} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) -END_MESSAGE_MAP() - -// CGsaComClientDlg dialog - -CGsaComClientDlg::CGsaComClientDlg(CWnd* pParent /*=NULL*/) - : CDialog(CGsaComClientDlg::IDD, pParent), m_filename(_T("")), m_analysed_filename(_T("")) -{ - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CGsaComClientDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Text(pDX, IDC_EDIT_FILENAME, m_filename); - DDX_Text(pDX, IDC_STATIC_ANALYSEDFILENAME, m_analysed_filename); - DDX_Text(pDX, IDC_STATIC_ANALYS_REPORT, m_analysed_filename_report); -} - -BEGIN_MESSAGE_MAP(CGsaComClientDlg, CDialog) -ON_WM_SYSCOMMAND() -ON_WM_PAINT() -ON_WM_QUERYDRAGICON() -//}}AFX_MSG_MAP -ON_BN_CLICKED(IDC_BUTTON_FILEOPEN, &CGsaComClientDlg::OnBnClickedButtonFileopen) -END_MESSAGE_MAP() - -// CGsaComClientDlg message handlers - -BOOL CGsaComClientDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // Add "About..." menu item to system menu. - - // IDM_ABOUTBOX must be in the system command range. - ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); - ASSERT(IDM_ABOUTBOX < 0xF000); - - CMenu* pSysMenu = GetSystemMenu(FALSE); - if (pSysMenu != NULL) - { - CString strAboutMenu; - strAboutMenu.LoadString(IDS_ABOUTBOX); - if (!strAboutMenu.IsEmpty()) - { - pSysMenu->AppendMenu(MF_SEPARATOR); - pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); - } - } - - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon - - // TODO: Add extra initialization here - - return TRUE; // return TRUE unless you set the focus to a control -} - -void CGsaComClientDlg::OnSysCommand(UINT nID, LPARAM lParam) -{ - if ((nID & 0xFFF0) == IDM_ABOUTBOX) - { - CAboutDlg dlgAbout; - dlgAbout.DoModal(); - } - else - { - CDialog::OnSysCommand(nID, lParam); - } -} - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CGsaComClientDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -// The system calls this function to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CGsaComClientDlg::OnQueryDragIcon() -{ - return static_cast(m_hIcon); -} - -void CGsaComClientDlg::OnBnClickedButtonFileopen() -{ - CFileDialog dialog(TRUE); - dialog.m_ofn.lpstrFilter = _T("*.gwb"); - dialog.DoModal(); - m_filename = dialog.GetPathName(); - if (m_filename.IsEmpty()) - { - return; - } - - m_analysed_filename = m_filename; - m_analysed_filename.Delete(m_filename.Find(_T(".gwb")), 4); - m_analysed_filename_report = m_analysed_filename; - m_analysed_filename += "_analysed.gwb"; - m_analysed_filename_report = m_analysed_filename_report + _T("_analysed.txt"); - UpdateData(FALSE); -} +// GsaComClientDlg.cpp : implementation file +// + +#include "stdafx.h" + +#include "GsaComClientDlg.h" + +#include "GsaComClient.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ + public: + CAboutDlg(); + + // Dialog Data + enum + { + IDD = IDD_ABOUTBOX + }; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + // Implementation + protected: + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) {} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) +END_MESSAGE_MAP() + +// CGsaComClientDlg dialog + +CGsaComClientDlg::CGsaComClientDlg(CWnd* pParent /*=NULL*/) + : CDialog(CGsaComClientDlg::IDD, pParent), m_filename(_T("")), m_analysed_filename(_T("")) +{ + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); +} + +void CGsaComClientDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Text(pDX, IDC_EDIT_FILENAME, m_filename); + DDX_Text(pDX, IDC_STATIC_ANALYSEDFILENAME, m_analysed_filename); + DDX_Text(pDX, IDC_STATIC_ANALYS_REPORT, m_analysed_filename_report); +} + +BEGIN_MESSAGE_MAP(CGsaComClientDlg, CDialog) +ON_WM_SYSCOMMAND() +ON_WM_PAINT() +ON_WM_QUERYDRAGICON() +//}}AFX_MSG_MAP +ON_BN_CLICKED(IDC_BUTTON_FILEOPEN, &CGsaComClientDlg::OnBnClickedButtonFileopen) +END_MESSAGE_MAP() + +// CGsaComClientDlg message handlers + +BOOL CGsaComClientDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Add "About..." menu item to system menu. + + // IDM_ABOUTBOX must be in the system command range. + ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); + ASSERT(IDM_ABOUTBOX < 0xF000); + + CMenu* pSysMenu = GetSystemMenu(FALSE); + if (pSysMenu != NULL) + { + CString strAboutMenu; + strAboutMenu.LoadString(IDS_ABOUTBOX); + if (!strAboutMenu.IsEmpty()) + { + pSysMenu->AppendMenu(MF_SEPARATOR); + pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); + } + } + + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + // TODO: Add extra initialization here + + return TRUE; // return TRUE unless you set the focus to a control +} + +void CGsaComClientDlg::OnSysCommand(UINT nID, LPARAM lParam) +{ + if ((nID & 0xFFF0) == IDM_ABOUTBOX) + { + CAboutDlg dlgAbout; + dlgAbout.DoModal(); + } + else + { + CDialog::OnSysCommand(nID, lParam); + } +} + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CGsaComClientDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialog::OnPaint(); + } +} + +// The system calls this function to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR CGsaComClientDlg::OnQueryDragIcon() +{ + return static_cast(m_hIcon); +} + +void CGsaComClientDlg::OnBnClickedButtonFileopen() +{ + CFileDialog dialog(TRUE); + dialog.m_ofn.lpstrFilter = _T("*.gwb"); + dialog.DoModal(); + m_filename = dialog.GetPathName(); + if (m_filename.IsEmpty()) + { + return; + } + + m_analysed_filename = m_filename; + m_analysed_filename.Delete(m_filename.Find(_T(".gwb")), 4); + m_analysed_filename_report = m_analysed_filename; + m_analysed_filename += "_analysed.gwb"; + m_analysed_filename_report = m_analysed_filename_report + _T("_analysed.txt"); + UpdateData(FALSE); +} diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClientDlg.h b/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClientDlg.h index 9667190..31e45ad 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClientDlg.h +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/GsaComClientDlg.h @@ -1,41 +1,41 @@ -// GsaComClientDlg.h : header file -// - -#pragma once -#include "afxwin.h" - -// CGsaComClientDlg dialog -class CGsaComClientDlg : public CDialog -{ - // Construction - public: - CGsaComClientDlg(CWnd* pParent = NULL); // standard constructor - - // Dialog Data - enum - { - IDD = IDD_GSACOMCLIENT_DIALOG - }; - - //CString m_filename; - //CString m_analysed_filename; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - // Implementation - protected: - HICON m_hIcon; - - // Generated message map functions - virtual BOOL OnInitDialog(); - afx_msg void OnSysCommand(UINT nID, LPARAM lParam); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - DECLARE_MESSAGE_MAP() - public: - afx_msg void OnBnClickedButtonFileopen(); - CString m_filename; - CString m_analysed_filename; - CString m_analysed_filename_report; -}; +// GsaComClientDlg.h : header file +// + +#pragma once +#include "afxwin.h" + +// CGsaComClientDlg dialog +class CGsaComClientDlg : public CDialog +{ + // Construction + public: + CGsaComClientDlg(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + enum + { + IDD = IDD_GSACOMCLIENT_DIALOG + }; + + //CString m_filename; + //CString m_analysed_filename; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + // Implementation + protected: + HICON m_hIcon; + + // Generated message map functions + virtual BOOL OnInitDialog(); + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + DECLARE_MESSAGE_MAP() + public: + afx_msg void OnBnClickedButtonFileopen(); + CString m_filename; + CString m_analysed_filename; + CString m_analysed_filename_report; +}; diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/ReadMe.txt b/GSA/COM API/C++/Comclient_Output_Extract_Arr/ReadMe.txt index ec5d1f4..849c7e6 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/ReadMe.txt +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/ReadMe.txt @@ -1,79 +1,79 @@ -================================================================================ - MICROSOFT FOUNDATION CLASS LIBRARY : GsaComClient Project Overview -=============================================================================== - -The application wizard has created this GsaComClient application for -you. This application not only demonstrates the basics of using the Microsoft -Foundation Classes but is also a starting point for writing your application. - -This file contains a summary of what you will find in each of the files that -make up your GsaComClient application. - -GsaComClient.vcproj - This is the main project file for VC++ projects generated using an application wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - application wizard. - -GsaComClient.h - This is the main header file for the application. It includes other - project specific headers (including Resource.h) and declares the - CGsaComClientApp application class. - -GsaComClient.cpp - This is the main application source file that contains the application - class CGsaComClientApp. - -GsaComClient.rc - This is a listing of all of the Microsoft Windows resources that the - program uses. It includes the icons, bitmaps, and cursors that are stored - in the RES subdirectory. This file can be directly edited in Microsoft - Visual C++. Your project resources are in 1033. - -res\GsaComClient.ico - This is an icon file, which is used as the application's icon. This - icon is included by the main resource file GsaComClient.rc. - -res\GsaComClient.rc2 - This file contains resources that are not edited by Microsoft - Visual C++. You should place all resources not editable by - the resource editor in this file. - - -///////////////////////////////////////////////////////////////////////////// - -The application wizard creates one dialog class: - -GsaComClientDlg.h, GsaComClientDlg.cpp - the dialog - These files contain your CGsaComClientDlg class. This class defines - the behavior of your application's main dialog. The dialog's template is - in GsaComClient.rc, which can be edited in Microsoft Visual C++. - - -///////////////////////////////////////////////////////////////////////////// - -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named GsaComClient.pch and a precompiled types file named StdAfx.obj. - -Resource.h - This is the standard header file, which defines new resource IDs. - Microsoft Visual C++ reads and updates this file. - -///////////////////////////////////////////////////////////////////////////// - -Other notes: - -The application wizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - -If your application uses MFC in a shared DLL, you will need -to redistribute the MFC DLLs. If your application is in a language -other than the operating system's locale, you will also have to -redistribute the corresponding localized resources MFC80XXX.DLL. -For more information on both of these topics, please see the section on -redistributing Visual C++ applications in MSDN documentation. - -///////////////////////////////////////////////////////////////////////////// +================================================================================ + MICROSOFT FOUNDATION CLASS LIBRARY : GsaComClient Project Overview +=============================================================================== + +The application wizard has created this GsaComClient application for +you. This application not only demonstrates the basics of using the Microsoft +Foundation Classes but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your GsaComClient application. + +GsaComClient.vcproj + This is the main project file for VC++ projects generated using an application wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + application wizard. + +GsaComClient.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CGsaComClientApp application class. + +GsaComClient.cpp + This is the main application source file that contains the application + class CGsaComClientApp. + +GsaComClient.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. Your project resources are in 1033. + +res\GsaComClient.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file GsaComClient.rc. + +res\GsaComClient.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. + + +///////////////////////////////////////////////////////////////////////////// + +The application wizard creates one dialog class: + +GsaComClientDlg.h, GsaComClientDlg.cpp - the dialog + These files contain your CGsaComClientDlg class. This class defines + the behavior of your application's main dialog. The dialog's template is + in GsaComClient.rc, which can be edited in Microsoft Visual C++. + + +///////////////////////////////////////////////////////////////////////////// + +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named GsaComClient.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// + +Other notes: + +The application wizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, you will need +to redistribute the MFC DLLs. If your application is in a language +other than the operating system's locale, you will also have to +redistribute the corresponding localized resources MFC80XXX.DLL. +For more information on both of these topics, please see the section on +redistributing Visual C++ applications in MSDN documentation. + +///////////////////////////////////////////////////////////////////////////// diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/res/GsaComClient.rc2 b/GSA/COM API/C++/Comclient_Output_Extract_Arr/res/GsaComClient.rc2 index 20a0d6a..1f459c5 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/res/GsaComClient.rc2 +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/res/GsaComClient.rc2 @@ -1,13 +1,13 @@ -// -// GsaComClient.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// +// +// GsaComClient.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/resource.h b/GSA/COM API/C++/Comclient_Output_Extract_Arr/resource.h index 8e83335..dc29785 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/resource.h +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/resource.h @@ -1,26 +1,26 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by GsaComClient.rc -// -#define IDM_ABOUTBOX 0x0010 -#define IDD_ABOUTBOX 100 -#define IDS_ABOUTBOX 101 -#define IDD_GSACOMCLIENT_DIALOG 102 -#define IDR_MAINFRAME 128 -#define IDC_EDIT_FILENAME 1000 -#define IDC_BUTTON1 1001 -#define IDC_BUTTON_FILEOPEN 1001 -#define IDC_STATIC_ANALYSEDFILENAME 1002 -#define IDC_STATIC_ANALYSEDFILENAME2 1003 -#define IDC_STATIC_ANALYS_REPORT 1003 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1003 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by GsaComClient.rc +// +#define IDM_ABOUTBOX 0x0010 +#define IDD_ABOUTBOX 100 +#define IDS_ABOUTBOX 101 +#define IDD_GSACOMCLIENT_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDC_EDIT_FILENAME 1000 +#define IDC_BUTTON1 1001 +#define IDC_BUTTON_FILEOPEN 1001 +#define IDC_STATIC_ANALYSEDFILENAME 1002 +#define IDC_STATIC_ANALYSEDFILENAME2 1003 +#define IDC_STATIC_ANALYS_REPORT 1003 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1003 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/stdafx.cpp b/GSA/COM API/C++/Comclient_Output_Extract_Arr/stdafx.cpp index b646eae..9ce7107 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/stdafx.cpp +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/stdafx.cpp @@ -1,5 +1,5 @@ -// stdafx.cpp : source file that includes just the standard includes -// GsaComClient.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" +// stdafx.cpp : source file that includes just the standard includes +// GsaComClient.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" diff --git a/GSA/COM API/C++/Comclient_Output_Extract_Arr/stdafx.h b/GSA/COM API/C++/Comclient_Output_Extract_Arr/stdafx.h index c57cc1a..759aaed 100644 --- a/GSA/COM API/C++/Comclient_Output_Extract_Arr/stdafx.h +++ b/GSA/COM API/C++/Comclient_Output_Extract_Arr/stdafx.h @@ -1,46 +1,46 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#pragma once - -#ifndef _SECURE_ATL -#define _SECURE_ATL 1 -#endif - -#ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers -#endif - -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit - -// turns off MFC's hiding of some common and often safely ignored warning messages -#define _AFX_ALL_WARNINGS - -#include // MFC extensions -#include // MFC core and standard components - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC support for Internet Explorer 4 Common Controls -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +#ifndef _SECURE_ATL +#define _SECURE_ATL 1 +#endif + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows XP or later. +#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. +#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. +#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#endif + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include // MFC extensions +#include // MFC core and standard components + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC support for Internet Explorer 4 Common Controls +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT diff --git a/GSA/COM API/C++/GsaComClient.sln b/GSA/COM API/C++/GsaComClient.sln index ef66a1b..ebed1ec 100644 --- a/GSA/COM API/C++/GsaComClient.sln +++ b/GSA/COM API/C++/GsaComClient.sln @@ -1,31 +1,31 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.6.33723.286 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Comclient_Output_Extract_Arr", "Comclient_Output_Extract_Arr\Comclient_Output_Extract_Arr.vcxproj", "{0A9F0CF1-896D-4F36-BB43-6E83FA444B2F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ComClient_Output_Extract", "ComClient_Output_Extract\ComClient_Output_Extract.vcxproj", "{A97124FE-5C30-4CE9-ACB5-2FEBC850E444}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0A9F0CF1-896D-4F36-BB43-6E83FA444B2F}.Debug|x64.ActiveCfg = Debug|x64 - {0A9F0CF1-896D-4F36-BB43-6E83FA444B2F}.Debug|x64.Build.0 = Debug|x64 - {0A9F0CF1-896D-4F36-BB43-6E83FA444B2F}.Release|x64.ActiveCfg = Release|x64 - {0A9F0CF1-896D-4F36-BB43-6E83FA444B2F}.Release|x64.Build.0 = Release|x64 - {A97124FE-5C30-4CE9-ACB5-2FEBC850E444}.Debug|x64.ActiveCfg = Debug|x64 - {A97124FE-5C30-4CE9-ACB5-2FEBC850E444}.Debug|x64.Build.0 = Debug|x64 - {A97124FE-5C30-4CE9-ACB5-2FEBC850E444}.Release|x64.ActiveCfg = Release|x64 - {A97124FE-5C30-4CE9-ACB5-2FEBC850E444}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {C472D601-1553-4AFD-AE50-74E9A40ABAC3} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33723.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Comclient_Output_Extract_Arr", "Comclient_Output_Extract_Arr\Comclient_Output_Extract_Arr.vcxproj", "{0A9F0CF1-896D-4F36-BB43-6E83FA444B2F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ComClient_Output_Extract", "ComClient_Output_Extract\ComClient_Output_Extract.vcxproj", "{A97124FE-5C30-4CE9-ACB5-2FEBC850E444}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0A9F0CF1-896D-4F36-BB43-6E83FA444B2F}.Debug|x64.ActiveCfg = Debug|x64 + {0A9F0CF1-896D-4F36-BB43-6E83FA444B2F}.Debug|x64.Build.0 = Debug|x64 + {0A9F0CF1-896D-4F36-BB43-6E83FA444B2F}.Release|x64.ActiveCfg = Release|x64 + {0A9F0CF1-896D-4F36-BB43-6E83FA444B2F}.Release|x64.Build.0 = Release|x64 + {A97124FE-5C30-4CE9-ACB5-2FEBC850E444}.Debug|x64.ActiveCfg = Debug|x64 + {A97124FE-5C30-4CE9-ACB5-2FEBC850E444}.Debug|x64.Build.0 = Debug|x64 + {A97124FE-5C30-4CE9-ACB5-2FEBC850E444}.Release|x64.ActiveCfg = Release|x64 + {A97124FE-5C30-4CE9-ACB5-2FEBC850E444}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C472D601-1553-4AFD-AE50-74E9A40ABAC3} + EndGlobalSection +EndGlobal diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/App.config b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/App.config index fad249e..6a845b9 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/App.config +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/App.config @@ -1,6 +1,6 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/CoreFunctions.sln b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/CoreFunctions.sln index 99e2210..3ee4e6b 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/CoreFunctions.sln +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/CoreFunctions.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CoreFunctions", "CoreFunctions.vbproj", "{14FBDE21-0DCE-436D-A4A3-0BC2D235EB54}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {14FBDE21-0DCE-436D-A4A3-0BC2D235EB54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {14FBDE21-0DCE-436D-A4A3-0BC2D235EB54}.Debug|Any CPU.Build.0 = Debug|Any CPU - {14FBDE21-0DCE-436D-A4A3-0BC2D235EB54}.Release|Any CPU.ActiveCfg = Release|Any CPU - {14FBDE21-0DCE-436D-A4A3-0BC2D235EB54}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CoreFunctions", "CoreFunctions.vbproj", "{14FBDE21-0DCE-436D-A4A3-0BC2D235EB54}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {14FBDE21-0DCE-436D-A4A3-0BC2D235EB54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {14FBDE21-0DCE-436D-A4A3-0BC2D235EB54}.Debug|Any CPU.Build.0 = Debug|Any CPU + {14FBDE21-0DCE-436D-A4A3-0BC2D235EB54}.Release|Any CPU.ActiveCfg = Release|Any CPU + {14FBDE21-0DCE-436D-A4A3-0BC2D235EB54}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/CoreFunctions.vbproj b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/CoreFunctions.vbproj index 2ceaabe..905c820 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/CoreFunctions.vbproj +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/CoreFunctions.vbproj @@ -1,118 +1,118 @@ - - - - - Debug - AnyCPU - {14FBDE21-0DCE-436D-A4A3-0BC2D235EB54} - Exe - CoreFunctions.Module1 - CoreFunctions - CoreFunctions - 512 - Console - v4.6.1 - - - AnyCPU - true - full - true - true - bin\Debug\ - CoreFunctions.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - AnyCPU - pdbonly - false - true - true - bin\Release\ - CoreFunctions.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - On - - - Binary - - - Off - - - On - - - - C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + {14FBDE21-0DCE-436D-A4A3-0BC2D235EB54} + Exe + CoreFunctions.Module1 + CoreFunctions + CoreFunctions + 512 + Console + v4.6.1 + + + AnyCPU + true + full + true + true + bin\Debug\ + CoreFunctions.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + CoreFunctions.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/Module1.vb b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/Module1.vb index aba90bc..44fdf8d 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/Module1.vb +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/Module1.vb @@ -1,13 +1,13 @@ -Imports Interop - -Module Module1 - - Sub Main() - - ' add code here - - End Sub - -End Module - - +Imports Interop + +Module Module1 + + Sub Main() + + ' add code here + + End Sub + +End Module + + diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Application.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Application.Designer.vb index 126d785..a8790f4 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Application.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Application.Designer.vb @@ -1,13 +1,13 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Application.myapp b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Application.myapp index 23b627f..e62f1a5 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Application.myapp +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Application.myapp @@ -1,10 +1,10 @@ - - - false - false - 0 - true - 0 - 2 - true - + + + false + false + 0 + true + 0 + 2 + true + diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/AssemblyInfo.vb b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/AssemblyInfo.vb index a0991ee..1687b11 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/AssemblyInfo.vb +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/AssemblyInfo.vb @@ -1,35 +1,35 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' 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. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Resources.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Resources.Designer.vb index 33d2943..de24fe2 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Resources.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Resources.Designer.vb @@ -1,63 +1,63 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - -Imports System - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("CoreFunctions.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set - resourceCulture = value - End Set - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("CoreFunctions.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Resources.resx b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Resources.resx index ffecec8..71f7165 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Resources.resx +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Settings.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Settings.Designer.vb index 6f07401..82fb344 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Settings.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Settings.Designer.vb @@ -1,73 +1,73 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()), MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.CoreFunctions.My.MySettings - Get - Return Global.CoreFunctions.My.MySettings.Default - End Get - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.CoreFunctions.My.MySettings + Get + Return Global.CoreFunctions.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Settings.settings b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Settings.settings index 377f56d..85b890b 100644 --- a/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Settings.settings +++ b/GSA/COM API/Training materials/Hands-on and models/CoreFunctions/My Project/Settings.settings @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/App.config b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/App.config index fad249e..6a845b9 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/App.config +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/App.config @@ -1,6 +1,6 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/ExcelIO.sln b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/ExcelIO.sln index 16c0b1f..40c7655 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/ExcelIO.sln +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/ExcelIO.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ExcelIO", "ExcelIO.vbproj", "{358CE860-8420-42FD-8CE0-C0E858DA2C86}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {358CE860-8420-42FD-8CE0-C0E858DA2C86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {358CE860-8420-42FD-8CE0-C0E858DA2C86}.Debug|Any CPU.Build.0 = Debug|Any CPU - {358CE860-8420-42FD-8CE0-C0E858DA2C86}.Release|Any CPU.ActiveCfg = Release|Any CPU - {358CE860-8420-42FD-8CE0-C0E858DA2C86}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ExcelIO", "ExcelIO.vbproj", "{358CE860-8420-42FD-8CE0-C0E858DA2C86}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {358CE860-8420-42FD-8CE0-C0E858DA2C86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {358CE860-8420-42FD-8CE0-C0E858DA2C86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {358CE860-8420-42FD-8CE0-C0E858DA2C86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {358CE860-8420-42FD-8CE0-C0E858DA2C86}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/ExcelIO.vbproj b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/ExcelIO.vbproj index c2c025e..038f61d 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/ExcelIO.vbproj +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/ExcelIO.vbproj @@ -1,145 +1,145 @@ - - - - - Debug - AnyCPU - {358CE860-8420-42FD-8CE0-C0E858DA2C86} - Exe - ExcelIO.Module1 - ExcelIO - ExcelIO - 512 - Console - v4.5 - - - AnyCPU - true - full - true - true - bin\Debug\ - ExcelIO.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - AnyCPU - pdbonly - false - true - true - bin\Release\ - ExcelIO.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - On - - - Binary - - - Off - - - On - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - - - {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52} - 2 - 7 - 0 - primary - False - True - - - {00020813-0000-0000-C000-000000000046} - 1 - 8 - 0 - primary - False - True - - - {0002E157-0000-0000-C000-000000000046} - 5 - 3 - 0 - primary - False - True - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + {358CE860-8420-42FD-8CE0-C0E858DA2C86} + Exe + ExcelIO.Module1 + ExcelIO + ExcelIO + 512 + Console + v4.5 + + + AnyCPU + true + full + true + true + bin\Debug\ + ExcelIO.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + ExcelIO.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52} + 2 + 7 + 0 + primary + False + True + + + {00020813-0000-0000-C000-000000000046} + 1 + 8 + 0 + primary + False + True + + + {0002E157-0000-0000-C000-000000000046} + 5 + 3 + 0 + primary + False + True + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/Module1.vb b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/Module1.vb index a6aec2f..450902b 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/Module1.vb +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/Module1.vb @@ -1,69 +1,69 @@ - -Imports System.Math - -Module Module1 - - Sub Main() - - ' add code here - - End Sub - - Function IsPrime(ByVal n As Integer) As Boolean - Console.WriteLine("Number to be tested = {0}", n) - ' square root of the number to be tested for primality - Dim root As Integer = Math.Sqrt(n) - - ' create an array to store known primes - Dim primes As New System.Collections.ArrayList - primes.Add(2) - primes.Add(3) - Dim remainder As Integer = 0 - Dim nIsPrime = True - - ' trivial case -- eliminate if multiple of 2 or 3 - For Each j In primes - DivRem(n, j, remainder) - If Math.Equals(remainder, 0) Then - nIsPrime = False - Console.WriteLine("Factor found for {0} : {1}", n, j) - Return False - End If - Next - - For i As Integer = 4 To root ' it's enough to run a loop till the square root of n - Dim iIsComposite As Boolean = False - - For Each j In primes - ' check if i is a multiple of primes we already know about - Math.DivRem(i, j, remainder) - If Math.Equals(remainder, 0) Then - iIsComposite = True - Exit For - End If - Next - - If iIsComposite Then - Continue For ' move to next i, we only need to do the division test with primes - Else - primes.Add(i) ' OK, i is prime, we want to see if n is a factor of i - End If - - ' is n a factor of i? - Math.DivRem(n, i, remainder) - If Math.Equals(remainder, 0) Then - nIsPrime = False - Console.WriteLine("Factor found for {0} : {1}", n, i) - Exit For - End If - Next - If nIsPrime Then ' we have tried dividing by all primes from 2 to sqrt(n), since none of them factor n, n is prime! - Console.WriteLine("{0} is prime!", n) - End If - - Return nIsPrime - - End Function - - -End Module + +Imports System.Math + +Module Module1 + + Sub Main() + + ' add code here + + End Sub + + Function IsPrime(ByVal n As Integer) As Boolean + Console.WriteLine("Number to be tested = {0}", n) + ' square root of the number to be tested for primality + Dim root As Integer = Math.Sqrt(n) + + ' create an array to store known primes + Dim primes As New System.Collections.ArrayList + primes.Add(2) + primes.Add(3) + Dim remainder As Integer = 0 + Dim nIsPrime = True + + ' trivial case -- eliminate if multiple of 2 or 3 + For Each j In primes + DivRem(n, j, remainder) + If Math.Equals(remainder, 0) Then + nIsPrime = False + Console.WriteLine("Factor found for {0} : {1}", n, j) + Return False + End If + Next + + For i As Integer = 4 To root ' it's enough to run a loop till the square root of n + Dim iIsComposite As Boolean = False + + For Each j In primes + ' check if i is a multiple of primes we already know about + Math.DivRem(i, j, remainder) + If Math.Equals(remainder, 0) Then + iIsComposite = True + Exit For + End If + Next + + If iIsComposite Then + Continue For ' move to next i, we only need to do the division test with primes + Else + primes.Add(i) ' OK, i is prime, we want to see if n is a factor of i + End If + + ' is n a factor of i? + Math.DivRem(n, i, remainder) + If Math.Equals(remainder, 0) Then + nIsPrime = False + Console.WriteLine("Factor found for {0} : {1}", n, i) + Exit For + End If + Next + If nIsPrime Then ' we have tried dividing by all primes from 2 to sqrt(n), since none of them factor n, n is prime! + Console.WriteLine("{0} is prime!", n) + End If + + Return nIsPrime + + End Function + + +End Module diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Application.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Application.Designer.vb index 126d785..a8790f4 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Application.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Application.Designer.vb @@ -1,13 +1,13 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Application.myapp b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Application.myapp index 23b627f..e62f1a5 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Application.myapp +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Application.myapp @@ -1,10 +1,10 @@ - - - false - false - 0 - true - 0 - 2 - true - + + + false + false + 0 + true + 0 + 2 + true + diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/AssemblyInfo.vb b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/AssemblyInfo.vb index cde0855..8a6d2ce 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/AssemblyInfo.vb +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/AssemblyInfo.vb @@ -1,35 +1,35 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' 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. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Resources.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Resources.Designer.vb index 8668985..16a45f4 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Resources.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Resources.Designer.vb @@ -1,62 +1,62 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ExcelIO.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set(ByVal value As Global.System.Globalization.CultureInfo) - resourceCulture = value - End Set - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ExcelIO.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Resources.resx b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Resources.resx index ffecec8..71f7165 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Resources.resx +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Settings.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Settings.Designer.vb index 6fd6b48..60428d9 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Settings.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Settings.Designer.vb @@ -1,73 +1,73 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.ExcelIO.My.MySettings - Get - Return Global.ExcelIO.My.MySettings.Default - End Get - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.ExcelIO.My.MySettings + Get + Return Global.ExcelIO.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Settings.settings b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Settings.settings index 377f56d..85b890b 100644 --- a/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Settings.settings +++ b/GSA/COM API/Training materials/Hands-on and models/ExcelIO/My Project/Settings.settings @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/App.config b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/App.config index fad249e..6a845b9 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/App.config +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/App.config @@ -1,6 +1,6 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/GwaCommand.sln b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/GwaCommand.sln index 676e1c2..8416545 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/GwaCommand.sln +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/GwaCommand.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GwaCommand", "GwaCommand.vbproj", "{D765B63D-FDC0-42FF-809D-5932EAEFE059}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GwaCommand", "GwaCommand.vbproj", "{D765B63D-FDC0-42FF-809D-5932EAEFE059}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/GwaCommand.vbproj b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/GwaCommand.vbproj index cf70be5..8d9388b 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/GwaCommand.vbproj +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/GwaCommand.vbproj @@ -1,118 +1,118 @@ - - - - - Debug - AnyCPU - {D765B63D-FDC0-42FF-809D-5932EAEFE059} - Exe - GwaCommand.Module1 - GwaCommand - GwaCommand - 512 - Console - v4.5 - - - AnyCPU - true - full - true - true - bin\Debug\ - GwaCommand.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - AnyCPU - pdbonly - false - true - true - bin\Release\ - GwaCommand.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - On - - - Binary - - - Off - - - On - - - - ..\..\..\..\..\..\..\..\Program Files\Oasys\GSA 8.7\Interop.Gsa_8_7.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + {D765B63D-FDC0-42FF-809D-5932EAEFE059} + Exe + GwaCommand.Module1 + GwaCommand + GwaCommand + 512 + Console + v4.5 + + + AnyCPU + true + full + true + true + bin\Debug\ + GwaCommand.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + GwaCommand.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + ..\..\..\..\..\..\..\..\Program Files\Oasys\GSA 8.7\Interop.Gsa_8_7.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/Module1.vb b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/Module1.vb index ec130af..89d2b96 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/Module1.vb +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/Module1.vb @@ -1,35 +1,35 @@ -Imports Interop.gsa_8_7 - -Module Module1 - - Sub Main() - Dim gsa As New Interop.gsa_8_7.ComAuto - - gsa.NewFile() - - Dim tol As Double = 0.000001 - - ' generate nodes here - Dim n1 As Integer = gsa.Gen_NodeAt(0, 0, 0, tol) - Dim n2 As Integer = gsa.Gen_NodeAt(0, 0, 5, tol) - Dim n3 As Integer = gsa.Gen_NodeAt(0, 5, 5, tol) - Dim n4 As Integer = gsa.Gen_NodeAt(0, 5, 0, tol) - - ' generate elements between them - ' EL,1,,NO_RGB,BEAM,1,1,1,2 - ' EL.2 | num | name | colour | type | prop | group | topo() | orient_node | orient_angle | - ' is_rls { | rls { | k } } is_offset { | ox | oy | oz } | dummy - - Dim ret As Integer ' to store the return code - Dim gwaRecord As String ' to construct the GWA string - Dim elRef As Integer ' to store element number - - - gsa.SaveAs("c:\GSA_training\portalframe01.gwb") - gsa.Close() - gsa = Nothing - - End Sub - -End Module - +Imports Interop.gsa_8_7 + +Module Module1 + + Sub Main() + Dim gsa As New Interop.gsa_8_7.ComAuto + + gsa.NewFile() + + Dim tol As Double = 0.000001 + + ' generate nodes here + Dim n1 As Integer = gsa.Gen_NodeAt(0, 0, 0, tol) + Dim n2 As Integer = gsa.Gen_NodeAt(0, 0, 5, tol) + Dim n3 As Integer = gsa.Gen_NodeAt(0, 5, 5, tol) + Dim n4 As Integer = gsa.Gen_NodeAt(0, 5, 0, tol) + + ' generate elements between them + ' EL,1,,NO_RGB,BEAM,1,1,1,2 + ' EL.2 | num | name | colour | type | prop | group | topo() | orient_node | orient_angle | + ' is_rls { | rls { | k } } is_offset { | ox | oy | oz } | dummy + + Dim ret As Integer ' to store the return code + Dim gwaRecord As String ' to construct the GWA string + Dim elRef As Integer ' to store element number + + + gsa.SaveAs("c:\GSA_training\portalframe01.gwb") + gsa.Close() + gsa = Nothing + + End Sub + +End Module + diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Application.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Application.Designer.vb index 126d785..a8790f4 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Application.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Application.Designer.vb @@ -1,13 +1,13 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Application.myapp b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Application.myapp index 23b627f..e62f1a5 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Application.myapp +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Application.myapp @@ -1,10 +1,10 @@ - - - false - false - 0 - true - 0 - 2 - true - + + + false + false + 0 + true + 0 + 2 + true + diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/AssemblyInfo.vb b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/AssemblyInfo.vb index 255c95f..564bcea 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/AssemblyInfo.vb +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/AssemblyInfo.vb @@ -1,35 +1,35 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' 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. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Resources.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Resources.Designer.vb index 67bb877..f5e3772 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Resources.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Resources.Designer.vb @@ -1,62 +1,62 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("GwaCommand.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set(ByVal value As Global.System.Globalization.CultureInfo) - resourceCulture = value - End Set - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("GwaCommand.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Resources.resx b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Resources.resx index ffecec8..71f7165 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Resources.resx +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Settings.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Settings.Designer.vb index 463ae13..0de3508 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Settings.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Settings.Designer.vb @@ -1,73 +1,73 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.GwaCommand.My.MySettings - Get - Return Global.GwaCommand.My.MySettings.Default - End Get - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.GwaCommand.My.MySettings + Get + Return Global.GwaCommand.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Settings.settings b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Settings.settings index 377f56d..85b890b 100644 --- a/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Settings.settings +++ b/GSA/COM API/Training materials/Hands-on and models/GwaCommand/My Project/Settings.settings @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/App.config b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/App.config index fad249e..6a845b9 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/App.config +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/App.config @@ -1,6 +1,6 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/ListsAndCases.sln b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/ListsAndCases.sln index 9b028f2..b85047f 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/ListsAndCases.sln +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/ListsAndCases.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ListsAndCases", "ListsAndCases.vbproj", "{D765B63D-FDC0-42FF-809D-5932EAEFE059}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ListsAndCases", "ListsAndCases.vbproj", "{D765B63D-FDC0-42FF-809D-5932EAEFE059}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D765B63D-FDC0-42FF-809D-5932EAEFE059}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/ListsAndCases.vbproj b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/ListsAndCases.vbproj index cf70be5..8d9388b 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/ListsAndCases.vbproj +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/ListsAndCases.vbproj @@ -1,118 +1,118 @@ - - - - - Debug - AnyCPU - {D765B63D-FDC0-42FF-809D-5932EAEFE059} - Exe - GwaCommand.Module1 - GwaCommand - GwaCommand - 512 - Console - v4.5 - - - AnyCPU - true - full - true - true - bin\Debug\ - GwaCommand.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - AnyCPU - pdbonly - false - true - true - bin\Release\ - GwaCommand.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - On - - - Binary - - - Off - - - On - - - - ..\..\..\..\..\..\..\..\Program Files\Oasys\GSA 8.7\Interop.Gsa_8_7.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + {D765B63D-FDC0-42FF-809D-5932EAEFE059} + Exe + GwaCommand.Module1 + GwaCommand + GwaCommand + 512 + Console + v4.5 + + + AnyCPU + true + full + true + true + bin\Debug\ + GwaCommand.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + GwaCommand.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + ..\..\..\..\..\..\..\..\Program Files\Oasys\GSA 8.7\Interop.Gsa_8_7.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/Module1.vb b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/Module1.vb index cf9c12e..5ce4563 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/Module1.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/Module1.vb @@ -1,36 +1,36 @@ -Imports Interop.gsa_8_7 -Imports System.Diagnostics - -Module Module1 - - Sub Main() - Dim gsa As New Interop.gsa_8_7.ComAuto - - ' open existing file - gsa.Open("c:\GSA_training\portalframe02.gwb") - - Dim ret As Integer - - Dim ents() As Integer ' array to store node numbers in the list - - 'add code here - - ' loop over the contents of the list - For Each ent In ents - ' fetch node as a GWA string - Dim gwa As String = gsa.GwaCommand("GET, NODE," & ent) - ' write it to the console - Console.WriteLine(gwa) - ' Fix all nodes - gwa += ",NO_GRID,0,REST,1,1,1,1,1,1" - ' store back into GSA - gsa.GwaCommand(gwa) - Next - - gsa.SaveAs("c:\GSA_training\portalframe03.gwb") - gsa.Close() - gsa = Nothing - - End Sub - -End Module +Imports Interop.gsa_8_7 +Imports System.Diagnostics + +Module Module1 + + Sub Main() + Dim gsa As New Interop.gsa_8_7.ComAuto + + ' open existing file + gsa.Open("c:\GSA_training\portalframe02.gwb") + + Dim ret As Integer + + Dim ents() As Integer ' array to store node numbers in the list + + 'add code here + + ' loop over the contents of the list + For Each ent In ents + ' fetch node as a GWA string + Dim gwa As String = gsa.GwaCommand("GET, NODE," & ent) + ' write it to the console + Console.WriteLine(gwa) + ' Fix all nodes + gwa += ",NO_GRID,0,REST,1,1,1,1,1,1" + ' store back into GSA + gsa.GwaCommand(gwa) + Next + + gsa.SaveAs("c:\GSA_training\portalframe03.gwb") + gsa.Close() + gsa = Nothing + + End Sub + +End Module diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Application.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Application.Designer.vb index 126d785..a8790f4 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Application.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Application.Designer.vb @@ -1,13 +1,13 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Application.myapp b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Application.myapp index 23b627f..e62f1a5 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Application.myapp +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Application.myapp @@ -1,10 +1,10 @@ - - - false - false - 0 - true - 0 - 2 - true - + + + false + false + 0 + true + 0 + 2 + true + diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/AssemblyInfo.vb b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/AssemblyInfo.vb index 255c95f..564bcea 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/AssemblyInfo.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/AssemblyInfo.vb @@ -1,35 +1,35 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' 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. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Resources.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Resources.Designer.vb index 67bb877..f5e3772 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Resources.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Resources.Designer.vb @@ -1,62 +1,62 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("GwaCommand.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set(ByVal value As Global.System.Globalization.CultureInfo) - resourceCulture = value - End Set - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("GwaCommand.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Resources.resx b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Resources.resx index ffecec8..71f7165 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Resources.resx +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Settings.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Settings.Designer.vb index 463ae13..0de3508 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Settings.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Settings.Designer.vb @@ -1,73 +1,73 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.GwaCommand.My.MySettings - Get - Return Global.GwaCommand.My.MySettings.Default - End Get - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.GwaCommand.My.MySettings + Get + Return Global.GwaCommand.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Settings.settings b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Settings.settings index 377f56d..85b890b 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Settings.settings +++ b/GSA/COM API/Training materials/Hands-on and models/Lists and Cases/My Project/Settings.settings @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/App.config b/GSA/COM API/Training materials/Hands-on and models/Results Arr/App.config index fad249e..6a845b9 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/App.config +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/App.config @@ -1,6 +1,6 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/Module1.vb b/GSA/COM API/Training materials/Hands-on and models/Results Arr/Module1.vb index 0790f02..1dea085 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/Module1.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/Module1.vb @@ -1,76 +1,76 @@ -Imports Interop.gsa_10_2 -Imports System.Diagnostics - -Module Module1 - - Sub Main() - Dim gsa As New Interop.gsa_10_2.ComAuto - - ' open existing file - gsa.Open("c:\GSA_Training\portalfram04.gwb") - gsa.Analyse() - - Dim ret As Integer - - ' Assume we're interested in windloads (L2) - Dim analysiscase As Integer = 2 - Dim acaseString As String = "A" & analysiscase - - ret = gsa.CaseExist("A", analysiscase) - - If 0 = ret Then - Console.WriteLine("Analysis case {0} does not exist. ", analysiscase) - Exit Sub - End If - - ret = gsa.CaseResultsExist("A", analysiscase, 0) - If 0 = ret Then - Console.WriteLine("No results for case A" & analysiscase) - Exit Sub - End If - - Dim OP_INIT_INFINITY As Integer = &H40 - Dim OP_IS_PER_REC As Integer = &H2 - - ret = gsa.Output_Init_Arr(OP_INIT_INFINITY, "global", acaseString, ResHeader.REF_REAC, 3) - - If Not Integer.Equals(0, ret) Then - Console.WriteLine("Output_Init_Arr failed.") - Exit Sub - End If - - Dim ents() As Integer ' array to store node numbers in the list - - ret = gsa.EntitiesInList("XY1", GsaEntity.NODE, ents) - - ' loop over the contents of the list - For Each ent In ents - ret = gsa.Output_DataExist(ent) - If 0 = ret Then - Console.WriteLine("Output_DataExist failed for " & ent) - Exit For - End If - - Dim results() As GsaResults = Nothing - - ret = gsa.Output_Extract_Arr(ent, results, 0) - - If results.Length <> 1 Then - Console.WriteLine("More than 1 results components returned.") ' we dont expect this to happen in the case of nodes - Exit For - End If - - Dim index As Integer - For index = 0 To results(0).dynaResults.Length - 1 - Console.WriteLine("Result for node/elem " & ent & " in direction " & index & " = " & results(0).dynaResults(index)) - Next - - Next - - gsa.SaveAs("c:\GSA_training\portalframe05.gwb") - gsa.Close() - gsa = Nothing - - End Sub - -End Module +Imports Interop.gsa_10_2 +Imports System.Diagnostics + +Module Module1 + + Sub Main() + Dim gsa As New Interop.gsa_10_2.ComAuto + + ' open existing file + gsa.Open("c:\GSA_Training\portalfram04.gwb") + gsa.Analyse() + + Dim ret As Integer + + ' Assume we're interested in windloads (L2) + Dim analysiscase As Integer = 2 + Dim acaseString As String = "A" & analysiscase + + ret = gsa.CaseExist("A", analysiscase) + + If 0 = ret Then + Console.WriteLine("Analysis case {0} does not exist. ", analysiscase) + Exit Sub + End If + + ret = gsa.CaseResultsExist("A", analysiscase, 0) + If 0 = ret Then + Console.WriteLine("No results for case A" & analysiscase) + Exit Sub + End If + + Dim OP_INIT_INFINITY As Integer = &H40 + Dim OP_IS_PER_REC As Integer = &H2 + + ret = gsa.Output_Init_Arr(OP_INIT_INFINITY, "global", acaseString, ResHeader.REF_REAC, 3) + + If Not Integer.Equals(0, ret) Then + Console.WriteLine("Output_Init_Arr failed.") + Exit Sub + End If + + Dim ents() As Integer ' array to store node numbers in the list + + ret = gsa.EntitiesInList("XY1", GsaEntity.NODE, ents) + + ' loop over the contents of the list + For Each ent In ents + ret = gsa.Output_DataExist(ent) + If 0 = ret Then + Console.WriteLine("Output_DataExist failed for " & ent) + Exit For + End If + + Dim results() As GsaResults = Nothing + + ret = gsa.Output_Extract_Arr(ent, results, 0) + + If results.Length <> 1 Then + Console.WriteLine("More than 1 results components returned.") ' we dont expect this to happen in the case of nodes + Exit For + End If + + Dim index As Integer + For index = 0 To results(0).dynaResults.Length - 1 + Console.WriteLine("Result for node/elem " & ent & " in direction " & index & " = " & results(0).dynaResults(index)) + Next + + Next + + gsa.SaveAs("c:\GSA_training\portalframe05.gwb") + gsa.Close() + gsa = Nothing + + End Sub + +End Module diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Application.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Application.Designer.vb index 126d785..a8790f4 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Application.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Application.Designer.vb @@ -1,13 +1,13 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Application.myapp b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Application.myapp index 23b627f..e62f1a5 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Application.myapp +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Application.myapp @@ -1,10 +1,10 @@ - - - false - false - 0 - true - 0 - 2 - true - + + + false + false + 0 + true + 0 + 2 + true + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/AssemblyInfo.vb b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/AssemblyInfo.vb index 699f7b1..ab9f62d 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/AssemblyInfo.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/AssemblyInfo.vb @@ -1,35 +1,35 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' 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. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Resources.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Resources.Designer.vb index 78bb3d1..67431e6 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Resources.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Resources.Designer.vb @@ -1,62 +1,62 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ResultsArr.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set(ByVal value As Global.System.Globalization.CultureInfo) - resourceCulture = value - End Set - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ResultsArr.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Resources.resx b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Resources.resx index ffecec8..71f7165 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Resources.resx +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Settings.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Settings.Designer.vb index 3e6a4ab..de3bc93 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Settings.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Settings.Designer.vb @@ -1,73 +1,73 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.ResultsArr.My.MySettings - Get - Return Global.ResultsArr.My.MySettings.Default - End Get - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.ResultsArr.My.MySettings + Get + Return Global.ResultsArr.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Settings.settings b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Settings.settings index 377f56d..85b890b 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Settings.settings +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/My Project/Settings.settings @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/ResultsArr.sln b/GSA/COM API/Training materials/Hands-on and models/Results Arr/ResultsArr.sln index b3c05dc..d1318f5 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/ResultsArr.sln +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/ResultsArr.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ResultsArr", "ResultsArr.vbproj", "{5ED55984-4B89-47F8-A536-FDEF0A803547}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5ED55984-4B89-47F8-A536-FDEF0A803547}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5ED55984-4B89-47F8-A536-FDEF0A803547}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5ED55984-4B89-47F8-A536-FDEF0A803547}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5ED55984-4B89-47F8-A536-FDEF0A803547}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ResultsArr", "ResultsArr.vbproj", "{5ED55984-4B89-47F8-A536-FDEF0A803547}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5ED55984-4B89-47F8-A536-FDEF0A803547}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5ED55984-4B89-47F8-A536-FDEF0A803547}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5ED55984-4B89-47F8-A536-FDEF0A803547}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5ED55984-4B89-47F8-A536-FDEF0A803547}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/GSA/COM API/Training materials/Hands-on and models/Results Arr/ResultsArr.vbproj b/GSA/COM API/Training materials/Hands-on and models/Results Arr/ResultsArr.vbproj index ad81695..ab6ff12 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results Arr/ResultsArr.vbproj +++ b/GSA/COM API/Training materials/Hands-on and models/Results Arr/ResultsArr.vbproj @@ -1,118 +1,118 @@ - - - - - Debug - AnyCPU - {5ED55984-4B89-47F8-A536-FDEF0A803547} - Exe - ResultsArr.Module1 - ResultsArr - ResultsArr - 512 - Console - v4.6.1 - - - AnyCPU - true - full - true - true - bin\Debug\ - ResultsArr.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - AnyCPU - pdbonly - false - true - true - bin\Release\ - ResultsArr.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - On - - - Binary - - - Off - - - On - - - - C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + {5ED55984-4B89-47F8-A536-FDEF0A803547} + Exe + ResultsArr.Module1 + ResultsArr + ResultsArr + 512 + Console + v4.6.1 + + + AnyCPU + true + full + true + true + bin\Debug\ + ResultsArr.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + ResultsArr.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/App.config b/GSA/COM API/Training materials/Hands-on and models/Results/App.config index fad249e..6a845b9 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/App.config +++ b/GSA/COM API/Training materials/Hands-on and models/Results/App.config @@ -1,6 +1,6 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/Module1.vb b/GSA/COM API/Training materials/Hands-on and models/Results/Module1.vb index 674f581..2b7cf7e 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/Module1.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Results/Module1.vb @@ -1,46 +1,46 @@ -Imports Interop.gsa_10_2 -Imports System.Diagnostics - -Module Module1 - - Sub Main() - - - Dim gsa As New Interop.gsa_10_2.ComAuto - - ' open existing file - gsa.Open("c:\GSA_training\portalframe04.gwb") - gsa.Analyse() - - Dim ret As Integer - - ' Assume we're interested in windloads (L2) - Dim analysiscase As Integer = 2 - Dim acaseString As String = "A" & analysiscase - - ret = gsa.CaseExist("A", analysiscase) - - If 0 = ret Then - Console.WriteLine("Analysis case {0} does not exist. ", analysiscase) - Exit Sub - End If - - ret = gsa.CaseResultsExist("A", analysiscase, 0) - If 0 = ret Then - Console.WriteLine("No results for case A" & analysiscase) - Exit Sub - End If - - ' Lets look at reactions in X - Dim dataref As Integer = 12004002 - Dim OP_INIT_INFINITY As Integer = &H40 - Dim OP_IS_PER_REC As Integer = &H2 - - - gsa.SaveAs("c:\GSA_training\portalframe05.gwb") - gsa.Close() - gsa = Nothing - - End Sub - -End Module +Imports Interop.gsa_10_2 +Imports System.Diagnostics + +Module Module1 + + Sub Main() + + + Dim gsa As New Interop.gsa_10_2.ComAuto + + ' open existing file + gsa.Open("c:\GSA_training\portalframe04.gwb") + gsa.Analyse() + + Dim ret As Integer + + ' Assume we're interested in windloads (L2) + Dim analysiscase As Integer = 2 + Dim acaseString As String = "A" & analysiscase + + ret = gsa.CaseExist("A", analysiscase) + + If 0 = ret Then + Console.WriteLine("Analysis case {0} does not exist. ", analysiscase) + Exit Sub + End If + + ret = gsa.CaseResultsExist("A", analysiscase, 0) + If 0 = ret Then + Console.WriteLine("No results for case A" & analysiscase) + Exit Sub + End If + + ' Lets look at reactions in X + Dim dataref As Integer = 12004002 + Dim OP_INIT_INFINITY As Integer = &H40 + Dim OP_IS_PER_REC As Integer = &H2 + + + gsa.SaveAs("c:\GSA_training\portalframe05.gwb") + gsa.Close() + gsa = Nothing + + End Sub + +End Module diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Application.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Application.Designer.vb index 126d785..a8790f4 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Application.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Application.Designer.vb @@ -1,13 +1,13 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Application.myapp b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Application.myapp index 23b627f..e62f1a5 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Application.myapp +++ b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Application.myapp @@ -1,10 +1,10 @@ - - - false - false - 0 - true - 0 - 2 - true - + + + false + false + 0 + true + 0 + 2 + true + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/AssemblyInfo.vb b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/AssemblyInfo.vb index 49c329c..4b94d4e 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/AssemblyInfo.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/AssemblyInfo.vb @@ -1,35 +1,35 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' 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. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Resources.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Resources.Designer.vb index cabf5ac..7c7f573 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Resources.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Resources.Designer.vb @@ -1,62 +1,62 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Results.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set(ByVal value As Global.System.Globalization.CultureInfo) - resourceCulture = value - End Set - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Results.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Resources.resx b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Resources.resx index ffecec8..71f7165 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Resources.resx +++ b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Settings.Designer.vb b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Settings.Designer.vb index 044b761..acf77fb 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Settings.Designer.vb +++ b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Settings.Designer.vb @@ -1,73 +1,73 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.34209 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.Results.My.MySettings - Get - Return Global.Results.My.MySettings.Default - End Get - End Property - End Module -End Namespace +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.Results.My.MySettings + Get + Return Global.Results.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Settings.settings b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Settings.settings index 377f56d..85b890b 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Settings.settings +++ b/GSA/COM API/Training materials/Hands-on and models/Results/My Project/Settings.settings @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/Results.sln b/GSA/COM API/Training materials/Hands-on and models/Results/Results.sln index e5d79a5..c34b9f2 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/Results.sln +++ b/GSA/COM API/Training materials/Hands-on and models/Results/Results.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Results", "Results.vbproj", "{87238CDF-37F7-4B06-BAE2-BF0D9C41D85C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {87238CDF-37F7-4B06-BAE2-BF0D9C41D85C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87238CDF-37F7-4B06-BAE2-BF0D9C41D85C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {87238CDF-37F7-4B06-BAE2-BF0D9C41D85C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {87238CDF-37F7-4B06-BAE2-BF0D9C41D85C}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Results", "Results.vbproj", "{87238CDF-37F7-4B06-BAE2-BF0D9C41D85C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {87238CDF-37F7-4B06-BAE2-BF0D9C41D85C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {87238CDF-37F7-4B06-BAE2-BF0D9C41D85C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {87238CDF-37F7-4B06-BAE2-BF0D9C41D85C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {87238CDF-37F7-4B06-BAE2-BF0D9C41D85C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/GSA/COM API/Training materials/Hands-on and models/Results/Results.vbproj b/GSA/COM API/Training materials/Hands-on and models/Results/Results.vbproj index 56580d7..eb03d17 100644 --- a/GSA/COM API/Training materials/Hands-on and models/Results/Results.vbproj +++ b/GSA/COM API/Training materials/Hands-on and models/Results/Results.vbproj @@ -1,118 +1,118 @@ - - - - - Debug - AnyCPU - {87238CDF-37F7-4B06-BAE2-BF0D9C41D85C} - Exe - Results.Module1 - Results - Results - 512 - Console - v4.6.1 - - - AnyCPU - true - full - true - true - bin\Debug\ - Results.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - AnyCPU - pdbonly - false - true - true - bin\Release\ - Results.xml - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 - - - On - - - Binary - - - Off - - - On - - - - C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - True - Application.myapp - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + {87238CDF-37F7-4B06-BAE2-BF0D9C41D85C} + Exe + Results.Module1 + Results + Results + 512 + Console + v4.6.1 + + + AnyCPU + true + full + true + true + bin\Debug\ + Results.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + Results.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + C:\Program Files\Oasys\GSA 10.2\Interop.Gsa_10_2.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + diff --git a/GSA/COM API/Training materials/README.md b/GSA/COM API/Training materials/README.md index 3e4af14..15c0191 100644 --- a/GSA/COM API/Training materials/README.md +++ b/GSA/COM API/Training materials/README.md @@ -1,11 +1,11 @@ -This folder contains the training material for the course 'Working with GSA APIs'. - -The course is a day long, classroom-based training delivered by GSA developers. As such, the material in this folder is designed for a classroom oriented delivery rather than to serve as a standalone tutorial. - -The day is divided into lectures interspersed by hands-on sessions where participants write code under the supervision of the trainer. The lectures are roughly based on the slides in file "Working with GSA APIs - Published.pdf". The slide notes in the slide might give some indication of proceedings, however, not everything that is discussed during the day is contained within the slides. - -The hands-on sessions run as follows. After each topic in the API is introduced via a short lecture, a problem is set out for the participants to code up. Each hands-on is associated with a Visual studio project solution, including the project file and the code (.vb) file. The vb file already contains some boiler-plate code that is necessary to get started - for example, initializing the GSA COM object or opening and closing the model file. The goal of the hands-on is to add just the lines that use the API topic that has just been discussed. - -For the benefit of the audiences that are not in the classroom course, the solution to these hands-on sessions are including in the "cheatsheet.txt" file. - -The final hands-on session is to size a truss for axial forces. This exercise brings together everything that has been covered during the day. +This folder contains the training material for the course 'Working with GSA APIs'. + +The course is a day long, classroom-based training delivered by GSA developers. As such, the material in this folder is designed for a classroom oriented delivery rather than to serve as a standalone tutorial. + +The day is divided into lectures interspersed by hands-on sessions where participants write code under the supervision of the trainer. The lectures are roughly based on the slides in file "Working with GSA APIs - Published.pdf". The slide notes in the slide might give some indication of proceedings, however, not everything that is discussed during the day is contained within the slides. + +The hands-on sessions run as follows. After each topic in the API is introduced via a short lecture, a problem is set out for the participants to code up. Each hands-on is associated with a Visual studio project solution, including the project file and the code (.vb) file. The vb file already contains some boiler-plate code that is necessary to get started - for example, initializing the GSA COM object or opening and closing the model file. The goal of the hands-on is to add just the lines that use the API topic that has just been discussed. + +For the benefit of the audiences that are not in the classroom course, the solution to these hands-on sessions are including in the "cheatsheet.txt" file. + +The final hands-on session is to size a truss for axial forces. This exercise brings together everything that has been covered during the day. diff --git a/GSA/COM API/Training materials/cheatsheet.txt b/GSA/COM API/Training materials/cheatsheet.txt index 56995dd..bbf6f1d 100644 --- a/GSA/COM API/Training materials/cheatsheet.txt +++ b/GSA/COM API/Training materials/cheatsheet.txt @@ -1,144 +1,144 @@ -' excel - Dim excel As New Microsoft.Office.Interop.Excel.Application - - Dim wb As Workbook = excel.Workbooks.Add() - - Dim sheet As Worksheet = wb.Worksheets(1) - - - If IsNothing(sheet) Then - Console.Write("sheet is null") - End If - - For i As Integer = 1 To 100 - sheet.Cells(i, 1).Value = excel.RandBetween(1, 1000) - Next - - 'Console.WriteLine(sheet.Name.ToString()) - - For i As Integer = 1 To 100 - Dim n As Integer = sheet.Cells(i, 1).Value - If IsPrime(n) Then - sheet.Cells(i, 2).Value = "Prime" - End If - Next - - wb.SaveAs("c:\GSA_training\primes.xlsx") - excel.Quit() - - excel = Nothing - - - -' core functions - Dim gsaObj As New gsa_8_7.ComAuto - - gsaObj.Open("c:\GSA_training\Env.gwb") - - gsaObj.Delete("RESULTS_AND_CASES") - - 'LOAD_BEAM_POINT.2 | name | list | case | axis | proj | dir | pos |  value - gsaObj.GwaCommand("LOAD_BEAM_POINT.2,load added by COM,2,4,GLOBAL,NO,Z,-.25,-12") - gsaObj.Analyse() - gsaObj.SaveAs("c:\GSA_training\Env_loaded.gwb") - gsaObj.Close() - - gsaObj = Nothing - -'------------------------------- - -' GwaCommand - ' element 1 - elRef = 1 ' could be HIGHEST + 1 too - gwaRecord = "EL," & elRef & ",,NO_RGB,BEAM,1,1," & n1 & "," & n2 - ret = gsa.GwaCommand(gwaRecord) - If 0 = ret Then - Console.WriteLine("Created element {0}", elRef) - Else - Console.WriteLine("Failed to create element {0}", elRef) - End If - - ' element 2 - elRef += 1 - gwaRecord = String.Format("EL,{0},,NO_RGB,BEAM,1,1, {1},{2}", elRef, n2, n3) - ret = gsa.GwaCommand(gwaRecord) - If 0 = ret Then - Console.WriteLine("Created element {0}", elRef) - Else - Console.WriteLine("Failed to create element {0}", elRef) - End If - - ' element 3 - elRef += 1 - gwaRecord = String.Format("EL,{0},,NO_RGB,BEAM,1,1, {1},{2}", elRef, n3, n4) - ret = gsa.GwaCommand(gwaRecord) - If 0 = ret Then - Console.WriteLine("Created element {0}", elRef) - Else - Console.WriteLine("Failed to create element {0}", elRef) - End If - - ' the following shows function reuse - ret = CreateBeam(elRef, 1, n1, n2, gsa) - If True = ret Then - elRef += 1 - End If - ret = CreateBeam(elRef, 1, n2, n3, gsa) - If True = ret Then - elRef += 1 - End If - ret = CreateBeam(elRef, 1, n3, n4, gsa) - If True = ret Then - elRef += 1 - End If - - -'Function CreateBeam(ByVal index As Integer, ByVal prop As Integer, ByVal topo0 As Integer, -' ByVal topo1 As Integer, ByRef gsaObject As ComAuto) As Boolean -' Dim gwaRecord As String = String.Format("EL,{0},,NO_RGB,BEAM,{1},1, {2},{2}", index, prop, topo0, topo1) -' Dim ret As Integer = gsaObject.GwaCommand(gwaRecord) -' If 0 = ret Then -' Return True -' Else -' Return False -' End If -'End Function -'------------------------------ -' lists - ret = gsa.EntitiesInList("XY1", GsaEntity.NODE, ents) - -'------------------------ -' output - ret = gsa.Output_Init(OP_INIT_INFINITY, "default", acaseString, dataref, 3) - - If Not Integer.Equals(0, ret) Then - Console.WriteLine("Output_Init failed.") - Exit Sub - End If - - Dim ents() As Integer ' array to store node numbers in the list - - ret = gsa.EntitiesInList("XY1", GsaEntity.NODE, ents) - - ' check output title and verify it's per node - Dim isPerNode As Short = gsa.Output_IsDataRef(OP_IS_PER_REC) - - Dim title As String = gsa.Output_DataTitle(1) - - Console.WriteLine("Output title: " & title & "IsPerRecord = " & isPerNode) - - ' loop over the contents of the list - For Each ent In ents - ret = gsa.Output_DataExist(ent) - If 0 = ret Then - Console.WriteLine("Output_DataExist failed for " & ent) - Exit For - End If - - Dim result As Double = gsa.Output_Extract(ent, 0) - Console.WriteLine("Result for node " & ent & " = " & result) - Next - - - - +' excel + Dim excel As New Microsoft.Office.Interop.Excel.Application + + Dim wb As Workbook = excel.Workbooks.Add() + + Dim sheet As Worksheet = wb.Worksheets(1) + + + If IsNothing(sheet) Then + Console.Write("sheet is null") + End If + + For i As Integer = 1 To 100 + sheet.Cells(i, 1).Value = excel.RandBetween(1, 1000) + Next + + 'Console.WriteLine(sheet.Name.ToString()) + + For i As Integer = 1 To 100 + Dim n As Integer = sheet.Cells(i, 1).Value + If IsPrime(n) Then + sheet.Cells(i, 2).Value = "Prime" + End If + Next + + wb.SaveAs("c:\GSA_training\primes.xlsx") + excel.Quit() + + excel = Nothing + + + +' core functions + Dim gsaObj As New gsa_8_7.ComAuto + + gsaObj.Open("c:\GSA_training\Env.gwb") + + gsaObj.Delete("RESULTS_AND_CASES") + + 'LOAD_BEAM_POINT.2 | name | list | case | axis | proj | dir | pos |  value + gsaObj.GwaCommand("LOAD_BEAM_POINT.2,load added by COM,2,4,GLOBAL,NO,Z,-.25,-12") + gsaObj.Analyse() + gsaObj.SaveAs("c:\GSA_training\Env_loaded.gwb") + gsaObj.Close() + + gsaObj = Nothing + +'------------------------------- + +' GwaCommand + ' element 1 + elRef = 1 ' could be HIGHEST + 1 too + gwaRecord = "EL," & elRef & ",,NO_RGB,BEAM,1,1," & n1 & "," & n2 + ret = gsa.GwaCommand(gwaRecord) + If 0 = ret Then + Console.WriteLine("Created element {0}", elRef) + Else + Console.WriteLine("Failed to create element {0}", elRef) + End If + + ' element 2 + elRef += 1 + gwaRecord = String.Format("EL,{0},,NO_RGB,BEAM,1,1, {1},{2}", elRef, n2, n3) + ret = gsa.GwaCommand(gwaRecord) + If 0 = ret Then + Console.WriteLine("Created element {0}", elRef) + Else + Console.WriteLine("Failed to create element {0}", elRef) + End If + + ' element 3 + elRef += 1 + gwaRecord = String.Format("EL,{0},,NO_RGB,BEAM,1,1, {1},{2}", elRef, n3, n4) + ret = gsa.GwaCommand(gwaRecord) + If 0 = ret Then + Console.WriteLine("Created element {0}", elRef) + Else + Console.WriteLine("Failed to create element {0}", elRef) + End If + + ' the following shows function reuse + ret = CreateBeam(elRef, 1, n1, n2, gsa) + If True = ret Then + elRef += 1 + End If + ret = CreateBeam(elRef, 1, n2, n3, gsa) + If True = ret Then + elRef += 1 + End If + ret = CreateBeam(elRef, 1, n3, n4, gsa) + If True = ret Then + elRef += 1 + End If + + +'Function CreateBeam(ByVal index As Integer, ByVal prop As Integer, ByVal topo0 As Integer, +' ByVal topo1 As Integer, ByRef gsaObject As ComAuto) As Boolean +' Dim gwaRecord As String = String.Format("EL,{0},,NO_RGB,BEAM,{1},1, {2},{2}", index, prop, topo0, topo1) +' Dim ret As Integer = gsaObject.GwaCommand(gwaRecord) +' If 0 = ret Then +' Return True +' Else +' Return False +' End If +'End Function +'------------------------------ +' lists + ret = gsa.EntitiesInList("XY1", GsaEntity.NODE, ents) + +'------------------------ +' output + ret = gsa.Output_Init(OP_INIT_INFINITY, "default", acaseString, dataref, 3) + + If Not Integer.Equals(0, ret) Then + Console.WriteLine("Output_Init failed.") + Exit Sub + End If + + Dim ents() As Integer ' array to store node numbers in the list + + ret = gsa.EntitiesInList("XY1", GsaEntity.NODE, ents) + + ' check output title and verify it's per node + Dim isPerNode As Short = gsa.Output_IsDataRef(OP_IS_PER_REC) + + Dim title As String = gsa.Output_DataTitle(1) + + Console.WriteLine("Output title: " & title & "IsPerRecord = " & isPerNode) + + ' loop over the contents of the list + For Each ent In ents + ret = gsa.Output_DataExist(ent) + If 0 = ret Then + Console.WriteLine("Output_DataExist failed for " & ent) + Exit For + End If + + Dim result As Double = gsa.Output_Extract(ent, 0) + Console.WriteLine("Result for node " & ent & " = " & result) + Next + + + + diff --git a/GSA/Command line interface/SampleCmdFile.gwc b/GSA/Command line interface/SampleCmdFile.gwc index 9f2aceb..3f14604 100644 --- a/GSA/Command line interface/SampleCmdFile.gwc +++ b/GSA/Command line interface/SampleCmdFile.gwc @@ -1,42 +1,42 @@ -// GSA accepts a GWC filename as a command line argument. -// A GWC file is an ASCII file containing a number of commands. -// The commands are processed by GSA as a batch operation -// in the sequence in which they appear in the GWC file. -// A LOG file is produced in the GWC file folder. -// -// Notes: -// Text following "//" is ignored. -// Data file extensions GWB, GWA and CSV are valid. -// The SAVE command saves in the same format as last saved, or as read in format if not saved in this session. -// Where a view name is required the following are valid: -// the name of a saved view or view list -// ALL_PGV - all preferred Graphic Views -// ALL_SGV - all saved Graphic Views -// ALL_POV - all preferred Output Views -// ALL_SOV - all saved Output Views -// ALL_LST - all views in all View Lists -// TAGGED_PGV - selected preferred Graphic Views -// TAGGED_SGV - selected saved Graphic Views -// TAGGED_POV - selected preferred Output Views -// TAGGED_SOV - selected saved Output Views -// TAGGED_LST - all views in selected View Lists - -// -// Sample GWC file: -// -{ -Open("c:\Views.gwb"); // open the GWB file -Delete(RESULTS ); // delete results but not analysis cases -Delete(RESULTS_AND_CASES); // delete results and analysis cases -Analyse(); // analyse all unanalysed cases, or if none, do static analysis of all load cases -Save(); // save file -SaveAs("c:\Views.csv"); // save as 'comma separated' format text file -SaveAs("c:\Views.gwa"); // save as 'tab separated' format text file -PrintView("TAGGED_SGV"); // print a view (it's a saved Graphic View) -SaveViewToFile("view list B", TXT); // save Output Views to tab delimited TXT file - // this is a view list so all Output Views in this view list will be saved -SaveViewToFile("view list A", PNG); // save Graphic Views to PNG file - // this is a view list so all Graphic Views in this view list will be saved -Close() -Exit() -} +// GSA accepts a GWC filename as a command line argument. +// A GWC file is an ASCII file containing a number of commands. +// The commands are processed by GSA as a batch operation +// in the sequence in which they appear in the GWC file. +// A LOG file is produced in the GWC file folder. +// +// Notes: +// Text following "//" is ignored. +// Data file extensions GWB, GWA and CSV are valid. +// The SAVE command saves in the same format as last saved, or as read in format if not saved in this session. +// Where a view name is required the following are valid: +// the name of a saved view or view list +// ALL_PGV - all preferred Graphic Views +// ALL_SGV - all saved Graphic Views +// ALL_POV - all preferred Output Views +// ALL_SOV - all saved Output Views +// ALL_LST - all views in all View Lists +// TAGGED_PGV - selected preferred Graphic Views +// TAGGED_SGV - selected saved Graphic Views +// TAGGED_POV - selected preferred Output Views +// TAGGED_SOV - selected saved Output Views +// TAGGED_LST - all views in selected View Lists + +// +// Sample GWC file: +// +{ +Open("c:\Views.gwb"); // open the GWB file +Delete(RESULTS ); // delete results but not analysis cases +Delete(RESULTS_AND_CASES); // delete results and analysis cases +Analyse(); // analyse all unanalysed cases, or if none, do static analysis of all load cases +Save(); // save file +SaveAs("c:\Views.csv"); // save as 'comma separated' format text file +SaveAs("c:\Views.gwa"); // save as 'tab separated' format text file +PrintView("TAGGED_SGV"); // print a view (it's a saved Graphic View) +SaveViewToFile("view list B", TXT); // save Output Views to tab delimited TXT file + // this is a view list so all Output Views in this view list will be saved +SaveViewToFile("view list A", PNG); // save Graphic Views to PNG file + // this is a view list so all Graphic Views in this view list will be saved +Close() +Exit() +}