コード例 #1
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();
            }
        }
コード例 #2
0
ファイル: ModelBolt.cs プロジェクト: lijuncq/Tekla-Properties
        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();
            }
        }
コード例 #3
0
ファイル: ModelPart.cs プロジェクト: lijuncq/Tekla-Properties
            public void GetProperties()
            {
                ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();

                if (modelObjectEnum.GetSize() == 1)
                {
                    while (modelObjectEnum.MoveNext())
                    {
                        if (modelObjectEnum.Current is Tekla.Structures.Model.ContourPlate)
                        {
                            Tekla.Structures.Model.ContourPlate contourPlate = (Tekla.Structures.Model.ContourPlate)modelObjectEnum.Current;

                            TransformationPlane currentTP = new TransformationPlane();
                            currentTP = model.GetWorkPlaneHandler().GetCurrentTransformationPlane();

                            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());

                            contourPlate.Select();

                            Assembly assembly = contourPlate.GetAssembly() as Tekla.Structures.Model.Assembly;
                            assembly.GetReportProperty("ASSEMBLY_POSITION_CODE", ref gridLocation);
                            partType = contourPlate.GetType().Name;
                            partID   = contourPlate.Identifier.ID.ToString();
                            contourPlate.GetReportProperty("OWNER", ref owner);
                            partPrefix      = contourPlate.PartNumber.Prefix;
                            partStartNo     = contourPlate.PartNumber.StartNumber.ToString();
                            assemblyPrefix  = contourPlate.AssemblyNumber.Prefix;
                            assemblyStartNo = contourPlate.AssemblyNumber.StartNumber.ToString();
                            Phase CurrentPhase = new Phase();
                            contourPlate.GetPhase(out CurrentPhase);
                            phase      = CurrentPhase.PhaseNumber.ToString();
                            name       = contourPlate.Name;
                            profile    = contourPlate.Profile.ProfileString;
                            material   = contourPlate.Material.MaterialString;
                            finish     = contourPlate.Finish;
                            classValue = contourPlate.Class;

                            if (contourPlate.Position.Plane == Position.PlaneEnum.LEFT)
                            {
                                positionOnPlane = PositionPlaneEnum.Left;
                            }
                            else if (contourPlate.Position.Plane == Position.PlaneEnum.MIDDLE)
                            {
                                positionOnPlane = PositionPlaneEnum.Middle;
                            }
                            else if (contourPlate.Position.Plane == Position.PlaneEnum.RIGHT)
                            {
                                positionOnPlane = PositionPlaneEnum.Right;
                            }

                            positionOnPlaneOffset = contourPlate.Position.PlaneOffset.ToString("F02");

                            if (contourPlate.Position.Rotation == Position.RotationEnum.BACK)
                            {
                                positionRotation = PositionRotationEnum.Back;
                            }
                            else if (contourPlate.Position.Rotation == Position.RotationEnum.BELOW)
                            {
                                positionRotation = PositionRotationEnum.Below;
                            }
                            else if (contourPlate.Position.Rotation == Position.RotationEnum.FRONT)
                            {
                                positionRotation = PositionRotationEnum.Front;
                            }
                            else if (contourPlate.Position.Rotation == Position.RotationEnum.TOP)
                            {
                                positionRotation = PositionRotationEnum.Top;
                            }

                            positionRotationOffset = contourPlate.Position.RotationOffset.ToString("F02");

                            if (contourPlate.Position.Depth == Position.DepthEnum.BEHIND)
                            {
                                positionAtDepth = PositionDepthEnum.Behind;
                            }
                            else if (contourPlate.Position.Depth == Position.DepthEnum.FRONT)
                            {
                                positionAtDepth = PositionDepthEnum.Front;
                            }
                            else if (contourPlate.Position.Depth == Position.DepthEnum.MIDDLE)
                            {
                                positionAtDepth = PositionDepthEnum.Middle;
                            }

                            positionAtDepthOffset = contourPlate.Position.DepthOffset.ToString("F02");
                            contourPlate.GetUserProperty("USER_FIELD_1", ref userfield1);
                            contourPlate.GetUserProperty("USER_FIELD_2", ref userfield2);
                            contourPlate.GetUserProperty("USER_FIELD_3", ref userfield3);
                            contourPlate.GetUserProperty("USER_FIELD_4", ref userfield4);
                            contourPlate.GetUserProperty("comment", ref notesComments);
                            contourPlate.GetUserProperty("FIT_NOTES", ref fittingNotes);
                            contourPlate.GetUserProperty("FIT_NOTES2", ref fittingNotes2);
                            contourPlate.GetUserProperty("cambering", ref cambering);
                            contourPlate.GetUserProperty("PAINT", ref paint);
                            contourPlate.GetUserProperty("PRELIM_MARK", ref preliminaryMark);
                            contourPlate.GetUserProperty("PAINT_WFT", ref paintWFT);
                            contourPlate.GetUserProperty("PAINT_DFT", ref paintDFT);
                            double dblshear1  = 0; contourPlate.GetUserProperty("shear1", ref dblshear1); dblshear1 = dblshear1 * 0.001; shearStart = dblshear1.ToString();
                            double dblshear2  = 0; contourPlate.GetUserProperty("shear2", ref dblshear2); dblshear2 = dblshear2 * 0.001; shearEnd = dblshear2.ToString();
                            double dblaxial1  = 0; contourPlate.GetUserProperty("axial1", ref dblaxial1); dblaxial1 = dblaxial1 * 0.001; axialStart = dblaxial1.ToString();
                            double dblaxial2  = 0; contourPlate.GetUserProperty("axial2", ref dblaxial2); dblaxial2 = dblaxial2 * 0.001; axialEnd = dblaxial2.ToString();
                            double dblmoment1 = 0; contourPlate.GetUserProperty("moment1", ref dblmoment1); dblmoment1 = dblmoment1 * 0.001; momentStart = dblmoment1.ToString();
                            double dblmoment2 = 0; contourPlate.GetUserProperty("moment2", ref dblmoment2); dblmoment2 = dblmoment2 * 0.001; momentEnd = dblmoment2.ToString();

                            contourPlate.GetUserProperty("CONN_CODE_END1", ref connCodeStart);
                            contourPlate.GetUserProperty("CONN_CODE_END2", ref connCodeEnd);
                            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentTP);
                        }
                    }
                }
                if (modelObjectEnum.GetSize() > 1)
                {
                    partType               = "";
                    partID                 = "";
                    owner                  = "";
                    gridLocation           = "";
                    partPrefix             = "";
                    partStartNo            = "";
                    assemblyPrefix         = "";
                    assemblyStartNo        = "";
                    phase                  = "";
                    name                   = "";
                    profile                = "";
                    material               = "";
                    finish                 = "";
                    classValue             = "";
                    userfield1             = "";
                    userfield2             = "";
                    userfield3             = "";
                    userfield4             = "";
                    notesComments          = "";
                    fittingNotes           = "";
                    fittingNotes2          = "";
                    cambering              = "";
                    paint                  = "";
                    preliminaryMark        = "";
                    paintWFT               = "";
                    paintDFT               = "";
                    shearStart             = "";
                    shearEnd               = "";
                    axialStart             = "";
                    axialEnd               = "";
                    momentStart            = "";
                    momentEnd              = "";
                    connCodeStart          = "";
                    connCodeEnd            = "";
                    positionOnPlane        = new PositionPlaneEnum();
                    positionOnPlaneOffset  = "";
                    positionRotation       = new PositionRotationEnum();
                    positionRotationOffset = "";
                    positionAtDepth        = new PositionDepthEnum();
                    positionAtDepthOffset  = "";
                }
            }
コード例 #4
0
            public void GetProperties()
            {
                ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();
                if (modelObjectEnum.GetSize() == 1)
                {
                    while (modelObjectEnum.MoveNext())
                    {
                        if (modelObjectEnum.Current is Tekla.Structures.Model.ContourPlate)
                        {
                            Tekla.Structures.Model.ContourPlate contourPlate = (Tekla.Structures.Model.ContourPlate)modelObjectEnum.Current;

                            TransformationPlane currentTP = new TransformationPlane();
                            currentTP = model.GetWorkPlaneHandler().GetCurrentTransformationPlane();

                            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());

                            contourPlate.Select();

                            Assembly assembly = contourPlate.GetAssembly() as Tekla.Structures.Model.Assembly;
                            assembly.GetReportProperty("ASSEMBLY_POSITION_CODE", ref gridLocation);
                            partType = contourPlate.GetType().Name;
                            partID = contourPlate.Identifier.ID.ToString();
                            contourPlate.GetReportProperty("OWNER", ref owner);
                            partPrefix = contourPlate.PartNumber.Prefix;
                            partStartNo = contourPlate.PartNumber.StartNumber.ToString();
                            assemblyPrefix = contourPlate.AssemblyNumber.Prefix;
                            assemblyStartNo = contourPlate.AssemblyNumber.StartNumber.ToString();
                            Phase CurrentPhase = new Phase();
                            contourPlate.GetPhase(out CurrentPhase);
                            phase = CurrentPhase.PhaseNumber.ToString();
                            name = contourPlate.Name;
                            profile = contourPlate.Profile.ProfileString;
                            material = contourPlate.Material.MaterialString;
                            finish = contourPlate.Finish;
                            classValue = contourPlate.Class;

                            if (contourPlate.Position.Plane == Position.PlaneEnum.LEFT) positionOnPlane = PositionPlaneEnum.Left;
                            else if (contourPlate.Position.Plane == Position.PlaneEnum.MIDDLE) positionOnPlane = PositionPlaneEnum.Middle;
                            else if (contourPlate.Position.Plane == Position.PlaneEnum.RIGHT) positionOnPlane = PositionPlaneEnum.Right;

                            positionOnPlaneOffset = contourPlate.Position.PlaneOffset.ToString("F02");

                            if (contourPlate.Position.Rotation == Position.RotationEnum.BACK) positionRotation = PositionRotationEnum.Back;
                            else if (contourPlate.Position.Rotation == Position.RotationEnum.BELOW) positionRotation = PositionRotationEnum.Below;
                            else if (contourPlate.Position.Rotation == Position.RotationEnum.FRONT) positionRotation = PositionRotationEnum.Front;
                            else if (contourPlate.Position.Rotation == Position.RotationEnum.TOP) positionRotation = PositionRotationEnum.Top;

                            positionRotationOffset = contourPlate.Position.RotationOffset.ToString("F02");

                            if (contourPlate.Position.Depth == Position.DepthEnum.BEHIND) positionAtDepth = PositionDepthEnum.Behind;
                            else if (contourPlate.Position.Depth == Position.DepthEnum.FRONT) positionAtDepth = PositionDepthEnum.Front;
                            else if (contourPlate.Position.Depth == Position.DepthEnum.MIDDLE) positionAtDepth = PositionDepthEnum.Middle;

                            positionAtDepthOffset = contourPlate.Position.DepthOffset.ToString("F02");
                            contourPlate.GetUserProperty("USER_FIELD_1", ref userfield1);
                            contourPlate.GetUserProperty("USER_FIELD_2", ref userfield2);
                            contourPlate.GetUserProperty("USER_FIELD_3", ref userfield3);
                            contourPlate.GetUserProperty("USER_FIELD_4", ref userfield4);
                            contourPlate.GetUserProperty("comment", ref notesComments);
                            contourPlate.GetUserProperty("FIT_NOTES", ref fittingNotes);
                            contourPlate.GetUserProperty("FIT_NOTES2", ref fittingNotes2);
                            contourPlate.GetUserProperty("cambering", ref cambering);
                            contourPlate.GetUserProperty("PAINT", ref paint);
                            contourPlate.GetUserProperty("PRELIM_MARK", ref preliminaryMark);
                            contourPlate.GetUserProperty("PAINT_WFT", ref paintWFT);
                            contourPlate.GetUserProperty("PAINT_DFT", ref paintDFT);
                            double dblshear1 = 0; contourPlate.GetUserProperty("shear1", ref dblshear1); dblshear1 = dblshear1 * 0.001; shearStart = dblshear1.ToString();
                            double dblshear2 = 0; contourPlate.GetUserProperty("shear2", ref dblshear2); dblshear2 = dblshear2 * 0.001; shearEnd = dblshear2.ToString();
                            double dblaxial1 = 0; contourPlate.GetUserProperty("axial1", ref dblaxial1); dblaxial1 = dblaxial1 * 0.001; axialStart = dblaxial1.ToString();
                            double dblaxial2 = 0; contourPlate.GetUserProperty("axial2", ref dblaxial2); dblaxial2 = dblaxial2 * 0.001; axialEnd = dblaxial2.ToString();
                            double dblmoment1 = 0; contourPlate.GetUserProperty("moment1", ref dblmoment1); dblmoment1 = dblmoment1 * 0.001; momentStart = dblmoment1.ToString();
                            double dblmoment2 = 0; contourPlate.GetUserProperty("moment2", ref dblmoment2); dblmoment2 = dblmoment2 * 0.001; momentEnd = dblmoment2.ToString();

                            contourPlate.GetUserProperty("CONN_CODE_END1", ref connCodeStart);
                            contourPlate.GetUserProperty("CONN_CODE_END2", ref connCodeEnd);
                            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentTP);
                        }
                    }
                }
                if (modelObjectEnum.GetSize() > 1)
                {
                    partType = "";
                    partID = "";
                    owner = "";
                    gridLocation = "";
                    partPrefix = "";
                    partStartNo = "";
                    assemblyPrefix = "";
                    assemblyStartNo = "";
                    phase = "";
                    name = "";
                    profile = "";
                    material = "";
                    finish = "";
                    classValue = "";
                    userfield1 = "";
                    userfield2 = "";
                    userfield3 = "";
                    userfield4 = "";
                    notesComments = "";
                    fittingNotes = "";
                    fittingNotes2 = "";
                    cambering = "";
                    paint = "";
                    preliminaryMark = "";
                    paintWFT = "";
                    paintDFT = "";
                    shearStart = "";
                    shearEnd = "";
                    axialStart = "";
                    axialEnd = "";
                    momentStart = "";
                    momentEnd = "";
                    connCodeStart = "";
                    connCodeEnd = "";
                    positionOnPlane = new PositionPlaneEnum();
                    positionOnPlaneOffset = "";
                    positionRotation = new PositionRotationEnum();
                    positionRotationOffset = "";
                    positionAtDepth = new PositionDepthEnum();
                    positionAtDepthOffset = "";
                }
            }