Exemplo n.º 1
0
        private List <Part> GetConnectedParts(BoltGroup boltGroup)
        {
            List <Part> partList = new List <Part>();

            if (boltGroup.PartToBoltTo != null)
            {
                Part partToBoltTo = boltGroup.PartToBoltTo;
                if (partToBoltTo != null && this.FilterProfile(partToBoltTo))
                {
                    partList.Add(partToBoltTo);
                }
                Part partToBeBolted = boltGroup.PartToBeBolted;
                if (partToBeBolted != null && this.FilterProfile(partToBeBolted))
                {
                    partList.Add(partToBeBolted);
                }
                ArrayList otherPartsToBolt = boltGroup.OtherPartsToBolt;
                if (otherPartsToBolt != null)
                {
                    foreach (Part part in otherPartsToBolt)
                    {
                        if (this.FilterProfile(part))
                        {
                            partList.Add(part);
                        }
                    }
                }
            }
            return(partList);
        }
Exemplo n.º 2
0
 public static dynamic GetTSObject(BoltGroup dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
        public void BoltGroupSingleLine0DegreesReturnsCValue()
        {
            BoltGroup bg              = new BoltGroup(4, 1, 0, 3);
            double    C               = bg.GetInstantaneousCenterCoefficient(8, 0);
            double    refValue        = 1.34; // from AISC Steel Manual
            double    actualTolerance = EvaluateActualTolerance(C, refValue);

            Assert.True(actualTolerance <= tolerance);
        }
Exemplo n.º 4
0
        public void BoltGroupTripleLine0DegreesReturnsCValue()
        {
            BoltGroup bg              = new BoltGroup(3, 3, 3, 3);
            double    C               = bg.GetInstantaneousCenterCoefficient(3, 0);
            double    refValue        = 5.79; // from AISC Steel Manual
            double    actualTolerance = EvaluateActualTolerance(C, refValue);

            Assert.LessOrEqual(actualTolerance, tolerance);
        }
Exemplo n.º 5
0
        public void BoltGroupElasticReturnsElasticMoment()
        {
            BoltGroup bg             = new BoltGroup(4, 2, 3, 3);
            double    C              = bg.CalculateElasticGroupMomentCoefficientC();
            double    boltStrength   = 4.39205;
            double    MomentCapacity = C * boltStrength;

            Assert.AreEqual(100.0, Math.Round(MomentCapacity));
        }
Exemplo n.º 6
0
        public void BoltGroup4X4NegativeEccentricitySameCValue()
        {
            BoltGroup bg              = new BoltGroup(2, 2, 3, 3);
            double    C               = bg.GetInstantaneousCenterCoefficient(-10, 0);
            double    refValue        = 0.78; // from AISC Steel Manual
            double    actualTolerance = EvaluateActualTolerance(C, refValue);

            Assert.LessOrEqual(actualTolerance, tolerance);
        }
Exemplo n.º 7
0
        public void BoltGroupSingleLine45DegreesReturnsC()
        {
            BoltGroup bg              = new BoltGroup(4, 1, 0, 3);
            double    C               = bg.GetInstantaneousCenterCoefficient(8, 45);
            double    refValue        = 1.64; // from AISC Steel Manual
            double    actualTolerance = EvaluateActualTolerance(C, refValue);

            Assert.LessOrEqual(actualTolerance, tolerance);
        }
Exemplo n.º 8
0
        public void BoltGroup3X2ReturnsC_primePureMomentValue()
        {
            BoltGroup bg              = new BoltGroup(3, 2, 3, 3);
            double    C_prime         = bg.GetPureMomentCoefficient();
            double    refValue        = 15.8; // from AISC Steel Manual
            double    actualTolerance = EvaluateActualTolerance(C_prime, refValue);

            Assert.LessOrEqual(actualTolerance, tolerance);
        }
        public void BoltGroup4X4ReturnsCValue()
        {
            BoltGroup bg              = new BoltGroup(2, 2, 3, 3);
            double    C               = bg.GetInstantaneousCenterCoefficient(10, 0);
            double    refValue        = 0.78; // from AISC Steel Manual
            double    actualTolerance = EvaluateActualTolerance(C, refValue);

            Assert.True(actualTolerance <= tolerance);
        }
Exemplo n.º 10
0
        private string SeparateBolt(BoltGroup boltGroup)
        {
            string      str            = "UNKNOWN";
            List <Part> connectedParts = this.GetConnectedParts(boltGroup);

            if (connectedParts == null || connectedParts.Count <= 0)
            {
                return(str);
            }
            return(this.CompareCoordinates(boltGroup, connectedParts) ? "FLANGEBOLT" : "WEBBOLT");
        }
Exemplo n.º 11
0
        private void connectParts()
        {
            List <BoltGroup> boltGroups = new List <BoltGroup>();

            Picker picker = new Picker();

            Tekla.Structures.Model.UI.ModelObjectSelector selector = new Tekla.Structures.Model.UI.ModelObjectSelector();
            ModelObjectEnumerator enumerator = selector.GetSelectedObjects();

            foreach (ModelObject modelObject in enumerator)
            {
                BoltGroup boltGroup = (BoltGroup)modelObject;
                boltGroups.Add(boltGroup);
            }

            foreach (BoltGroup group in boltGroups)
            {
                int partsBoltedBefore;
                int partsBoltedAfter;
                do
                {
                    Solid solid = group.GetSolid();
                    partsBoltedBefore = group.GetOtherPartsToBolt().Count;
                    Double boltLength   = 0.0;
                    Point  maximumPoint = solid.MaximumPoint;
                    Point  minimumPoint = solid.MinimumPoint;
                    Tekla.Structures.Model.ModelObjectSelector groupSelector = model.GetModelObjectSelector();
                    ModelObjectEnumerator collidingObjects = groupSelector.GetObjectsByBoundingBox(minimumPoint, maximumPoint);
                    while (collidingObjects.MoveNext())
                    {
                        Part part = collidingObjects.Current as Part;
                        if (part != null)
                        {
                            group.AddOtherPartToBolt(part);
                        }
                    }
                    group.BoltStandard = "4017-8.8";
                    group.Modify();
                    group.GetReportProperty("LENGTH", ref boltLength);
                    if (group.BoltStandard == "4017-8.8" && boltLength % 10 != 0)
                    {
                        group.BoltStandard = "4014-8.8";
                    }
                    group.Modify();
                    partsBoltedAfter = group.GetOtherPartsToBolt().Count;
                    group.CutLength  = boltLength + 20;
                } while (partsBoltedBefore != partsBoltedAfter);
            }
            model.CommitChanges();
        }
Exemplo n.º 12
0
        private bool CompareCoordinates(BoltGroup boltGroup, List <Part> connectedItems)
        {
            CoordinateSystem coordinateSystem = boltGroup.GetCoordinateSystem();
            Vector           Vector2          = coordinateSystem.AxisX.Cross(coordinateSystem.AxisY);
            bool             flag             = false;

            foreach (ModelObject connectedItem in connectedItems)
            {
                if (Geometry.VectorIsParallel(connectedItem.GetCoordinateSystem().AxisY, Vector2))
                {
                    flag = true;
                    return(flag);
                }
            }
            return(flag);
        }
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            Model model = new Model();
            ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetAllObjectsWithType(Tekla.Structures.Model.ModelObject.ModelObjectEnum.BOLT_ARRAY);

            while (modelObjectEnum.MoveNext())
            {
                if (modelObjectEnum.Current is BoltGroup)
                {
                    BoltGroup bolt = (BoltGroup)modelObjectEnum.Current;
                    if (bolt.BoltStandard == "7990")
                    {
                        bolt.BoltStandard = "8.8XOX";
                        bolt.Modify();
                    }
                }
            }
            model.CommitChanges();
            MessageBox.Show("Operation Finished");
        }
Exemplo n.º 14
0
        public static Dictionary <string, object> BoltGroupCoefficient(double N_rows, double N_cols, double p_h, double p_v, double e_group, double theta, string Code = "AISC360-10")
        {
            //Default values
            double C_BoltGroup = 0;
            double C_prime     = 0;

            //Calculation logic:
            int N_r = (int)N_rows;
            int N_c = (int)N_cols;

            BoltGroup bg = new BoltGroup(N_r, N_c, p_h, p_v);

            C_BoltGroup = bg.GetInstantaneousCenterCoefficient(e_group, theta);
            C_prime     = bg.GetPureMomentCoefficient();

            return(new Dictionary <string, object>
            {
                { "C_BoltGroup", C_BoltGroup },
                { "C_prime", C_prime }
            });
        }
Exemplo n.º 15
0
        private string CheckPart(int objectId)
        {
            string str = "UNKNOWN";

            try
            {
                if (this.model == null)
                {
                    this.model = new Tekla.Structures.Model.Model();
                }
                BoltGroup boltGroup = this.model.SelectModelObject(new Identifier(objectId)) as BoltGroup;
                if (boltGroup == null)
                {
                    return(str);
                }
                return(this.SeparateBolt(boltGroup));
            }
            catch (Exception ex)
            {
                return(str);
            }
        }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        public void Modify(PropertyValueChangedEventArgs e)
        {
            string label = e.ChangedItem.Label;

            ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();

            while (modelObjectEnum.MoveNext())
            {
                if (modelObjectEnum.Current is BoltGroup)
                {
                    BoltGroup bolt = (BoltGroup)modelObjectEnum.Current;

                    if (label == "BoltSize")
                    {
                        bolt.BoltSize = double.Parse(boltSize);
                    }
                    if (label == "BoltStandard")
                    {
                        bolt.BoltStandard = boltStandard;                          // list to sort
                    }
                    if (label == "BoltType")
                    {
                        if (boltType == BoltTypeEnum.Site)
                        {
                            bolt.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                        }
                        if (boltType == BoltTypeEnum.Workshop)
                        {
                            bolt.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_WORKSHOP;
                        }
                    }

                    if (label == "ThreadMaterial")
                    {
                        if (threadMaterial == ThreadMaterialEnum.No)
                        {
                            bolt.ThreadInMaterial = BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_NO;
                        }
                        if (threadMaterial == ThreadMaterialEnum.Yes)
                        {
                            bolt.ThreadInMaterial = BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_YES;
                        }
                    }

                    if (label == "CutLength")
                    {
                        bolt.CutLength = double.Parse(cutLength);
                    }
                    if (label == "ExtraLength")
                    {
                        bolt.ExtraLength = double.Parse(extraLength);
                    }
                    if (label == "BoltShaft")
                    {
                        bolt.Bolt = bool.Parse(boltShaft.ToString());
                    }
                    if (label == "Washer1")
                    {
                        bolt.Washer1 = bool.Parse(washer1.ToString());
                    }
                    if (label == "Washer2")
                    {
                        bolt.Washer2 = bool.Parse(washer2.ToString());
                    }
                    if (label == "Washer3")
                    {
                        bolt.Washer3 = bool.Parse(washer3.ToString());
                    }
                    if (label == "Nut1")
                    {
                        bolt.Nut1 = bool.Parse(nut1.ToString());
                    }
                    if (label == "Nut2")
                    {
                        bolt.Nut2 = bool.Parse(nut2.ToString());
                    }

                    if (label == "BoltDistX")
                    {
                        if (bolt is BoltArray)
                        {
                            BoltArray boltArray      = (BoltArray)bolt;
                            int       boltArrayCount = boltArray.GetBoltDistXCount();
                            for (int i = boltArrayCount - 1; i >= 0; i--)
                            {
                                boltArray.RemoveBoltDistX(i);
                                boltArray.Modify();
                            }
                            if (boltDistX != "")
                            {
                                string[] splitSpaces             = boltDistX.Split(new Char[] { ' ' });
                                System.Collections.ArrayList arr = new System.Collections.ArrayList();
                                foreach (string stringText in splitSpaces)
                                {
                                    if (stringText.Contains("*"))
                                    {
                                        string[] splitMultiplier = stringText.Split(new Char[] { '*' });
                                        for (int i = 0; i < int.Parse(splitMultiplier[0]); i++)
                                        {
                                            arr.Add(double.Parse(splitMultiplier[1].ToString()));
                                        }
                                    }
                                    else
                                    {
                                        arr.Add(double.Parse(stringText));
                                    }
                                }
                                for (int i = 0; i < arr.Count; i++)
                                {
                                    boltArray.SetBoltDistX(i, double.Parse(arr[i].ToString()));
                                }
                            }
                        }
                        else if (bolt is BoltXYList)
                        {
                            MessageBox.Show("Buggered");
                        }
                        else if (bolt is BoltCircle)
                        {
                            BoltCircle boltCircle = (BoltCircle)bolt;
                            boltCircle.NumberOfBolts = double.Parse(boltDistX);
                        }
                    }

                    if (label == "BoltDistY")
                    {
                        if (bolt is BoltArray)
                        {
                            BoltArray boltArray      = (BoltArray)bolt;
                            int       boltArrayCount = boltArray.GetBoltDistYCount();
                            for (int i = boltArrayCount - 1; i >= 0; i--)
                            {
                                boltArray.RemoveBoltDistY(i);
                                boltArray.Modify();
                            }
                            if (boltDistY != "")
                            {
                                string[] splitSpaces             = boltDistY.Split(new Char[] { ' ' });
                                System.Collections.ArrayList arr = new System.Collections.ArrayList();
                                foreach (string stringText in splitSpaces)
                                {
                                    if (stringText.Contains("*"))
                                    {
                                        string[] splitMultiplier = stringText.Split(new Char[] { '*' });
                                        for (int i = 0; i < int.Parse(splitMultiplier[0]); i++)
                                        {
                                            arr.Add(double.Parse(splitMultiplier[1].ToString()));
                                        }
                                    }
                                    else
                                    {
                                        arr.Add(double.Parse(stringText));
                                    }
                                }
                                for (int i = 0; i < arr.Count; i++)
                                {
                                    boltArray.SetBoltDistY(i, double.Parse(arr[i].ToString()));
                                }
                            }
                        }
                        else if (bolt is BoltXYList)
                        {
                            MessageBox.Show("Buggered");
                        }
                        else if (bolt is BoltCircle)
                        {
                            BoltCircle boltCircle = (BoltCircle)bolt;
                            boltCircle.Diameter = double.Parse(boltDistY);
                        }
                    }

                    if (label == "Tolerance")
                    {
                        bolt.Tolerance = double.Parse(tolerance);
                    }
                    if (label == "HoleType")
                    {
                        if (holeType == HoleTypeEnum.Slotted)
                        {
                            bolt.HoleType = BoltGroup.BoltHoleTypeEnum.HOLE_TYPE_SLOTTED;
                        }
                        if (holeType == HoleTypeEnum.Oversized)
                        {
                            bolt.HoleType = BoltGroup.BoltHoleTypeEnum.HOLE_TYPE_OVERSIZED;
                        }
                    }

                    if (label == "SlottedHoleX")
                    {
                        bolt.SlottedHoleX = double.Parse(slottedHoleX);
                    }
                    if (label == "SlottedHoleY")
                    {
                        bolt.SlottedHoleY = double.Parse(slottedHoleY);
                    }
                    if (label == "RotateSlots")
                    {
                        if (rotateSlots == RotateSlotEnum.Even)
                        {
                            bolt.RotateSlots = BoltGroup.BoltRotateSlotsEnum.ROTATE_SLOTS_EVEN;
                        }
                        if (rotateSlots == RotateSlotEnum.Odd)
                        {
                            bolt.RotateSlots = BoltGroup.BoltRotateSlotsEnum.ROTATE_SLOTS_ODD;
                        }
                        if (rotateSlots == RotateSlotEnum.Parallel)
                        {
                            bolt.RotateSlots = BoltGroup.BoltRotateSlotsEnum.ROTATE_SLOTS_PARALLEL;
                        }
                    }

                    if (label == "Hole1")
                    {
                        bolt.Hole1 = bool.Parse(hole1.ToString());
                    }
                    if (label == "Hole2")
                    {
                        bolt.Hole2 = bool.Parse(hole2.ToString());
                    }
                    if (label == "Hole3")
                    {
                        bolt.Hole3 = bool.Parse(hole3.ToString());
                    }
                    if (label == "Hole4")
                    {
                        bolt.Hole4 = bool.Parse(hole4.ToString());
                    }
                    if (label == "Hole5")
                    {
                        bolt.Hole5 = bool.Parse(hole5.ToString());
                    }
                    if (label == "OffsetFromStartX")
                    {
                        bolt.StartPointOffset.Dx = double.Parse(offsetFromStartX);
                    }
                    if (label == "OffsetFromStartY")
                    {
                        bolt.StartPointOffset.Dy = double.Parse(offsetFromStartY);
                    }
                    if (label == "OffsetFromStartZ")
                    {
                        bolt.StartPointOffset.Dz = double.Parse(offsetFromStartZ);
                    }
                    if (label == "OffsetFromEndX")
                    {
                        bolt.EndPointOffset.Dx = double.Parse(offsetFromEndX);
                    }
                    if (label == "OffsetFromEndY")
                    {
                        bolt.EndPointOffset.Dy = double.Parse(offsetFromEndY);
                    }
                    if (label == "OffsetFromEndZ")
                    {
                        bolt.EndPointOffset.Dz = double.Parse(offsetFromEndZ);
                    }
                    if (label == "PositionOnPlaneOffset")
                    {
                        bolt.Position.PlaneOffset = double.Parse(positionOnPlaneOffset);
                    }
                    if (label == "PositionRotation")
                    {
                        if (positionRotation == PositionRotationEnum.Back)
                        {
                            bolt.Position.Rotation = Position.RotationEnum.BACK;
                        }
                        if (positionRotation == PositionRotationEnum.Below)
                        {
                            bolt.Position.Rotation = Position.RotationEnum.BELOW;
                        }
                        if (positionRotation == PositionRotationEnum.Front)
                        {
                            bolt.Position.Rotation = Position.RotationEnum.FRONT;
                        }
                        if (positionRotation == PositionRotationEnum.Top)
                        {
                            bolt.Position.Rotation = Position.RotationEnum.TOP;
                        }
                    }

                    if (label == "PositionRotationOffset")
                    {
                        bolt.Position.RotationOffset = double.Parse(positionRotationOffset);
                    }
                    if (label == "At Depth Offset")
                    {
                        bolt.Position.DepthOffset = double.Parse(positionAtDepthOffset);
                    }

                    bolt.Modify();
                }
            }
        }
Exemplo n.º 18
0
        public void GetProperties()
        {
            ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();

            if (modelObjectEnum.GetSize() == 1)
            {
                while (modelObjectEnum.MoveNext())
                {
                    if (modelObjectEnum.Current is Tekla.Structures.Model.BoltGroup)
                    {
                        BoltGroup boltGroup = (BoltGroup)modelObjectEnum.Current;
                        boltSize     = boltGroup.BoltSize.ToString();
                        boltStandard = boltGroup.BoltStandard.ToString();
                        if (boltGroup.BoltType == BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE)
                        {
                            boltType = BoltTypeEnum.Site;
                        }
                        else if (boltGroup.BoltType == BoltGroup.BoltTypeEnum.BOLT_TYPE_WORKSHOP)
                        {
                            boltType = BoltTypeEnum.Workshop;
                        }

                        if (boltGroup.ThreadInMaterial == BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_YES)
                        {
                            threadMaterial = ThreadMaterialEnum.Yes;
                        }
                        else if (boltGroup.ThreadInMaterial == BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_NO)
                        {
                            threadMaterial = ThreadMaterialEnum.No;
                        }

                        cutLength      = boltGroup.CutLength.ToString();
                        extraLength    = boltGroup.ExtraLength.ToString();
                        boltGroupShape = boltGroup.GetType().Name;

                        if (boltGroup is BoltArray)
                        {
                            BoltArray boltArray = (BoltArray)boltGroup;

                            string boltPositionX = "";
                            for (int i = 0; i < boltArray.GetBoltDistXCount(); i++)
                            {
                                boltPositionX = boltPositionX + boltArray.GetBoltDistX(i).ToString() + " ";
                            }
                            boltDistX = boltPositionX.Trim();

                            string boltPositionY = "";
                            for (int i = 0; i < boltArray.GetBoltDistYCount(); i++)
                            {
                                boltPositionY = boltPositionY + boltArray.GetBoltDistY(i).ToString() + " ";
                            }
                            boltDistY = boltPositionY.Trim();
                        }
                        else if (boltGroup is BoltXYList)
                        {
                            BoltXYList boltXYList = (BoltXYList)boltGroup;

                            string boltPositionX = "";
                            for (int i = 0; i < boltXYList.GetBoltDistXCount(); i++)
                            {
                                boltPositionX = boltPositionX + boltXYList.GetBoltDistX(i).ToString() + " ";
                            }
                            boltDistX = boltPositionX.Trim();

                            string boltPositionY = "";
                            for (int i = 0; i < boltXYList.GetBoltDistYCount(); i++)
                            {
                                boltPositionY = boltPositionY + boltXYList.GetBoltDistY(i).ToString() + " ";
                            }
                            boltDistY = boltPositionY.Trim();
                        }
                        else if (boltGroup is BoltCircle)
                        {
                            BoltCircle boltCircle = (BoltCircle)boltGroup;
                            boltDistX = boltCircle.NumberOfBolts.ToString();
                            boltDistY = boltCircle.Diameter.ToString();
                        }

                        tolerance = boltGroup.Tolerance.ToString();

                        if (boltGroup.HoleType == BoltGroup.BoltHoleTypeEnum.HOLE_TYPE_SLOTTED)
                        {
                            holeType = HoleTypeEnum.Slotted;
                        }
                        else if (boltGroup.HoleType == BoltGroup.BoltHoleTypeEnum.HOLE_TYPE_OVERSIZED)
                        {
                            holeType = HoleTypeEnum.Oversized;
                        }

                        slottedHoleX = boltGroup.SlottedHoleX.ToString();
                        slottedHoleY = boltGroup.SlottedHoleY.ToString();

                        if (boltGroup.RotateSlots == BoltGroup.BoltRotateSlotsEnum.ROTATE_SLOTS_ODD)
                        {
                            rotateSlots = RotateSlotEnum.Odd;
                        }
                        else if (boltGroup.RotateSlots == BoltGroup.BoltRotateSlotsEnum.ROTATE_SLOTS_EVEN)
                        {
                            rotateSlots = RotateSlotEnum.Even;
                        }
                        else if (boltGroup.RotateSlots == BoltGroup.BoltRotateSlotsEnum.ROTATE_SLOTS_PARALLEL)
                        {
                            rotateSlots = RotateSlotEnum.Parallel;
                        }

                        if (boltGroup.Position.Plane == Position.PlaneEnum.LEFT)
                        {
                            positionOnPlane = PositionPlaneEnum.Left;
                        }
                        else if (boltGroup.Position.Plane == Position.PlaneEnum.MIDDLE)
                        {
                            positionOnPlane = PositionPlaneEnum.Middle;
                        }
                        else if (boltGroup.Position.Plane == Position.PlaneEnum.RIGHT)
                        {
                            positionOnPlane = PositionPlaneEnum.Right;
                        }
                        positionOnPlaneOffset = boltGroup.Position.PlaneOffset.ToString("F02");

                        if (boltGroup.Position.Rotation == Position.RotationEnum.FRONT)
                        {
                            positionRotation = PositionRotationEnum.Front;
                        }
                        else if (boltGroup.Position.Rotation == Position.RotationEnum.TOP)
                        {
                            positionRotation = PositionRotationEnum.Top;
                        }
                        else if (boltGroup.Position.Rotation == Position.RotationEnum.BACK)
                        {
                            positionRotation = PositionRotationEnum.Back;
                        }
                        else if (boltGroup.Position.Rotation == Position.RotationEnum.BELOW)
                        {
                            positionRotation = PositionRotationEnum.Below;
                        }
                        positionRotationOffset = boltGroup.Position.RotationOffset.ToString("F02");

                        if (boltGroup.Position.Depth == Position.DepthEnum.BEHIND)
                        {
                            positionAtDepth = PositionDepthEnum.Behind;
                        }
                        else if (boltGroup.Position.Depth == Position.DepthEnum.FRONT)
                        {
                            positionAtDepth = PositionDepthEnum.Front;
                        }
                        else if (boltGroup.Position.Depth == Position.DepthEnum.MIDDLE)
                        {
                            positionAtDepth = PositionDepthEnum.Middle;
                        }
                        positionAtDepthOffset = boltGroup.Position.DepthOffset.ToString("F02");
                        offsetFromStartX      = boltGroup.StartPointOffset.Dx.ToString("F02");
                        offsetFromStartY      = boltGroup.StartPointOffset.Dy.ToString("F02");
                        offsetFromStartZ      = boltGroup.StartPointOffset.Dz.ToString("F02");
                        offsetFromEndX        = boltGroup.EndPointOffset.Dx.ToString("F02");
                        offsetFromEndY        = boltGroup.EndPointOffset.Dy.ToString("F02");
                        offsetFromEndZ        = boltGroup.EndPointOffset.Dz.ToString("F02");

                        if (boltGroup.Hole1)
                        {
                            hole1 = Bool.True;
                        }
                        else
                        {
                            hole1 = Bool.False;
                        }
                        if (boltGroup.Hole2)
                        {
                            hole2 = Bool.True;
                        }
                        else
                        {
                            hole2 = Bool.False;
                        }
                        if (boltGroup.Hole3)
                        {
                            hole3 = Bool.True;
                        }
                        else
                        {
                            hole3 = Bool.False;
                        }
                        if (boltGroup.Hole4)
                        {
                            hole4 = Bool.True;
                        }
                        else
                        {
                            hole4 = Bool.False;
                        }
                        if (boltGroup.Hole5)
                        {
                            hole5 = Bool.True;
                        }
                        else
                        {
                            hole5 = Bool.False;
                        }

                        if (boltGroup.Washer1)
                        {
                            washer1 = Bool.True;
                        }
                        else
                        {
                            washer1 = Bool.False;
                        }
                        if (boltGroup.Washer2)
                        {
                            washer2 = Bool.True;
                        }
                        else
                        {
                            washer2 = Bool.False;
                        }
                        if (boltGroup.Washer3)
                        {
                            washer3 = Bool.True;
                        }
                        else
                        {
                            washer3 = Bool.False;
                        }

                        if (boltGroup.Nut1)
                        {
                            nut1 = Bool.True;
                        }
                        else
                        {
                            nut1 = Bool.False;
                        }
                        if (boltGroup.Nut2)
                        {
                            nut2 = Bool.True;
                        }
                        else
                        {
                            nut2 = Bool.False;
                        }

                        if (boltGroup.Bolt)
                        {
                            boltShaft = Bool.True;
                        }
                        else
                        {
                            boltShaft = Bool.False;
                        }
                    }
                }
            }
            if (modelObjectEnum.GetSize() > 1)
            {
                boltSize               = "";
                boltStandard           = "";
                boltType               = new BoltTypeEnum();
                threadMaterial         = new ThreadMaterialEnum();
                cutLength              = "";
                extraLength            = "";
                boltGroupShape         = "";
                boltDistX              = "";
                boltDistY              = "";
                tolerance              = "";
                slottedHoleX           = "";
                slottedHoleY           = "";
                rotateSlots            = new RotateSlotEnum();
                holeType               = new HoleTypeEnum();
                positionOnPlane        = new PositionPlaneEnum();
                positionOnPlaneOffset  = "";
                positionRotation       = new PositionRotationEnum();
                positionRotationOffset = "";
                positionAtDepth        = new PositionDepthEnum();
                positionAtDepthOffset  = "";
                offsetFromStartX       = "";
                offsetFromStartY       = "";
                offsetFromStartZ       = "";
                offsetFromEndX         = "";
                offsetFromEndY         = "";
                offsetFromEndZ         = "";
                hole1     = new Bool();
                hole2     = new Bool();
                hole3     = new Bool();
                hole4     = new Bool();
                hole5     = new Bool();
                boltShaft = new Bool();
                washer1   = new Bool();
                washer2   = new Bool();
                washer3   = new Bool();
                nut1      = new Bool();
                nut2      = new Bool();
            }
        }