Beispiel #1
0
        /***************************************************/
        /****           Public Constructors             ****/
        /***************************************************/

        public static LusasConfig LusasConfig(LibrarySettings librarySettings = null)
        {
            LusasConfig lusasConfig = new LusasConfig();

            if (librarySettings != null)
            {
                lusasConfig.LibrarySettings = librarySettings;
            }

            return(lusasConfig);
        }
Beispiel #2
0
        public LusasV17Adapter(string filePath, LusasConfig lusasConfig = null, bool active = false)
#endif
        {
            if (active)
            {
                m_directory           = new FileInfo(filePath).Directory.FullName;
                AdapterIdFragmentType = typeof(LusasId);

                BH.Adapter.Modules.Structure.ModuleLoader.LoadModules(this);

                AdapterComparers = new Dictionary <Type, object>
                {
                    { typeof(Node), new Engine.Structure.NodeDistanceComparer(3) },
                    { typeof(Bar), new Engine.Adapters.Lusas.Object_Comparer.Equality_Comparer.BarMidPointComparer(3) },
                    { typeof(Edge), new Engine.Adapters.Lusas.Object_Comparer.Equality_Comparer.EdgeMidPointComparer(3) },
                    { typeof(Point), new Engine.Adapters.Lusas.Object_Comparer.Equality_Comparer.PointDistanceComparer(3) },
                    { typeof(IMaterialFragment), new NameOrDescriptionComparer() },
                    { typeof(LinkConstraint), new NameOrDescriptionComparer() },
                    { typeof(ISurfaceProperty), new NameOrDescriptionComparer() },
                    { typeof(ISectionProperty), new NameOrDescriptionComparer() },
                    { typeof(Constraint6DOF), new NameOrDescriptionComparer() },
                    { typeof(ILoad), new BHoMObjectNameComparer() },
                    { typeof(Loadcase), new BHoMObjectNameComparer() },
                    { typeof(LoadCombination), new BHoMObjectNameComparer() }
                };

                DependencyTypes = new Dictionary <Type, List <Type> >
                {
                    { typeof(Panel), new List <Type> {
                          typeof(ISurfaceProperty), typeof(Edge)
                      } },
                    { typeof(Edge), new List <Type> {
                          typeof(Constraint4DOF), typeof(Constraint6DOF)
                      } },
                    { typeof(Bar), new List <Type> {
                          typeof(Node), typeof(ISectionProperty), typeof(Constraint4DOF)
                      } },
                    { typeof(Node), new List <Type> {
                          typeof(Constraint6DOF)
                      } },
                    { typeof(ISectionProperty), new List <Type> {
                          typeof(IMaterialFragment)
                      } },
                    { typeof(RigidLink), new List <Type> {
                          typeof(LinkConstraint), typeof(Node)
                      } },
                    { typeof(ISurfaceProperty), new List <Type> {
                          typeof(IMaterialFragment)
                      } },
                    { typeof(ILoad), new List <Type> {
                          typeof(Loadcase)
                      } },
                };

                if (string.IsNullOrWhiteSpace(filePath))
                {
                    throw new ArgumentException("Please specify a valid .mdl file.");
                }
                else
                {
                    m_LusasApplication = new LusasWinApp();
#if Debug17 || Release17
                    System.Runtime.InteropServices.Marshal.GetActiveObject("Lusas.Modeller.17.0");
#elif Debug18 || Release18
                    System.Runtime.InteropServices.Marshal.GetActiveObject("Lusas.Modeller.18.0");
#elif Debug19 || Release19
                    System.Runtime.InteropServices.Marshal.GetActiveObject("Lusas.Modeller.19.0");
#endif
                    m_LusasApplication.enableUI(true);
                    m_LusasApplication.setVisible(true);
                    try
                    {
                        d_LusasData = m_LusasApplication.openDatabase(filePath);
                    }
                    catch (System.Runtime.InteropServices.COMException)
                    {
                        throw new Exception("An exception has been flagged by Lusas, it is likely the file is from a higher version of Lusas than the adapter being used.");
                    }
                }
            }
        }
Beispiel #3
0
 public LusasV19Adapter(string filePath, LusasConfig lusasConfig = null, bool active = false)