Пример #1
0
            public void GetProperties()
            {
                ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();

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

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

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

                            beam.Select();

                            Assembly assembly = beam.GetAssembly() as Tekla.Structures.Model.Assembly;
                            assembly.GetReportProperty("ASSEMBLY_POSITION_CODE", ref gridLocation);
                            partType = beam.GetType().Name;
                            partID   = beam.Identifier.ID.ToString();
                            beam.GetReportProperty("OWNER", ref owner);
                            zStart          = beam.StartPoint.Z.ToString("F02");
                            zEnd            = beam.EndPoint.Z.ToString("F02");
                            partPrefix      = beam.PartNumber.Prefix;
                            partStartNo     = beam.PartNumber.StartNumber.ToString();
                            assemblyPrefix  = beam.AssemblyNumber.Prefix;
                            assemblyStartNo = beam.AssemblyNumber.StartNumber.ToString();
                            Phase CurrentPhase = new Phase();
                            beam.GetPhase(out CurrentPhase);
                            phase      = CurrentPhase.PhaseNumber.ToString();
                            name       = beam.Name;
                            profile    = beam.Profile.ProfileString;
                            material   = beam.Material.MaterialString;
                            finish     = beam.Finish;
                            classValue = beam.Class;
                            if (beam.Position.Plane == Position.PlaneEnum.LEFT)
                            {
                                positionOnPlane = PositionPlaneEnum.Left;
                            }
                            else if (beam.Position.Plane == Position.PlaneEnum.MIDDLE)
                            {
                                positionOnPlane = PositionPlaneEnum.Middle;
                            }
                            else if (beam.Position.Plane == Position.PlaneEnum.RIGHT)
                            {
                                positionOnPlane = PositionPlaneEnum.Right;
                            }
                            positionOnPlaneOffset = beam.Position.PlaneOffset.ToString("F02");
                            if (beam.Position.Rotation == Position.RotationEnum.BACK)
                            {
                                positionRotation = PositionRotationEnum.Back;
                            }
                            else if (beam.Position.Rotation == Position.RotationEnum.BELOW)
                            {
                                positionRotation = PositionRotationEnum.Below;
                            }
                            else if (beam.Position.Rotation == Position.RotationEnum.FRONT)
                            {
                                positionRotation = PositionRotationEnum.Front;
                            }
                            else if (beam.Position.Rotation == Position.RotationEnum.TOP)
                            {
                                positionRotation = PositionRotationEnum.Top;
                            }
                            positionRotationOffset = beam.Position.RotationOffset.ToString("F02");
                            if (beam.Position.Depth == Position.DepthEnum.BEHIND)
                            {
                                positionAtDepth = PositionDepthEnum.Behind;
                            }
                            else if (beam.Position.Depth == Position.DepthEnum.FRONT)
                            {
                                positionAtDepth = PositionDepthEnum.Front;
                            }
                            else if (beam.Position.Depth == Position.DepthEnum.MIDDLE)
                            {
                                positionAtDepth = PositionDepthEnum.Middle;
                            }
                            positionAtDepthOffset = beam.Position.DepthOffset.ToString("F02");
                            offsetStartPointX     = beam.StartPointOffset.Dx.ToString("F02");
                            offsetStartPointY     = beam.StartPointOffset.Dy.ToString("F02");
                            offsetStartPointZ     = beam.StartPointOffset.Dz.ToString("F02");
                            offsetEndPointX       = beam.EndPointOffset.Dx.ToString("F02");
                            offsetEndPointY       = beam.EndPointOffset.Dy.ToString("F02");
                            offsetEndPointZ       = beam.EndPointOffset.Dz.ToString("F02");
                            beam.GetUserProperty("USER_FIELD_1", ref userfield1);
                            beam.GetUserProperty("USER_FIELD_2", ref userfield2);
                            beam.GetUserProperty("USER_FIELD_3", ref userfield3);
                            beam.GetUserProperty("USER_FIELD_4", ref userfield4);
                            beam.GetUserProperty("comment", ref notesComments);
                            beam.GetUserProperty("FIT_NOTES", ref fittingNotes);
                            beam.GetUserProperty("FIT_NOTES2", ref fittingNotes2);
                            beam.GetUserProperty("cambering", ref cambering);
                            beam.GetUserProperty("PAINT", ref paint);
                            beam.GetUserProperty("PRELIM_MARK", ref preliminaryMark);
                            beam.GetUserProperty("PAINT_WFT", ref paintWFT);
                            beam.GetUserProperty("PAINT_DFT", ref paintDFT);
                            double dblshear1  = 0; beam.GetUserProperty("shear1", ref dblshear1); dblshear1 = dblshear1 * 0.001; shearStart = dblshear1.ToString();
                            double dblshear2  = 0; beam.GetUserProperty("shear2", ref dblshear2); dblshear2 = dblshear2 * 0.001; shearEnd = dblshear2.ToString();
                            double dblaxial1  = 0; beam.GetUserProperty("axial1", ref dblaxial1); dblaxial1 = dblaxial1 * 0.001; axialStart = dblaxial1.ToString();
                            double dblaxial2  = 0; beam.GetUserProperty("axial2", ref dblaxial2); dblaxial2 = dblaxial2 * 0.001; axialEnd = dblaxial2.ToString();
                            double dblmoment1 = 0; beam.GetUserProperty("moment1", ref dblmoment1); dblmoment1 = dblmoment1 * 0.001; momentStart = dblmoment1.ToString();
                            double dblmoment2 = 0; beam.GetUserProperty("moment2", ref dblmoment2); dblmoment2 = dblmoment2 * 0.001; momentEnd = dblmoment2.ToString();

                            beam.GetUserProperty("CONN_CODE_END1", ref connCodeStart);
                            beam.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  = "";
                    offsetStartPointX      = "";
                    offsetStartPointY      = "";
                    offsetStartPointZ      = "";
                    offsetEndPointX        = "";
                    offsetEndPointY        = "";
                    offsetEndPointZ        = "";
                    zStart                 = "";
                    zEnd                   = "";
                }
            }