public static bool main(TSD.Drawing drawing)
        {
            bool drawingStatus = true;

            TSM.Model _myModel = new TSM.Model();

            if (drawing is TSD.GADrawing)
            {
                drawingStatus = checkDrawing(UserSettings_UDA._GA_drawingProperties, drawing as TSD.GADrawing);
            }
            else if (drawing is TSD.CastUnitDrawing)
            {
                TSD.CastUnitDrawing cu = drawing as TSD.CastUnitDrawing;
                TSM.Assembly        currentAssembly = _myModel.SelectModelObject(cu.CastUnitIdentifier) as TSM.Assembly;
                TSM.Part            currentMainPart = currentAssembly.GetMainPart() as TSM.Part;

                drawingStatus = checkDrawing(UserSettings_UDA._CU_drawingProperties, cu);
                if (drawingStatus)
                {
                    drawingStatus = checkPart(UserSettings_UDA._CU_partProperties, currentMainPart, cu);
                }
            }
            else if (drawing is TSD.AssemblyDrawing)
            {
                TSD.AssemblyDrawing asd             = drawing as TSD.AssemblyDrawing;
                TSM.Assembly        currentAssembly = _myModel.SelectModelObject(asd.AssemblyIdentifier) as TSM.Assembly;
                TSM.Part            currentMainPart = currentAssembly.GetMainPart() as TSM.Part;

                drawingStatus = checkDrawing(UserSettings_UDA._A_drawingProperties, asd);
                if (drawingStatus)
                {
                    drawingStatus = checkPart(UserSettings_UDA._A_partProperties, currentMainPart, asd);
                }
            }
            else if (drawing is TSD.SinglePartDrawing)
            {
                TSD.SinglePartDrawing sp = drawing as TSD.SinglePartDrawing;
                TSM.Part currentPart     = _myModel.SelectModelObject(sp.PartIdentifier) as TSM.Part;

                drawingStatus = checkDrawing(UserSettings_UDA._SP_drawingProperties, sp);
                if (drawingStatus)
                {
                    drawingStatus = checkPart(UserSettings_UDA._SP_partProperties, currentPart, sp);
                }
            }

            return(drawingStatus);
        }
示例#2
0
        public override bool Run(List <InputDefinition> input)
        {
            try
            {
                Tekla.Structures.Identifier  id    = (Tekla.Structures.Identifier)(input[0]).GetInput();
                Tekla.Structures.Model.Model model = new TSM.Model();
                TSM.Beam beam = (TSM.Beam)model.SelectModelObject(id);

                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TSM.TransformationPlane());
                TSM.TransformationPlane currentTP       = model.GetWorkPlaneHandler().GetCurrentTransformationPlane();
                CoordinateSystem        coordenadasMuro = beam.GetCoordinateSystem();
                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TSM.TransformationPlane(coordenadasMuro));

                ParametrosPanel p = new ParametrosPanel(beam);
                p.dx                 = data.dx;
                p.dy                 = data.dy;
                p.diametroBarras     = data.diametroBarras;
                p.diametroDiagonal   = data.diametroDiagonales;
                p.adicionalDerecha   = data.largoDerecha;
                p.adicionalIzquierda = data.largoIzquierda;
                p.adicionalSuperior  = data.largoSuperior;
                p.adicionalInferior  = data.largoInferior;

                PanelMoldar panel = new PanelMoldar(p);
                panel.fabricar();

                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentTP);
            }
            catch (Exception ex)
            {
                ErrorDialog.Show("Exception", ex.Message, ErrorDialog.Severity.ERROR);
            }

            return(true);
        }
示例#3
0
 private string getPhaseNameFromReinforcement(ReinforcementBase drawingObject)
 {
     TSDrg.ReinforcementBase dwgRebar = drawingObject as TSDrg.ReinforcementBase;
     TSM.Model       MyModel          = new TSM.Model();
     TSM.ModelObject modelRebar       = MyModel.SelectModelObject(dwgRebar.ModelIdentifier);
     TSM.Phase       rebarPhase       = new TSM.Phase();
     modelRebar.GetPhase(out rebarPhase);
     return(rebarPhase.PhaseName);
 }
示例#4
0
        private List <string> readBarInformation(ReinforcementBase dwgRebar)
        {
            List <string> info = new List <string>();

            TSM.Model       MyModel    = new TSM.Model();
            TSM.ModelObject modelRebar = MyModel.SelectModelObject(dwgRebar.ModelIdentifier);
            TSM.Phase       rebarPhase = new TSM.Phase();
            modelRebar.GetPhase(out rebarPhase);
            info.Add(rebarPhase.PhaseName);
            string shapeCode   = null;
            bool   gotProperty = modelRebar.GetReportProperty("REBAR_POS", ref shapeCode);

            info.Add(shapeCode);
            return(info);
        }
示例#5
0
 public void HighlightElements(Dictionary<string, Elm> els, int color = 1)
 {
     DateTime t0 = DateTime.Now;
     Log.set("TS_OpenAPI.HighLightElements");
     colorObjects = new List<TSM.ModelObject>();
     foreach (var elm in els)
     {
         Identifier id = new Identifier(elm.Key);
         var obj = model.SelectModelObject(id);
         colorObjects.Add(obj);
     }
     DateTime t1 = DateTime.Now;
     var _color = new Color(0.0, 0.0, 1.0);
     ModelObjectVisualization.SetTransparencyForAll(TemporaryTransparency.SEMITRANSPARENT);
     ModelObjectVisualization.SetTemporaryState(colorObjects, _color);
     DateTime t2 = DateTime.Now;
     string timing = string.Format("=== HighLight fill colorObject t={0}, Tekla t={1}", t1 - t0, t2 - t1);
     Log.exit();
 }
示例#6
0
 private TSM.ModelObject GetModelObjectFromDrawingModelObject(TSM.Model myModel, ModelObject partOfMark)
 {
     TSM.ModelObject modelObject = myModel.SelectModelObject(partOfMark.ModelIdentifier);
     TSM.Part        modelPart   = (TSM.Part)modelObject;
     return(modelPart);
 }
        public override bool Run(List <InputDefinition> Input)
        {
            // Fields for Run method
            List <T3D.Point> firstAnglePoints;
            List <T3D.Point> secondAnglePoints;
            List <T3D.Point> thirdAnglePoints;
            List <T3D.Point> fourthAnglePoints;
            List <T3D.Point> offsetPoints;
            double           angleOnPlaneOffset;
            double           distanceToCenter;

            try
            {
                // Get T3D Points from Input
                T3D.Point firstPoint  = (T3D.Point)Input.ElementAt(0).GetInput();
                T3D.Point secondPoint = (T3D.Point)Input.ElementAt(1).GetInput();
                T3D.Point thirdPoint  = (T3D.Point)Input.ElementAt(2).GetInput();
                T3D.Point fourthPoint = (T3D.Point)Input.ElementAt(3).GetInput();
                T3D.Point centerPoint = new T3D.Point();
                ArrayList PlateList   = (ArrayList)Input.ElementAt(4).GetInput();

                // Use plate Identifiers from PlateList to obtain plates for bolting connection
                if (PlateList != null && PlateList.Count == 4)
                {
                    _plate1 = _classModel.SelectModelObject(PlateList[0] as Tekla.Structures.Identifier) as TSM.ContourPlate;
                    _plate2 = _classModel.SelectModelObject(PlateList[1] as Tekla.Structures.Identifier) as TSM.ContourPlate;
                    _plate3 = _classModel.SelectModelObject(PlateList[2] as Tekla.Structures.Identifier) as TSM.ContourPlate;
                    _plate4 = _classModel.SelectModelObject(PlateList[3] as Tekla.Structures.Identifier) as TSM.ContourPlate;
                }

                // Trim points
                AngleModelingUtil angleModelingUtil = new AngleModelingUtil();
                firstAnglePoints  = angleModelingUtil.TrimPoints(firstPoint, (_firstOffset * 25.4), thirdPoint, (_thirdOffset * 25.4));
                secondAnglePoints = angleModelingUtil.TrimPoints(fourthPoint, (_fourthOffset * 25.4), secondPoint, (_secondOffset * 25.4));

                if (_angleBracingType == 0)
                {
                    // Create angle objects and set position
                    AngleModeler firstAngle = new AngleModeler(_classModel);
                    firstAngle.SetOnPlanePosition(1);
                    firstAngle.SetRotationPosition(0);
                    firstAngle.SetDepthPosition(1);

                    angleOnPlaneOffset = (_angleWidth - (_angleOffset * 25.4)) * -1;

                    // Adjust angle offset
                    if (_anglePosition == 0)
                    {
                        firstAngle.SetOnPlaneOffset((_angleWidth / 2) * -1);
                    }
                    else
                    {
                        firstAngle.SetOnPlaneOffset(angleOnPlaneOffset);
                    }

                    // Second angle
                    AngleModeler secondAngle = new AngleModeler(_classModel);
                    secondAngle.SetOnPlanePosition(1);
                    secondAngle.SetRotationPosition(0);
                    secondAngle.SetDepthPosition(1);
                    secondAngle.SetRotationOffset(180);


                    // Adjust angle offset
                    if (_anglePosition == 0)
                    {
                        secondAngle.SetOnPlaneOffset((_angleWidth / 2) * -1);
                    }
                    else
                    {
                        secondAngle.SetOnPlaneOffset(angleOnPlaneOffset);
                    }

                    // Model angles
                    T3D.Point firstAngleStart   = firstAnglePoints.ElementAt(0);
                    T3D.Point firstAngleFinish  = firstAnglePoints.ElementAt(1);
                    T3D.Point secondAngleStart  = secondAnglePoints.ElementAt(0);
                    T3D.Point secondAngleFinish = secondAnglePoints.ElementAt(1);
                    firstAngle.ModelAngle(firstAngleStart, firstAngleFinish, _angleProfile, false);
                    secondAngle.ModelAngle(secondAngleStart, secondAngleFinish, _angleProfile, false);

                    // Generate bolts
                    AngleBolts firstAngleBolts1  = new AngleBolts(_classModel, _boltSize, _boltQty);
                    AngleBolts firstAngleBolts2  = new AngleBolts(_classModel, _boltSize, _boltQty);
                    AngleBolts secondAngleBolts1 = new AngleBolts(_classModel, _boltSize, _boltQty);
                    AngleBolts secondAngleBolts2 = new AngleBolts(_classModel, _boltSize, _boltQty);
                    AngleBolts centerBolt        = new AngleBolts(_classModel, _boltSize, 1);

                    // If angle is centered, set offset to 0
                    if (_anglePosition == 0)
                    {
                        _boltDy = 0;
                    }
                    else
                    {
                        _boltDy = angleOnPlaneOffset + (_angleWidth / 2);
                    }



                    // If angle is centered, set offset to 0
                    if (_anglePosition == 0)
                    {
                        // Find center point for center bolt
                        centerPoint = angleModelingUtil.CenterPoint(firstPoint, secondPoint, thirdPoint, fourthPoint);

                        // Bolt center bolt
                        distanceToCenter = Math.Sqrt(Math.Pow((centerPoint.X - firstPoint.X), 2) + Math.Pow(centerPoint.Y - firstPoint.Y, 2));
                        centerBolt.BoltAngle(firstAnglePoints.ElementAt(0), firstAnglePoints.ElementAt(1), 0.0, distanceToCenter, (-1 * _boltDy), firstAngle.getBeam());
                    }
                    else
                    {
                        //PROBLEM EXISTS SOMEWHERE IN THIS METHOD!!!
                        ////////////////////////////////////////////////
                        // Find center point for center bolt
                        centerPoint = angleModelingUtil.CenterPoint(firstPoint, secondPoint, thirdPoint, fourthPoint);
                        centerPoint = angleModelingUtil.OffsetCenter(firstAngleStart, firstAngleFinish, secondAngleStart, secondAngleFinish, centerPoint, _angleWidth, (_angleOffset * 25.4));
                        // Bolt center bolt
                        distanceToCenter = Math.Sqrt(Math.Pow((centerPoint.X - firstPoint.X), 2) + Math.Pow(centerPoint.Y - firstPoint.Y, 2));
                        centerBolt.BoltAngle(firstAngleStart, firstAngleFinish, 0.0, distanceToCenter, (-1 * _boltDy), firstAngle.getBeam());
                        ///////////////////////////////////////////////////
                        ///////////////////////////////////////////////////
                    }

                    // Bolt angles to plates
                    firstAngleBolts1.BoltAngle(firstAngleStart, firstAngleFinish, _boltSpacing, _boltDX, (-1 * _boltDy), firstAngle.getBeam(), _plate1);
                    firstAngleBolts2.BoltAngle(firstAngleFinish, firstAngleStart, _boltSpacing, _boltDX, _boltDy, firstAngle.getBeam(), _plate3);
                    secondAngleBolts1.BoltAngle(secondAngleStart, secondAngleFinish, _boltSpacing, _boltDX, _boltDy, secondAngle.getBeam(), _plate4);
                    secondAngleBolts2.BoltAngle(secondAngleFinish, secondAngleStart, _boltSpacing, _boltDX, (-1 * _boltDy), secondAngle.getBeam(), _plate2);
                }
                else if (_angleBracingType == 1)
                {
                    // REMOVE THIS MESSAGE WHEN DOUBLE ANGLE BRACING IS IMPLEMENTED!!!
                    MessageBox.Show("Double angle bracing not implemented yet");
                }
                else
                {
                    // REMOVE THIS MESSAGE WHEN DOUBLE ANGLE BRACING IS IMPLEMENTED!!!
                    MessageBox.Show("Invalid Angle Bracing Type");
                }
            }
            catch (Exception Ex)
            {
                throw;
            }
            finally
            {
                // Set workplane back to what user had before
                _classModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(_originalPlane);
            }

            return(true);
        }
示例#8
0
        public override bool Run(List <InputDefinition> Input)
        {
            try
            {
                // 오버라이드 된 DefineInput에서 List를 가져옴
                // purlin = 중도리 지붕을 지탱하는 골조
                // flange = 플랜지 파이프를 연결하기 위한 배관?
                Beam Purlin1 = (Beam)_model.SelectModelObject((Identifier)Input[0].GetInput());
                Beam Purlin2 = (Beam)_model.SelectModelObject((Identifier)Input[1].GetInput());
                Beam OFlange = (Beam)_model.SelectModelObject((Identifier)Input[2].GetInput());
                Beam Web     = (Beam)_model.SelectModelObject((Identifier)Input[3].GetInput());
                Beam IFlange = (Beam)_model.SelectModelObject((Identifier)Input[4].GetInput());

                // 초기값 체크
                GetValuesFromDialog();

                double WebThick     = 0.0;
                double IFlangeWidth = 0.0;
                double IFlangeThick = 0.0;
                double OFlangeThick = 0.0;
                Web.GetReportProperty("WIDTH", ref WebThick);
                OFlange.GetReportProperty("WIDTH", ref OFlangeThick);
                IFlange.GetReportProperty("WIDTH", ref IFlangeThick);
                IFlange.GetReportProperty("HEIGHT", ref IFlangeWidth);

                if (IsDefaultValue(_PlateWidth) || _PlateWidth == 0)
                {
                    _PlateWidth = (IFlangeWidth - WebThick) * 0.5;
                }
                if (IsDefaultValue(_PlateLength) || _PlateLength == 0)
                {
                    _PlateLength = (IFlangeWidth - WebThick) * 0.5;
                }

                CoordinateSystem WebSys = Web.GetCoordinateSystem();

                // 평면(Web)과 선(purlin1의 시작과 끝점)이 만나는 교차점
                T3D.Point TopCenter = T3D.Intersection.LineToPlane(new Line(Purlin1.StartPoint, Purlin1.EndPoint), new GeometricPlane(WebSys.Origin, WebSys.AxisX, WebSys.AxisY));

                // 실제 좌표점(x,y,z)
                CoordinateSystem WorkSystem = new CoordinateSystem(TopCenter, WebSys.AxisX.Cross(WebSys.AxisY), WebSys.AxisY);

                // CoordinateSystem의 실좌표를 Plane 변경
                _model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(WorkSystem));

                Purlin1.Select();
                Purlin2.Select();
                Web.Select();
                OFlange.Select();
                IFlange.Select();

                CoordinateSystem PurSys        = Purlin1.GetCoordinateSystem();
                T3D.Point        TopClipCenter = T3D.Intersection.LineToPlane(new Line(OFlange.StartPoint, OFlange.EndPoint), new GeometricPlane(PurSys.Origin, PurSys.AxisX, PurSys.AxisY));
                T3D.Point        BottCenter    = T3D.Intersection.LineToPlane(new Line(IFlange.StartPoint, IFlange.EndPoint), new GeometricPlane(PurSys.Origin, PurSys.AxisX, PurSys.AxisY));

                T3D.Point LeftAngleFirstPoint   = new T3D.Point(-_UpperHorizontalDistance, _UpperVerticalDistance, 0);
                T3D.Point LeftAngleSecondPoint  = new T3D.Point(-_LowerHorizontalDistance, BottCenter.Y - IFlangeThick + _LowerVerticalDistance, 0);
                T3D.Point RightAngleFirstPoint  = new T3D.Point(_UpperHorizontalDistance, _UpperVerticalDistance, 0);
                T3D.Point RightAngleSecondPoint = new T3D.Point(_LowerHorizontalDistance, BottCenter.Y - IFlangeThick + _LowerVerticalDistance, 0);

                Beam         LeftAngle  = new Beam();
                Beam         RightAngle = new Beam();
                Beam         TopClip    = new Beam();
                ContourPlate LeftPlate  = new ContourPlate();
                ContourPlate RightPlate = new ContourPlate();

                TopClip.StartPoint = new T3D.Point(-_TopClipLength * 0.5, TopClipCenter.Y + OFlangeThick, 0);
                TopClip.EndPoint   = new T3D.Point(_TopClipLength * 0.5, TopClipCenter.Y + OFlangeThick, 0);

                if (PurSys.AxisX.GetNormal() == new Vector(1, 0, 0) && PurSys.AxisY.GetNormal() == new Vector(0, 1, 0))
                {
                    LeftAngle.StartPoint         = LeftAngleSecondPoint;
                    LeftAngle.EndPoint           = LeftAngleFirstPoint;
                    RightAngle.StartPoint        = RightAngleFirstPoint;
                    RightAngle.EndPoint          = RightAngleSecondPoint;
                    LeftAngle.Position.Plane     = Position.PlaneEnum.LEFT;
                    LeftAngle.Position.Rotation  = Position.RotationEnum.BELOW;
                    LeftAngle.Position.Depth     = Position.DepthEnum.BEHIND;
                    RightAngle.Position.Plane    = Position.PlaneEnum.LEFT;
                    RightAngle.Position.Rotation = Position.RotationEnum.BELOW;
                    RightAngle.Position.Depth    = Position.DepthEnum.BEHIND;
                    TopClip.Position.Plane       = Position.PlaneEnum.LEFT;
                    TopClip.Position.Rotation    = Position.RotationEnum.FRONT;
                    TopClip.Position.Depth       = Position.DepthEnum.BEHIND;
                    LeftPlate.Position.Depth     = Position.DepthEnum.FRONT;
                    RightPlate.Position.Depth    = Position.DepthEnum.FRONT;
                }
                else
                {
                    LeftAngle.StartPoint         = LeftAngleFirstPoint;
                    LeftAngle.EndPoint           = LeftAngleSecondPoint;
                    RightAngle.StartPoint        = RightAngleFirstPoint;
                    RightAngle.EndPoint          = RightAngleSecondPoint;
                    LeftAngle.Position.Plane     = Position.PlaneEnum.RIGHT;
                    LeftAngle.Position.Rotation  = Position.RotationEnum.TOP;
                    LeftAngle.Position.Depth     = Position.DepthEnum.FRONT;
                    RightAngle.Position.Plane    = Position.PlaneEnum.RIGHT;
                    RightAngle.Position.Rotation = Position.RotationEnum.FRONT;
                    RightAngle.Position.Depth    = Position.DepthEnum.FRONT;
                    TopClip.Position.Plane       = Position.PlaneEnum.LEFT;
                    TopClip.Position.Rotation    = Position.RotationEnum.FRONT;
                    TopClip.Position.Depth       = Position.DepthEnum.FRONT;
                    LeftPlate.Position.Depth     = Position.DepthEnum.BEHIND;
                    RightPlate.Position.Depth    = Position.DepthEnum.BEHIND;
                }

                LeftAngle.Profile.ProfileString   = _FlangeProfile;
                LeftAngle.Material.MaterialString = _FlangeMaterial;
                LeftAngle.Class = _FlangeClass;
                LeftAngle.Name  = _FlangeName;
                LeftAngle.Insert();

                RightAngle.Profile.ProfileString   = _FlangeProfile;
                RightAngle.Material.MaterialString = _FlangeMaterial;
                RightAngle.Class = _FlangeClass;
                RightAngle.Name  = _FlangeName;
                RightAngle.Insert();

                double BraceWidth     = 0.0;
                double BraceThickness = 0.0;
                RightAngle.GetReportProperty("WIDTH", ref BraceWidth);
                RightAngle.GetReportProperty("PROFILE.FLANGE_THICKNESS_1", ref BraceThickness);

                double BoltGauge = (BraceWidth + BraceThickness) * 0.5;
                LeftAngle.Position.PlaneOffset = -BoltGauge;
                LeftAngle.StartPointOffset.Dx  = _UpperBoltHorizontalDistance;
                LeftAngle.EndPointOffset.Dx    = _LowerBoltHorizontalDistance;
                LeftAngle.Modify();
                RightAngle.Position.PlaneOffset = -BoltGauge;
                RightAngle.StartPointOffset.Dx  = -_LowerBoltHorizontalDistance;
                RightAngle.EndPointOffset.Dx    = _UpperBoltHorizontalDistance;
                RightAngle.Modify();

                TopClip.Profile.ProfileString   = "PL" + _TopClipThickness + "*" + _TopClipWidth;
                TopClip.Material.MaterialString = _TopClipMaterial;
                TopClip.Name = _TopClipName;
                TopClip.Insert();

                Point        LeftPlatePoint1        = new Point(BottCenter.X - WebThick * 0.5, BottCenter.Y, 0);
                Point        LeftPlatePoint2        = new Point(BottCenter.X - WebThick * 0.5, BottCenter.Y + _PlateLength, 0);
                Point        LeftPlatePoint3        = new Point(BottCenter.X - WebThick * 0.5 - _PlateWidth, BottCenter.Y + _PlateLength, 0);
                Point        LeftPlatePoint4        = new Point(BottCenter.X - WebThick * 0.5 - _PlateWidth, BottCenter.Y, 0);
                ContourPoint LeftPlateContourPoint1 = new ContourPoint(LeftPlatePoint1, new Chamfer(30, 30, Chamfer.ChamferTypeEnum.CHAMFER_LINE));
                ContourPoint LeftPlateContourPoint2 = new ContourPoint(LeftPlatePoint2, new Chamfer());
                ContourPoint LeftPlateContourPoint3 = new ContourPoint(LeftPlatePoint3, new Chamfer());
                ContourPoint LeftPlateContourPoint4 = new ContourPoint(LeftPlatePoint4, new Chamfer());
                LeftPlate.AddContourPoint(LeftPlateContourPoint1);
                LeftPlate.AddContourPoint(LeftPlateContourPoint2);
                LeftPlate.AddContourPoint(LeftPlateContourPoint3);
                LeftPlate.AddContourPoint(LeftPlateContourPoint4);
                LeftPlate.Material.MaterialString = _PlateMaterial;
                LeftPlate.Profile.ProfileString   = "PL" + _PlateThickness.ToString();
                LeftPlate.Name = _PlateName;
                LeftPlate.Insert();

                Point        RightPlatePoint1        = new Point(BottCenter.X + WebThick * 0.5, BottCenter.Y, 0);
                Point        RightPlatePoint2        = new Point(RightPlatePoint1.X + _PlateWidth, RightPlatePoint1.Y, 0);
                Point        RightPlatePoint3        = new Point(RightPlatePoint2.X, RightPlatePoint2.Y + _PlateLength, 0);
                Point        RightPlatePoint4        = new Point(RightPlatePoint3.X - _PlateWidth, RightPlatePoint3.Y, 0);
                ContourPoint RightPlateContourPoint1 = new ContourPoint(RightPlatePoint1, new Chamfer(30, 30, Chamfer.ChamferTypeEnum.CHAMFER_LINE));
                ContourPoint RightPlateContourPoint2 = new ContourPoint(RightPlatePoint2, new Chamfer());
                ContourPoint RightPlateContourPoint3 = new ContourPoint(RightPlatePoint3, new Chamfer());
                ContourPoint RightPlateContourPoint4 = new ContourPoint(RightPlatePoint4, new Chamfer());
                RightPlate.AddContourPoint(RightPlateContourPoint1);
                RightPlate.AddContourPoint(RightPlateContourPoint2);
                RightPlate.AddContourPoint(RightPlateContourPoint3);
                RightPlate.AddContourPoint(RightPlateContourPoint4);
                RightPlate.Material.MaterialString = _PlateMaterial;
                RightPlate.Profile.ProfileString   = "PL" + _PlateThickness.ToString();
                RightPlate.Name = _PlateName;
                RightPlate.Insert();

                Beam LeftPurlin  = Purlin1;
                Beam RightPurlin = Purlin2;
                if ((Purlin1.StartPoint.X - Purlin2.StartPoint.X) > 1 || (Purlin1.StartPoint.Y - Purlin2.StartPoint.Y) > 1)
                {
                    RightPurlin = Purlin1;
                    LeftPurlin  = Purlin2;
                }

                Weld LeftPlateToIFlange = new Weld();
                LeftPlateToIFlange.MainObject      = IFlange;
                LeftPlateToIFlange.SecondaryObject = LeftPlate;
                LeftPlateToIFlange.ShopWeld        = true;
                LeftPlateToIFlange.Insert();
                Weld LeftPlateToWeb = new Weld();
                LeftPlateToWeb.MainObject      = Web;
                LeftPlateToWeb.SecondaryObject = LeftPlate;
                LeftPlateToWeb.ShopWeld        = true;
                LeftPlateToWeb.Insert();
                Weld RightPlateToIFlange = new Weld();
                RightPlateToIFlange.MainObject      = IFlange;
                RightPlateToIFlange.SecondaryObject = RightPlate;
                RightPlateToIFlange.ShopWeld        = true;
                RightPlateToIFlange.Insert();
                Weld RightPlateToWeb = new Weld();
                RightPlateToWeb.MainObject      = Web;
                RightPlateToWeb.SecondaryObject = RightPlate;
                RightPlateToWeb.ShopWeld        = true;
                RightPlateToWeb.Insert();

                PolygonWeld ClipToFlange = new PolygonWeld();
                ClipToFlange.TypeAbove       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
                ClipToFlange.TypeBelow       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
                ClipToFlange.SizeAbove       = _ClipWeldSize;
                ClipToFlange.SizeBelow       = _ClipWeldSize;
                ClipToFlange.MainObject      = OFlange;
                ClipToFlange.SecondaryObject = TopClip;
                ClipToFlange.ShopWeld        = true;
                ClipToFlange.Polygon.Points.Add(TopClip.StartPoint);
                ClipToFlange.Polygon.Points.Add(TopClip.EndPoint);
                ClipToFlange.Insert();

                // Bolting Brace with Plate or Purlin
                BoltArray UpperLeftBolt = new BoltArray();
                UpperLeftBolt.PartToBoltTo   = LeftPurlin;
                UpperLeftBolt.PartToBeBolted = LeftAngle;
                UpperLeftBolt.FirstPosition  = LeftAngle.StartPoint;
                UpperLeftBolt.SecondPosition = LeftAngle.EndPoint;
                UpperLeftBolt.AddBoltDistX(0.0);
                UpperLeftBolt.AddBoltDistY(0.0);
                UpperLeftBolt.BoltSize          = _BraceBoltSize;
                UpperLeftBolt.Tolerance         = 0.0625 * 25.4;
                UpperLeftBolt.BoltStandard      = _BraceBoltStandard;
                UpperLeftBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                UpperLeftBolt.CutLength         = 76.2;
                UpperLeftBolt.Bolt              = true;
                UpperLeftBolt.Position.Rotation = Position.RotationEnum.FRONT;
                BoltArray LowerLeftBolt = new BoltArray();
                LowerLeftBolt.PartToBoltTo   = LeftPlate;
                LowerLeftBolt.PartToBeBolted = LeftAngle;
                LowerLeftBolt.FirstPosition  = LeftAngle.EndPoint;
                LowerLeftBolt.SecondPosition = LeftAngle.StartPoint;
                LowerLeftBolt.AddBoltDistX(0.0);
                LowerLeftBolt.AddBoltDistY(0.0);
                LowerLeftBolt.BoltSize          = _BraceBoltSize;
                LowerLeftBolt.BoltStandard      = _BraceBoltStandard;
                LowerLeftBolt.Tolerance         = 0.0625 * 25.4;
                LowerLeftBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                LowerLeftBolt.CutLength         = 76.2;
                LowerLeftBolt.Bolt              = true;
                LowerLeftBolt.Position.Rotation = Position.RotationEnum.FRONT;
                BoltArray UpperRightBolt = new BoltArray();
                UpperRightBolt.PartToBoltTo   = RightPurlin;
                UpperRightBolt.PartToBeBolted = RightAngle;
                UpperRightBolt.FirstPosition  = RightAngle.EndPoint;
                UpperRightBolt.SecondPosition = RightAngle.StartPoint;
                UpperRightBolt.AddBoltDistX(0.0);
                UpperRightBolt.AddBoltDistY(0.0);
                UpperRightBolt.BoltSize          = _BraceBoltSize;
                UpperRightBolt.Tolerance         = 0.0625 * 25.4;
                UpperRightBolt.BoltStandard      = _BraceBoltStandard;
                UpperRightBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                UpperRightBolt.CutLength         = 76.2;
                UpperRightBolt.Bolt              = true;
                UpperRightBolt.Position.Rotation = Position.RotationEnum.FRONT;
                BoltArray LowerRightBolt = new BoltArray();
                LowerRightBolt.PartToBoltTo   = RightPlate;
                LowerRightBolt.PartToBeBolted = RightAngle;
                LowerRightBolt.FirstPosition  = RightAngle.StartPoint;
                LowerRightBolt.SecondPosition = RightAngle.EndPoint;
                LowerRightBolt.AddBoltDistX(0.0);
                LowerRightBolt.AddBoltDistY(0.0);
                LowerRightBolt.BoltSize          = _BraceBoltSize;
                LowerRightBolt.Tolerance         = 0.0625 * 25.4;
                LowerRightBolt.BoltStandard      = _BraceBoltStandard;
                LowerRightBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                LowerRightBolt.CutLength         = 76.2;
                LowerRightBolt.Bolt              = true;
                LowerRightBolt.Position.Rotation = Position.RotationEnum.FRONT;

                // Bolting ClipPlate with purlin
                BoltArray ClipBolts1 = new BoltArray();
                ClipBolts1.PartToBoltTo        = LeftPurlin;
                ClipBolts1.PartToBeBolted      = TopClip;
                ClipBolts1.FirstPosition       = TopClip.StartPoint;
                ClipBolts1.SecondPosition      = TopClip.EndPoint;
                ClipBolts1.StartPointOffset.Dx = 31.75;
                ClipBolts1.AddBoltDistX(0);
                ClipBolts1.AddBoltDistY(76.2);
                ClipBolts1.StartPointOffset.Dy = 76.2;
                ClipBolts1.EndPointOffset.Dy   = 76.2;
                ClipBolts1.BoltSize            = _ClipBoltSize;
                ClipBolts1.Tolerance           = 0.0625 * 25.4;
                ClipBolts1.BoltStandard        = _CliptBoltStandard;
                ClipBolts1.BoltType            = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                ClipBolts1.CutLength           = 76.2;
                ClipBolts1.Bolt = true;
                ClipBolts1.Position.Rotation = Position.RotationEnum.FRONT;

                BoltArray ClipBolts2 = new BoltArray();
                ClipBolts2.PartToBoltTo        = RightPurlin;
                ClipBolts2.PartToBeBolted      = TopClip;
                ClipBolts2.FirstPosition       = TopClip.StartPoint;
                ClipBolts2.SecondPosition      = TopClip.EndPoint;
                ClipBolts2.StartPointOffset.Dx = _TopClipLength - 31.75;
                ClipBolts2.AddBoltDistX(0);
                ClipBolts2.AddBoltDistY(76.2);
                ClipBolts2.StartPointOffset.Dy = 76.2;
                ClipBolts2.EndPointOffset.Dy   = 76.2;
                ClipBolts2.BoltSize            = _ClipBoltSize;
                ClipBolts2.Tolerance           = 0.0625 * 25.4;
                ClipBolts2.BoltStandard        = _CliptBoltStandard;
                ClipBolts2.BoltType            = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                ClipBolts2.CutLength           = 76.2;
                ClipBolts2.Bolt = true;
                ClipBolts2.Position.Rotation = Position.RotationEnum.FRONT;

                if (PurSys.AxisX.GetNormal() == new Vector(1, 0, 0) && PurSys.AxisX.GetNormal() == new Vector(0, 1, 0))
                {
                    UpperLeftBolt.FirstPosition      = LeftAngle.EndPoint;
                    UpperLeftBolt.SecondPosition     = LeftAngle.StartPoint;
                    UpperLeftBolt.Position.Rotation  = Position.RotationEnum.BACK;
                    LowerLeftBolt.FirstPosition      = LeftAngle.StartPoint;
                    LowerLeftBolt.SecondPosition     = LeftAngle.EndPoint;
                    LowerLeftBolt.Position.Rotation  = Position.RotationEnum.BACK;
                    UpperRightBolt.FirstPosition     = RightAngle.StartPoint;
                    UpperRightBolt.SecondPosition    = RightAngle.EndPoint;
                    UpperRightBolt.Position.Rotation = Position.RotationEnum.BACK;
                    LowerRightBolt.FirstPosition     = RightAngle.StartPoint;
                    LowerRightBolt.SecondPosition    = RightAngle.EndPoint;
                    LowerRightBolt.Position.Rotation = Position.RotationEnum.BACK;
                    ClipBolts1.Position.Rotation     = Position.RotationEnum.BACK;
                    ClipBolts2.Position.Rotation     = Position.RotationEnum.BACK;
                }
                UpperLeftBolt.Insert();
                LowerLeftBolt.Insert();
                UpperRightBolt.Insert();
                LowerRightBolt.Insert();
                ClipBolts1.Insert();
                ClipBolts2.Insert();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }

            return(true);
        }
        // This application assumes that users have already opened a drawing - an assembly drawing.
        // The goal is for the user to see that particular assembly
        // in the model, and to see ONLY that assembly in the model.
        // Therefore all parts which are not associated with this assembly need to be hidden.
        // All the clutter needs to be removed from view.
        // And all parts associated with this assembly need to be visible.

        // Summary: our goals is for users to see, given the particular assembly drawing that they are in,
        // just that ONE assembly within the model, and to have all other parts hidden.

        // Methodology:
        // 1. We obtain the assembly drawing and go through all the drawing objects within the assembly drawing. We get the identifiers of these
        ////  drawing objects and place them in a list (assemblyPartIdentifierList)
        // 2. We obtain the identifiers of all the objects in the model and place them on this list too.
        ///3. We want to hide all objects which are not associated with the assembly drawing which is currently open.
        ///4. Consequently, we obtain a List of identifiers which contains all the objects in the model APART from the assembly parts of the current assembly
        ///// we are working on.
        ///5. We convert this list of identifiers into a TSM.Model Object list, and then again convert this list into an ArrayList.
        ///6. The array list should contain all the objects we need to hide.
        ///7. We use the array list to select all the objects which need to be hidden, in the model.
        ///8. We want to call a macro which hides all the objects currently selected.

        // Two questions, (1) is the above approach a good and efficient wa to solve the above problem>
        // Given a drawing is open, how can one call a macro which hides all selected objects?
        // Your comemnts and criticism would be very much apprieciated.


        private static void GetAssembly()
        {
            try
            {
                // creates model and drawing handle

                TSM.Model myModel = new TSM.Model();

                TSD.DrawingHandler dh = new TSD.DrawingHandler();

                if (dh.GetConnectionStatus() == false)
                {
                    System.Windows.Forms.MessageBox.Show("Could not connect drawing handler.");
                    return;
                }

                // users must have an Assembly drawing open. We want to see the assembly contained in the assembly drawing in the
                // UI. Hence we first obtain the identifiers of the drawing objects.

                TSD.Drawing currentDrawing = dh.GetActiveDrawing();

                if (currentDrawing == null)
                {
                    System.Windows.Forms.MessageBox.Show("Please ensure that an assembly drawing is open");
                    return;
                }

                TSD.AssemblyDrawing currentAssemblyDrawing = currentDrawing as TSD.AssemblyDrawing;

                if (currentAssemblyDrawing == null)
                {
                    System.Windows.Forms.MessageBox.Show("Please ensure that an assembly drawing is open");
                    return;
                }

                if (currentAssemblyDrawing != null)
                {
                    // in order to select in the model space we need to create an array list

                    ArrayList assemblyObjectToBeViewed = new ArrayList();

                    // we need to add a model object to the array list. We are adding the assembly as the model object for the model object selector to select

                    assemblyObjectToBeViewed.Add(myModel.SelectModelObject(currentAssemblyDrawing.AssemblyIdentifier));

                    TSM.UI.ModelObjectSelector selector = new TSM.UI.ModelObjectSelector();
                    selector.Select(assemblyObjectToBeViewed);

                    TSM.Operations.Operation.RunMacro("ShowOnlySelected.cs");
                    TSM.Operations.Operation.RunMacro("FitToView.cs");
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Please ensure you have an Assembly drawing open");
                }
            }

            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
        // This application assumes that users have already opened a drawing - an assembly drawing.
        // The goal is for the user to see that particular assembly
        // in the model, and to see ONLY that assembly in the model.
        // Therefore all parts which are not associated with this assembly need to be hidden.
        // All the clutter needs to be removed from view.
        // And all parts associated with this assembly need to be visible.
        // Summary: our goals is for users to see, given the particular assembly drawing that they are in,
        // just that ONE assembly within the model, and to have all other parts hidden.
        // Methodology:
        // 1. We obtain the assembly drawing and go through all the drawing objects within the assembly drawing. We get the identifiers of these
        ////  drawing objects and place them in a list (assemblyPartIdentifierList)
        // 2. We obtain the identifiers of all the objects in the model and place them on this list too.
        ///3. We want to hide all objects which are not associated with the assembly drawing which is currently open.
        ///4. Consequently, we obtain a List of identifiers which contains all the objects in the model APART from the assembly parts of the current assembly
        ///// we are working on.
        ///5. We convert this list of identifiers into a TSM.Model Object list, and then again convert this list into an ArrayList.
        ///6. The array list should contain all the objects we need to hide.
        ///7. We use the array list to select all the objects which need to be hidden, in the model.
        ///8. We want to call a macro which hides all the objects currently selected.
        // Two questions, (1) is the above approach a good and efficient wa to solve the above problem>
        // Given a drawing is open, how can one call a macro which hides all selected objects?
        // Your comemnts and criticism would be very much apprieciated.
        private void GetAssembly()
        {
            try
            {
            // creates model and drawing handle

                TSM.Model myModel = new TSM.Model();

                TSD.DrawingHandler dh = new TSD.DrawingHandler();

                if (dh.GetConnectionStatus() == false)
                {
                     System.Windows.Forms.MessageBox.Show("Could not connect drawing handler.");
                     return;
                }

            // users must have an Assembly drawing open. We want to see the assembly contained in the assembly drawing in the
            // UI. Hence we first obtain the identifiers of the drawing objects.

                TSD.Drawing currentDrawing = dh.GetActiveDrawing();

                if (currentDrawing == null)
                {
                    System.Windows.Forms.MessageBox.Show("Please ensure that an assembly drawing is open");
                    return;
                }

                TSD.AssemblyDrawing currentAssemblyDrawing = currentDrawing as TSD.AssemblyDrawing;

                if (currentAssemblyDrawing == null)
                {
                    System.Windows.Forms.MessageBox.Show("Please ensure that an assembly drawing is open");
                    return;
                }

                if (currentAssemblyDrawing != null)
                {
                    // in order to select in the model space we need to create an array list

                    ArrayList assemblyObjectToBeViewed = new ArrayList();

                    // we need to add a model object to the array list. We are adding the assembly as the model object for the model object selector to select
                    assemblyObjectToBeViewed.Add( myModel.SelectModelObject(currentAssemblyDrawing.AssemblyIdentifier) );

                    TSM.UI.ModelObjectSelector selector = new TSM.UI.ModelObjectSelector();
                    selector.Select(assemblyObjectToBeViewed);

                    TSM.Operations.Operation.RunMacro("ShowOnlySelected.cs");
                    TSM.Operations.Operation.RunMacro("FitToView.cs");
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Please ensure you have an Assembly drawing open");
                }

            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
示例#11
-1
        private void markHandler(TSD.Mark currentMark)
        {
            if (currentMark.Attributes.Content.Count > 0)
            {
                System.Type[] Types = new System.Type[1];
                Types.SetValue(typeof(TSD.ModelObject), 0);
                TSD.DrawingObjectEnumerator markObjects = currentMark.GetRelatedObjects(Types);

                foreach (TSD.ModelObject currentDO in markObjects)
                {
                    TSM.Model       myModel     = new TSM.Model();
                    TSM.ModelObject modelObject = myModel.SelectModelObject(currentDO.ModelIdentifier);

                    if (modelObject != null)
                    {
                        if (modelObject is TSM.Beam)
                        {
                            TSM.Beam currentMO = modelObject as TSM.Beam;
                            markBeams.Add(new _Mark_Beam(currentMark, currentMO, currentDO, this.view));
                        }
                        else if (modelObject is TSM.PolyBeam)
                        {
                            TSM.PolyBeam currentMO = modelObject as TSM.PolyBeam;
                            markPolyBeams.Add(new _Mark_PolyBeam(currentMark, currentMO, currentDO, this.view));
                        }
                        else if (modelObject is TSM.ContourPlate)
                        {
                            TSM.ContourPlate currentMO = modelObject as TSM.ContourPlate;
                            markContourPlates.Add(new _Mark_ContourPlate(currentMark, currentMO, currentDO, this.view));
                        }
                        else if (modelObject is TSM.SingleRebar)
                        {
                            TSM.SingleRebar currentMO = modelObject as TSM.SingleRebar;
                            markSingleRebars.Add(new _Mark_SingleRebar(currentMark, currentMO, currentDO, this.view));
                        }
                        else if (modelObject is TSM.RebarGroup)
                        {
                            TSM.BaseRebarGroup currentMO = modelObject as TSM.RebarGroup;
                            markRebarBases.Add(new _Mark_RebarGroup(currentMark, currentMO, currentDO, this.view));
                        }
                        else if (modelObject is TSM.BoltGroup)
                        {
                            TSM.BoltGroup currentMO = modelObject as TSM.BoltGroup;
                            markBoltGroup.Add(new _Mark_BoltGroup(currentMark, currentMO, currentDO, this.view));
                        }
                    }
                }
            }
        }