public SwapHandles()
        {
            var selector = new Tekla.Structures.Model.UI.ModelObjectSelector();
            var myEnum   = selector.GetSelectedObjects();

            while (myEnum.MoveNext())
            {
                if (myEnum.Current is Tekla.Structures.Model.ContourPlate)
                {
                    ContourPlate cPlate = myEnum.Current as ContourPlate;
                    cPlate.Position.Depth = SwapEndForces(cPlate.Position.Depth);
                    cPlate.Modify();
                }
                else if (myEnum.Current is Tekla.Structures.Model.BooleanPart)
                {
                    BooleanPart  boolPart        = myEnum.Current as Tekla.Structures.Model.BooleanPart;
                    ContourPlate boolConturPlate = boolPart.OperativePart as Tekla.Structures.Model.ContourPlate;

                    if (boolConturPlate != null)
                    {
                        boolConturPlate.Position.Depth = SwapEndForces(boolConturPlate.Position.Depth);
                        boolConturPlate.Modify();
                    }
                }
            }

            new Model().CommitChanges();
        }
        private void MallinnaLaatta()
        {
            ModelObjectSelector   mSelector = malli.GetModelObjectSelector();
            ModelObjectEnumerator enumer    = mSelector.GetAllObjects();

            for (int i = 0; i < enumer.GetSize(); i++)
            {
                ModelObject obj = enumer.Current;
                if (obj is ContourPlate)
                {
                    if (((ContourPlate)obj).Name == "LASKETTU_LAATTA")
                    {
                        ContourPlate laattaTemp = (ContourPlate)obj;
                        laattaTemp.Contour.ContourPoints[0] = new ContourPoint(new Point(0, 0, 3000), null);
                        laattaTemp.Contour.ContourPoints[1] = new ContourPoint(new Point(0, laatanKorkeus, 3000), null);
                        laattaTemp.Contour.ContourPoints[2] = new ContourPoint(new Point(laatanLeveys, laatanKorkeus, 3000), null);
                        laattaTemp.Contour.ContourPoints[3] = new ContourPoint(new Point(laatanLeveys, 0, 3000), null);
                        PoistaRaudoitus(laattaTemp);
                        laattaTemp.Modify();
                        malli.CommitChanges();
                        return;
                    }
                }
                enumer.MoveNext();
            }
            ContourPlate laatta = new ContourPlate();

            laatta.Name = "LASKETTU_LAATTA";
            ContourPoint vasenAlanurkka = new ContourPoint(new Point(0, 0, 3000), null);
            ContourPoint vasenYlanurkka = new ContourPoint(new Point(0, laatanKorkeus, 3000), null);
            ContourPoint oikeaYlanurkka = new ContourPoint(new Point(laatanLeveys, laatanKorkeus, 3000), null);
            ContourPoint oikeaAlanurkka = new ContourPoint(new Point(laatanLeveys, 0, 3000), null);

            laatta.AddContourPoint(vasenAlanurkka);
            laatta.AddContourPoint(vasenYlanurkka);
            laatta.AddContourPoint(oikeaYlanurkka);
            laatta.AddContourPoint(oikeaAlanurkka);

            laatta.Profile.ProfileString = Asetukset.LaatanPaksuus.ToString();
            if (!string.IsNullOrWhiteSpace(Asetukset.BetoninLujuus.ToString()))
            {
                laatta.Material.MaterialString = betonimateriaalit[Asetukset.BetoninLujuus];
            }
            else
            {
                laatta.Material.MaterialString = "Concrete_Undefined";
            }
            laatta.Position.Depth = Position.DepthEnum.FRONT;

            laatta.Insert();
            malli.CommitChanges();
        }
Exemple #3
0
        public SwapHandles()
        {
            //Get selected objects and put them in an enumerator/container
            var selector = new Tekla.Structures.Model.UI.ModelObjectSelector();
            var myEnum   = selector.GetSelectedObjects();

            //Cycle through selected objects
            while (myEnum.MoveNext())
            {
                //Cast beam
                if (myEnum.Current is Tekla.Structures.Model.Beam)
                {
                    var myBeam = myEnum.Current as Beam;

                    // Get part current handles
                    var startPoint = myBeam.StartPoint;
                    var endPoint   = myBeam.EndPoint;

                    // Switch part handles
                    myBeam.StartPoint = endPoint;
                    myBeam.EndPoint   = startPoint;

                    //Swap uda's for design forces
                    SwapEndForces(myBeam);

                    // modify beam and refresh model + undo
                    myBeam.Modify();
                }
                else if (myEnum.Current is Tekla.Structures.Model.PolyBeam)
                {
                    var myBeam = myEnum.Current as PolyBeam;

                    // Get part current handles
                    var newPoints = new ArrayList();
                    var oldPoints = myBeam.Contour.ContourPoints;

                    //Copy points to new seperate list first
                    foreach (var cp in oldPoints)
                    {
                        newPoints.Add(cp);
                    }
                    newPoints.Reverse();

                    //Swap uda's for design forces
                    SwapEndForces(myBeam);

                    // modify beam and refresh model + undo
                    myBeam.Contour.ContourPoints = newPoints;
                    myBeam.Modify();
                }
                else if (myEnum.Current is Tekla.Structures.Model.ContourPlate)
                {
                    var myBeam = myEnum.Current as ContourPlate;


                    var newTochki = new ArrayList();
                    var oldTochki = myBeam.Contour.ContourPoints;

                    foreach (var cp in oldTochki)
                    {
                        newTochki.Add(cp);
                    }
                    newTochki.Reverse();

                    SwapEndForces(myBeam);

                    myBeam.Contour.ContourPoints = newTochki;
                    myBeam.Modify();
                }

                else if (myEnum.Current is Tekla.Structures.Model.BooleanPart)
                {
                    BooleanPart  boolPart        = myEnum.Current as Tekla.Structures.Model.BooleanPart;
                    ContourPlate boolConturPlate = boolPart.OperativePart as Tekla.Structures.Model.ContourPlate;

                    if (boolConturPlate != null)
                    {
                        var newTochki = new ArrayList();
                        var oldTochki = boolConturPlate.Contour.ContourPoints;

                        foreach (var cp in oldTochki)
                        {
                            newTochki.Add(cp);
                        }
                        newTochki.Reverse();

                        SwapEndForces(boolConturPlate);

                        boolConturPlate.Contour.ContourPoints = newTochki;
                        boolConturPlate.Modify();
                    }
                }
            }

            //Update model with changes
            new Model().CommitChanges();
        }
        public override bool Run(List <InputDefinition> Input)
        {
            try
            {
                GetValuesFromDialog();

                WorkPlaneHandler wph = Model.GetWorkPlaneHandler();

                TransformationPlane tp     = wph.GetCurrentTransformationPlane();
                TransformationPlane tppart = null;


                BoltGroup bg = Model.SelectModelObject((Identifier)Input[0].GetInput()) as BoltGroup;
                bg.Select();
                List <Part> parts = new List <Part>();
                parts.Add(bg.PartToBeBolted);
                parts.Add(bg.PartToBoltTo);
                foreach (Part p in bg.OtherPartsToBolt)
                {
                    parts.Add(p);
                }

                #region Clear
                List <Part> _part = new List <Part>();

                foreach (Part p in parts)
                {
                    bool flag = false;
                    foreach (Part pp in _part)
                    {
                        if (pp.Identifier.ID == p.Identifier.ID)
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        _part.Add(p);
                    }
                }

                parts.Clear();
                parts = _part;
                #endregion

                foreach (Part p in parts)
                {
                    if (p is Beam)
                    {
                        Beam b = p as Beam;
                        b.Select();

                        double k = 0.0; b.GetReportProperty("PROFILE.FLANGE_SLOPE_RATIO", ref k);
                        if (k == 0)
                        {
                            continue;
                        }

                        tppart = new TransformationPlane(p.GetCoordinateSystem());
                        wph.SetCurrentTransformationPlane(tppart);
                        bg.Select();
                        foreach (Point pb in bg.BoltPositions)
                        {
                            Point _pb = new Point(pb);

                            #region Уклон полок - точки через солид

                            GeometricPlane gp = new GeometricPlane(
                                _pb,
                                new Vector(0, 1, 0),
                                new Vector(0, 0, 1));
                            List <List <Point> > lp = IntersectSolid(p.GetSolid(), gp);

                            List <LineSegment> ls = new List <LineSegment>();


                            for (int i = 0; i < lp[0].Count - 1; i++)
                            {
                                Point  p1 = lp[0][i];
                                Point  p2 = lp[0][i + 1];
                                Vector v  = new Vector(p2.X - p1.X, p2.Y - p1.Y, p2.Z - p1.Z);
                                v.Normalize(1.0);
                                if (v.Y != 0 && v.Z != 0)
                                {
                                    ControlLine cl = new ControlLine();
                                    cl.Line.Point1 = p1;
                                    cl.Line.Point2 = p2;
                                    // cl.Insert();
                                    ls.Add(new LineSegment(p1, p2));
                                }
                            }

                            Point  _p1 = lp[0][0];
                            Point  _p2 = lp[0][lp[0].Count - 1];
                            Vector _v  = new Vector(_p2.X - _p1.X, _p2.Y - _p1.Y, _p2.Z - _p1.Z);
                            if (_v.Y != 0 && _v.Z != 0)
                            {
                                ls.Add(new LineSegment(_p1, _p2));
                                ControlLine cl = new ControlLine();
                                cl.Line.Point1 = _p1;
                                cl.Line.Point2 = _p2;
                                // cl.Insert();
                            }


                            #endregion

                            #region Точки для построения пластины

                            double diam = bg.BoltSize;

                            double tol = GOST_10906_78[diam][0];
                            double _b  = GOST_10906_78[diam][1];
                            double t1  = GOST_10906_78[diam][2];
                            double t2  = GOST_10906_78[diam][3];

                            int kf = (_pb.Z <= ((Point)b.GetReferenceLine(false)[0]).Z ? -1 : 1);

                            _pb.Z += kf * _b * 0.5;


                            double      h   = double.MaxValue;
                            LineSegment lsb = ls[0];

                            foreach (LineSegment lsi in ls)
                            {
                                double t = Distance.PointToLineSegment(_pb, lsi);
                                if (h >= t)
                                {
                                    h   = t;
                                    lsb = lsi;
                                }
                            }
                            //ControlLine cli = new ControlLine();
                            //cli.Line.Point1 = lsb.Point1;
                            //cli.Line.Point2 = lsb.Point2;
                            //cli.Insert();
                            Point pb1 = new Point(_pb.X, _pb.Y + 1000, _pb.Z);

                            Point pbi = Intersection.LineToLine(
                                new Line(lsb),
                                new Line(_pb, pb1)).Point1;
                            //cli.Line.Point1 = _pb;
                            //cli.Line.Point2 = pbi;
                            //cli.Insert();

                            #endregion

                            ContourPlate cp = new ContourPlate();

                            Contour cr = new Contour();
                            cr.AddContourPoint(new ContourPoint(new Point(pbi.X - _b * 0.5, pbi.Y, pbi.Z), null));

                            cr.AddContourPoint(new ContourPoint(new Point(pbi.X + _b * 0.5, pbi.Y, pbi.Z), null));
                            cr.AddContourPoint(new ContourPoint(new Point(pbi.X + _b * 0.5, pbi.Y, pbi.Z - kf * _b), null));
                            cr.AddContourPoint(new ContourPoint(new Point(pbi.X - _b * 0.5, pbi.Y, pbi.Z - kf * _b), null));

                            cp.Contour = cr;


                            cp.Profile.ProfileString      = "PL" + t1.ToString();
                            cp.AssemblyNumber.Prefix      = prefix_asm;
                            cp.AssemblyNumber.StartNumber = start_part;
                            cp.PartNumber.Prefix          = prefix_part;
                            cp.PartNumber.StartNumber     = start_part;

                            cp.Name = name;
                            cp.Material.MaterialString = material;
                            cp.Finish = finish;

                            if (kf == -1 && pbi.Y > 0)
                            {
                                cp.Position.Depth = Position.DepthEnum.FRONT;
                            }
                            else if (kf == -1 && pbi.Y < 0)
                            {
                                cp.Position.Depth = Position.DepthEnum.BEHIND;
                            }
                            else if (kf == 1 && pbi.Y > 0)
                            {
                                cp.Position.Depth = Position.DepthEnum.BEHIND;
                            }
                            else if (kf == 1 && pbi.Y < 0)
                            {
                                cp.Position.Depth = Position.DepthEnum.FRONT;
                            }

                            cp.Insert();

                            if (weight != 0.0 && us_prop_weight != "")
                            {
                                cp.SetUserProperty(us_prop_weight, weight);
                                cp.Modify();
                            }

                            BooleanPart  bp  = new BooleanPart();
                            ContourPlate cp2 = new ContourPlate();
                            Contour      cr2 = new Contour();

                            cr2.AddContourPoint(new ContourPoint(new Point(pbi.X, pbi.Y, pbi.Z), null));
                            cr2.AddContourPoint(new ContourPoint(new Point(pbi.X, pbi.Y, pbi.Z - kf * _b), null));
                            cr2.AddContourPoint(new ContourPoint(new Point(pbi.X, pbi.Y + (pbi.Y > 0 ? -1 * (t1 - t2) : (t1 - t2)), pbi.Z - kf * _b), null));

                            cp2.Contour = cr2;
                            cp2.Profile.ProfileString = "PL" + (_b + 10).ToString();
                            cp2.Class = BooleanPart.BooleanOperativeClassName;

                            cp2.Insert();

                            bp.Father        = cp;
                            bp.OperativePart = cp2;
                            bp.Insert();
                            cp2.Delete();

                            BoltArray ba = new BoltArray();
                            ba.FirstPosition  = pb;
                            ba.SecondPosition = new Point(pb.X + 100, pb.Y, pb.Z);

                            ba.BoltStandard      = bg.BoltStandard;
                            ba.Position.Rotation = Position.RotationEnum.TOP;
                            ba.BoltType          = bg.BoltType;
                            ba.BoltSize          = bg.BoltSize;
                            ba.Tolerance         = tol;
                            ba.Bolt = false;
                            ba.AddBoltDistX(0);
                            ba.AddBoltDistY(0);
                            ba.PartToBeBolted = cp;
                            ba.PartToBoltTo   = cp;
                            ba.Insert();
                        }
                    }
                }
                wph.SetCurrentTransformationPlane(tp);
            }
            catch (Exception Exc)
            {
                MessageBox.Show(Exc.ToString());
            }

            return(true);
        }
Exemple #5
0
        // to work in Visual Studio uncomment next line:
        public static void Main()
        // to use this code as Tekla macro uncomment next line:
        //public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // Settings

            // <profile list>.csv - file location and name
            string csvLocation = "J:/Tekla/SKA_Macro files/stock list.csv";

            // <profile list>.csv - delimeter
            string delimiterString = ";";

            // list of part names for FL-PL profile check
            string[] partNamesToCheckArray = { "Afstivning", "Vind-X-Plade", "Løsdele", "Plade", "Fladstål", "Flange", };

            // list of part names to include in name AND prefix swaping (should be Plade and Fladstal)
            string[] partNamesToSwapArray = { "Plade", "Fladstål" };

            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // stock list.csv
            //
            // Instructions for preparation:
            // 1. you need original DS stock list,
            // 2. in excel delete all columns but 'Dimension', 'Reserveret' and 'Kvalitet'. This columns should be placed in A, B and C column positions,
            // 3. go through the rows and:
            //       - delete the rows with missing material,
            //       - repair the rows with corrupt material ('275' -> 'S275')
            //       - delete or repair rows with corrupt profile values (look for stuff like: '12x150', '100*5', '15'). Correct formatting is: 'width thickness'.
            // 4. save the file as 'stock list.csv' (default delimeter is semicolon. You can change the delimiter in 'delimiterString' variable)
            // 5. save the file in the location set with 'csvLocation' variable.
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // Ideas for improvements
            // - add refresh selection button to message box 'Selected objects will be modified
            // - add 'working' icon to mouse
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // v1.2, 30.1.2016
            // - more elaborate errors: added error catching for FileNotFoundException and DirectoryNotFoundException,
            // - now works also with files, that are currently open (have to check if this is tru also for in multiuser environments),
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            // preparation of variables
            char delimeter = delimiterString[0];

            List <string> partNamesToCheck = new List <string>();

            partNamesToCheck.AddRange(partNamesToCheckArray);

            List <string> partNamesToSwap = new List <string>();

            partNamesToSwap.AddRange(partNamesToSwapArray);

            // Profile list - profiles with attributes (width, thickness, material)
            // if profile is reserved it does not go in this list
            List <List <string> > profileList = new List <List <string> >();

            profileList = csvReader(csvLocation, delimeter);

            // if clause to exit if csvReader didn't succeed
            if (profileList.Count == 0)
            {
                return;
            }

            Model Model = new Model();

            if (!Model.GetConnectionStatus())
            {
                MessageBox.Show("Tekla is not open.", Variables.caption);
                Environment.Exit(1);
            }

            // select object types for selector
            System.Type[] Types = new System.Type[2];
            Types.SetValue(typeof(Beam), 0);
            Types.SetValue(typeof(ContourPlate), 1);

            // instantiate model object enumerator before if clauses
            Tekla.Structures.Model.ModelObjectEnumerator SelectedObjects = Model.GetModelObjectSelector().GetAllObjectsWithType(ModelObject.ModelObjectEnum.UNKNOWN);
            // =======================================================================================
            // dialog for object selection
            DialogResult dr   = new DialogResult();
            mainForm     form = new mainForm();

            dr = form.ShowDialog();

            if (dr == DialogResult.Yes)     // 'Yes' is used for all objects
            {
                SelectedObjects = Model.GetModelObjectSelector().GetAllObjectsWithType(Types);
            }
            else if (dr == DialogResult.No) // 'No' is used to get selected objects
            {
                SelectedObjects = new Tekla.Structures.Model.UI.ModelObjectSelector().GetSelectedObjects();
            }
            else
            {
                return;
            }
            // =======================================================================================

            // list of changed objects
            ArrayList partList = new ArrayList();

            while (SelectedObjects.MoveNext())
            {
                var  currentObject          = SelectedObjects.Current;
                var  nameOfObject           = "";
                var  profileOfObject        = "";
                var  prefixAssemblyOfObject = "";
                var  prefixPartOfObject     = "";
                bool isFlatProfile          = false;

                // get name of the object
                currentObject.GetReportProperty("NAME", ref nameOfObject);
                // strip the name of brackets
                nameOfObject = nameOfObject.Replace("(", "").Replace(")", "");

                // get the profile of the object
                currentObject.GetReportProperty("PROFILE", ref profileOfObject);

                // get the prefix of the object
                currentObject.GetReportProperty("ASSEMBLY_DEFAULT_PREFIX", ref prefixAssemblyOfObject);
                currentObject.GetReportProperty("PART_PREFIX", ref prefixPartOfObject);

                // check if profile is flat profile
                if (profileOfObject.StartsWith("FL") || profileOfObject.StartsWith("PL"))
                {
                    isFlatProfile = true;
                }

                // if name is contained in the list of parts to check and profile is a flat profile go in
                if (partNamesToCheck.Contains(nameOfObject) && isFlatProfile)
                {
                    // variables
                    string objectMaterial = "";
                    double objectWidth    = -1.0;
                    double objectHeight   = -1.0;
                    double objectLength   = -1.0;

                    currentObject.GetReportProperty("MATERIAL", ref objectMaterial);
                    currentObject.GetReportProperty("WIDTH", ref objectWidth);
                    currentObject.GetReportProperty("HEIGHT", ref objectHeight);
                    currentObject.GetReportProperty("LENGTH", ref objectLength);

                    // check if profile is in stock list
                    bool inStock = false;
                    inStock = FLCheck(profileList, objectMaterial, objectWidth, objectHeight, objectLength);

                    // check how profile should be changed
                    bool changeToFL = false;
                    bool changeToPL = false;
                    if (inStock && profileOfObject.StartsWith("PL"))
                    {
                        changeToFL = true;
                    }
                    if (!inStock && profileOfObject.StartsWith("FL"))
                    {
                        changeToPL = true;
                    }


                    // check how name should be changed
                    bool changeToFladstal = false;
                    bool changeToPlade    = false;

                    // this is used to change prefixes
                    bool changeToF = false;
                    bool changeToC = false;
                    if (partNamesToSwap.Contains(nameOfObject))
                    {
                        if (inStock && nameOfObject.Replace("(", "").Replace(")", "") == "Plade")
                        {
                            changeToFladstal = true;
                        }
                        if (!inStock && nameOfObject.Replace("(", "").Replace(")", "") == "Fladstål")
                        {
                            changeToPlade = true;
                        }
                        if (inStock && (prefixPartOfObject != "F" || prefixAssemblyOfObject != "f"))
                        {
                            changeToF = true;
                        }
                        if (!inStock && (prefixPartOfObject != "C" || prefixAssemblyOfObject != "c"))
                        {
                            changeToC = true;
                        }
                    }

                    // Functionality for changing the atributes is doubled for beams and plates.
                    // Could this be done in one clause?
                    Beam beam = SelectedObjects.Current as Beam;
                    if (beam != null)
                    {
                        if (changeToFL)
                        {
                            beam.Profile.ProfileString = "FL" + beam.Profile.ProfileString.ToString().Remove(0, 2);
                        }
                        if (changeToPL)
                        {
                            beam.Profile.ProfileString = "PL" + beam.Profile.ProfileString.ToString().Remove(0, 2);
                        }
                        if (changeToFladstal)
                        {
                            beam.Name = "Fladstål";
                        }
                        if (changeToF)
                        {
                            beam.AssemblyNumber.Prefix = "f";
                            beam.PartNumber.Prefix     = "F";
                        }
                        if (changeToPlade)
                        {
                            beam.Name = "Plade";
                        }
                        if (changeToC)
                        {
                            beam.AssemblyNumber.Prefix = "c";
                            beam.PartNumber.Prefix     = "C";
                        }

                        // add parts to the list of modified parts
                        if (changeToFL || changeToPL || changeToFladstal || changeToPlade || changeToC || changeToF)
                        {
                            partList.Add(beam);
                        }
                    }

                    ContourPlate plate = SelectedObjects.Current as ContourPlate;
                    if (plate != null)
                    {
                        if (changeToFL)
                        {
                            plate.Profile.ProfileString = "FL" + plate.Profile.ProfileString.ToString().Remove(0, 2);
                        }
                        if (changeToPL)
                        {
                            plate.Profile.ProfileString = "PL" + plate.Profile.ProfileString.ToString().Remove(0, 2);
                        }
                        if (changeToFladstal)
                        {
                            plate.Name = "Fladstål";
                        }
                        if (changeToF)
                        {
                            plate.AssemblyNumber.Prefix = "f";
                            plate.PartNumber.Prefix     = "F";
                        }
                        if (changeToPlade)
                        {
                            plate.Name = "Plade";
                        }
                        if (changeToC)
                        {
                            plate.AssemblyNumber.Prefix = "c";
                            plate.PartNumber.Prefix     = "C";
                        }

                        // add parts to the list of modified parts
                        if (changeToFL || changeToPL || changeToFladstal || changeToPlade)
                        {
                            partList.Add(plate);
                        }
                    }
                }
            }

            // select objects that are in list for modification
            Tekla.Structures.Model.UI.ModelObjectSelector mos = new Tekla.Structures.Model.UI.ModelObjectSelector();
            mos.Select(partList);

            // modified object count
            var modCount = 0;
            var errCount = 0;

            // exit if there is no parts to modify
            if (partList.Count != 0)
            {
                // confirm modification
                DialogResult dialogResult = MessageBox.Show(new Form {
                    TopMost = true
                }, "Selected objects will be modified.", Variables.caption, MessageBoxButtons.OKCancel);
                if (dialogResult == DialogResult.OK)
                {
                    // if OK, then go through list and modify each part
                    Tekla.Structures.Model.ModelObjectEnumerator selObjEnum = Model.GetModelObjectSelector().GetAllObjectsWithType(ModelObject.ModelObjectEnum.CONTOURPLATE);
                    selObjEnum = new Tekla.Structures.Model.UI.ModelObjectSelector().GetSelectedObjects();

                    // modify only objects that are in part list for modification and in current selection
                    while (selObjEnum.MoveNext())
                    {
                        foreach (var part in partList)
                        {
                            Beam beam = part as Beam;
                            if (beam != null && selObjEnum.Current.Identifier.ToString() == beam.Identifier.ToString())
                            {
                                if (!beam.Modify())
                                {
                                    errCount++;
                                }
                                else
                                {
                                    modCount++;
                                }
                            }

                            ContourPlate plate = part as ContourPlate;
                            if (plate != null && selObjEnum.Current.Identifier.ToString() == plate.Identifier.ToString())
                            {
                                if (!plate.Modify())
                                {
                                    errCount++;
                                }
                                else
                                {
                                    modCount++;
                                }
                            }
                        }
                    }
                    if (errCount != 0)
                    {
                        MessageBox.Show("Warning\n# of objects which didn't modify:\n" + errCount + "\n\n# of changed objects:\n" + modCount, Variables.caption);
                    }
                    else
                    {
                        MessageBox.Show("# of changed objects:\n" + modCount, Variables.caption);
                    }
                }
                else if (dialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }
            else
            {
                MessageBox.Show("No parts to modifiy found.", Variables.caption);
            }
        }