Esempio n. 1
0
 public static dynamic GetTSObject(CustomPart dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Esempio n. 2
0
        private void createElementOfOnePoint(string name, int number)
        {
            CustomPart customPart = new CustomPart();

            customPart.Name   = name;
            customPart.Number = number;

            Picker picker = new Picker();

            try
            {
                Point startPoint = picker.PickPoint("Wybierz punkt");
                customPart.SetInputPositions(startPoint, startPoint + new Point(0, 0, 1000));
            }
            catch (ApplicationException ex)
            {
                Operation.DisplayPrompt("Przerwano operację");
                return;
            }
            if (number != BaseComponent.CUSTOM_OBJECT_NUMBER)
            {
                customPart.Insert();
            }
            else
            {
                try
                {
                    if (isExisting(customPart))
                    {
                        customPart.Insert();
                    }
                    else
                    {
                        importCustomComponent(customPart);
                        customPart.Insert();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Nie udało się wstawić komponentu", "Error");
                }
            }
            MyModel.CommitChanges();
        }
Esempio n. 3
0
        public void GetReflectsChangesMadeByApply()
        {
            // arrange
            var value       = "changed value";
            var contentItem = new ContentItem();

            contentItem.Weld <CustomPart>();
            var part = new CustomPart {
                Value = value
            };

            // act
            contentItem.Apply(nameof(CustomPart), part);

            // assert
            var actual = contentItem.Get <CustomPart>(nameof(CustomPart));

            Assert.Equal(actual.Value, value);
        }
Esempio n. 4
0
    void AutoLoad(CustomPart cp)
    {
        //不載入空物件,不然一定出事 = ="
        if (cp.customPart == null)
        {
            return;
        }

        //不載入錯誤型態的部件,不然會重複
        //TODO:在手動安裝部件的時候也要檢查這個
        if (!cp.slotTypeCheck())
        {
            return;
        }

        if (!cp.isMatchCache())
        {
            cp.CacheIt();
            LoadPart(cp);
        }
    }
        public void TR31(int A, int B, int C, int _steel, string _profile, int X1, int Y1, int Z1, int X2, int Y2, int Z2) //Входные данные Размеры A B C, Материал, Профиль, Позиция 1(XYZ), Позиция 2 (XYZ)
        {
            ProfileTransformation profile = new ProfileTransformation();
            CustomPart            Support = new CustomPart();
            TypeSteel             steel   = new TypeSteel();

            Support.Name                    = "TR31";
            Support.Number                  = BaseComponent.CUSTOM_OBJECT_NUMBER;    // Базоввый номер компонента
            Support.Position.Plane          = Position.PlaneEnum.MIDDLE;             // На плоскости-Середина
            Support.Position.PlaneOffset    = 0;
            Support.Position.Depth          = Position.DepthEnum.FRONT;              //Высота - Спереду
            Support.Position.DepthOffset    = 0;
            Support.Position.Rotation       = Position.RotationEnum.TOP;             //Поворот - Сверху
            Support.Position.RotationOffset = 0;
            Support.SetInputPositions(new Point(X1, Y1, Z1), new Point(X2, Y2, Z2)); //Позиция x y z точка 1 и точка 2
            Support.SetAttribute("A", A);                                            //Заполнение атрибутов (имя артибута, значение)
            Support.SetAttribute("B", B);                                            //Заполнение атрибутов (имя артибута, значение)
            Support.SetAttribute("C", C);                                            //Заполнение атрибутов (имя артибута, значение)
            Support.SetAttribute("profile", profile.Angle(_profile));                //Заполнение атрибутов (имя артибута, значение), переопределение профиля из таблицы
            Support.SetAttribute("material", steel.Steel(_steel));                   //Заполнение атрибутов (имя артибута, значение), переопределение стали из таблицы
            Support.Insert();                                                        // Вставка компонента
        }
Esempio n. 6
0
 void LoadPart(CustomPart part)
 {
     part.UnLoad();
     part.Load(this);
 }