private static double GetProfileParameter(string aProfileName, int aNo)
        {
            CatalogHandler catalogHandler = new CatalogHandler();
            double         result         = -1.0;

            if (catalogHandler.GetConnectionStatus())
            {
                try
                {
                    LibraryProfileItem libraryProfile = new LibraryProfileItem();
                    libraryProfile.Select(aProfileName);
                    ArrayList            Parameters = libraryProfile.aProfileItemParameters;
                    ProfileItemParameter parameter  = (ProfileItemParameter)Parameters[aNo];
                    result = parameter.Value;
                }
                catch
                {
                    try
                    {
                        ParametricProfileItem parametricProfile = new ParametricProfileItem();
                        parametricProfile.Select(aProfileName);
                        ArrayList            Parameters = parametricProfile.aProfileItemParameters;
                        ProfileItemParameter parameter  = (ProfileItemParameter)Parameters[aNo];
                        result = parameter.Value;
                    }
                    catch { }
                }
            }
            return(result);
        }
 public static dynamic GetTSObject(CatalogHandler dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Пример #3
0
        private void importCustomComponent(BaseComponent component)
        {
            CatalogHandler catalogHandler = new CatalogHandler();

            if (catalogHandler.ImportCustomComponentItems(CUSTOM_COMPONENTS_PATH + component.Name + ".uel"))
            {
                Operation.DisplayPrompt("Importowano komponent " + component.Name);
            }
        }
Пример #4
0
        private bool isExisting(BaseComponent component)
        {
            CatalogHandler catalogHandler = new CatalogHandler();

            if (catalogHandler.GetConnectionStatus())
            {
                ComponentItemEnumerator componentItemEnumerator = catalogHandler.GetComponentItems();
                ComponentItem           componentItem;
                while (componentItemEnumerator.MoveNext())
                {
                    componentItem = componentItemEnumerator.Current;
                    if (component.Name == componentItem.Name)
                    {
                        return(true);
                    }
                }
                return(false);
            }
            MessageBox.Show("Nie można połączyć z modelem");
            throw new Exception("Nie można połączyć z modelem");
        }
        /// <summary>
        /// When the Form is loaded the the steel materials are loaded from the catalog
        /// </summary>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //Set the value for the footings
            FootingSize.Text = "1500";

            //Create a filtered list of steel materials available in the material catalog
            CatalogHandler CatalogHandler = new CatalogHandler();

            MaterialItemEnumerator Materials = CatalogHandler.GetMaterialItems();

            while (Materials.MoveNext())
            {
                MaterialItem Item = Materials.Current;

                if (Item.Type == MaterialItem.MaterialItemTypeEnum.MATERIAL_STEEL)
                {
                    SteelMaterials.Add(Item);
                }
            }
        }
Пример #6
0
        List <Tuple <string, string> > GetAllDrawingsUDA()
        {
            var returnList = new List <Tuple <string, string> >();
            var ct         = new CatalogHandler();

            var itemEnumerator = ct.GetUserPropertyItems(CatalogObjectTypeEnum.GA_DRAWING);

            while (itemEnumerator.MoveNext())
            {
                var uda      = itemEnumerator.Current.Name;
                var udaLabel = itemEnumerator.Current.GetLabel();
                if (!returnList.Exists(x => x.Item1.Equals(uda, StringComparison.InvariantCulture)))
                {
                    returnList.Add(new Tuple <string, string>(uda, udaLabel));
                }
            }

            itemEnumerator.Reset();
            itemEnumerator = ct.GetUserPropertyItems(CatalogObjectTypeEnum.ASSEMBLY_DRAWING);

            while (itemEnumerator.MoveNext())
            {
                var uda      = itemEnumerator.Current.Name;
                var udaLabel = itemEnumerator.Current.GetLabel();
                if (!returnList.Exists(x => x.Item1.Equals(uda, StringComparison.InvariantCulture)))
                {
                    returnList.Add(new Tuple <string, string>(uda, udaLabel));
                }
            }

            itemEnumerator.Reset();
            itemEnumerator = ct.GetUserPropertyItems(CatalogObjectTypeEnum.SINGLE_PART_DRAWING);

            while (itemEnumerator.MoveNext())
            {
                var uda      = itemEnumerator.Current.Name;
                var udaLabel = itemEnumerator.Current.GetLabel();
                if (!returnList.Exists(x => x.Item1.Equals(uda, StringComparison.InvariantCulture)))
                {
                    returnList.Add(new Tuple <string, string>(uda, udaLabel));
                }
            }

            itemEnumerator.Reset();
            itemEnumerator = ct.GetUserPropertyItems(CatalogObjectTypeEnum.CAST_UNIT_DRAWING);

            while (itemEnumerator.MoveNext())
            {
                var uda      = itemEnumerator.Current.Name;
                var udaLabel = itemEnumerator.Current.GetLabel();
                if (!returnList.Exists(x => x.Item1.Equals(uda, StringComparison.InvariantCulture)))
                {
                    returnList.Add(new Tuple <string, string>(uda, udaLabel));
                }
            }

            itemEnumerator.Reset();
            itemEnumerator = ct.GetUserPropertyItems(CatalogObjectTypeEnum.MULTI_DRAWING);

            while (itemEnumerator.MoveNext())
            {
                var uda      = itemEnumerator.Current.Name;
                var udaLabel = itemEnumerator.Current.GetLabel();
                if (!returnList.Exists(x => x.Item1.Equals(uda, StringComparison.InvariantCulture)))
                {
                    returnList.Add(new Tuple <string, string>(uda, udaLabel));
                }
            }

            returnList.Sort((x, y) => string.Compare(x.Item1, y.Item1, StringComparison.InvariantCulture));
            return(returnList);
        }