Example #1
0
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();

            if (drawingObjectEnum.GetSize() == 1)
            {
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.View)
                    {
                        Tekla.Structures.Drawing.View drawingView = (Tekla.Structures.Drawing.View)drawingObjectEnum.Current;
                        scale         = drawingView.Attributes.Scale.ToString("F02");
                        sizeXMin      = drawingView.RestrictionBox.MinPoint.X.ToString("F02");
                        sizeXMax      = drawingView.RestrictionBox.MaxPoint.X.ToString("F02");
                        sizeYMin      = drawingView.RestrictionBox.MinPoint.Y.ToString("F02");
                        sizeYMax      = drawingView.RestrictionBox.MaxPoint.Y.ToString("F02");
                        sizeDepthDown = Math.Abs(drawingView.RestrictionBox.MinPoint.Z).ToString("F02");
                        sizeDepthUp   = drawingView.RestrictionBox.MaxPoint.Z.ToString("F02");
                        viewExtension = drawingView.Attributes.ViewExtensionForNeighbourParts.ToString("F02");
                        if (drawingView.Attributes.FixedViewPlacing)
                        {
                            fixedViewPlacing = Bool.True;
                        }
                        else
                        {
                            fixedViewPlacing = Bool.False;
                        }
                        if (drawingView.Attributes.Shortening.CutParts)
                        {
                            cutParts = Bool.True;
                        }
                        else
                        {
                            cutParts = Bool.False;
                        }
                        minimumLength = drawingView.Attributes.Shortening.MinimumLength.ToString("F02");
                    }
                }
            }
            else if (drawingObjectEnum.GetSize() > 1)
            {
                scale            = "";
                sizeXMin         = "";
                sizeXMax         = "";
                sizeYMin         = "";
                sizeYMax         = "";
                sizeDepthDown    = "";
                sizeDepthUp      = "";
                viewExtension    = "";
                fixedViewPlacing = new Bool();
                cutParts         = new Bool();
                minimumLength    = "";
            }
        }
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            DrawingHandler          DrawingHandler = new DrawingHandler();
            Drawing                 Drawing        = DrawingHandler.GetActiveDrawing();
            DrawingObjectEnumerator DrawingObjEnum = Drawing.GetSheet().GetAllObjects();
            ArrayList               MarkArray      = new ArrayList();
            ArrayList               PartArray      = new ArrayList();

            while (DrawingObjEnum.MoveNext())
            {
                if (DrawingObjEnum.Current is MarkBase)
                {
                    MarkArray.Add(DrawingObjEnum.Current);
                }

                if (DrawingObjEnum.Current is Tekla.Structures.Drawing.Part || DrawingObjEnum.Current is Tekla.Structures.Drawing.Bolt)
                {
                    PartArray.Add(DrawingObjEnum.Current);
                }
            }
            DrawingHandler.GetDrawingObjectSelector().SelectObjects(MarkArray, true);

            // part mark properties
            akit.Callback("acmd_display_selected_drawing_object_dialog", "", "main_frame");
            akit.TabChange("pmark_dial", "Container_2", "gr_mark_general_tab");
            akit.PushButton("gr_pmark_place", "pmark_dial");
            akit.ValueChange("pmpl_dial", "text_placing_mode", "1");
            akit.PushButton("txpl_modify", "pmpl_dial");
            akit.PushButton("txpl_cancel", "pmpl_dial");
            akit.PushButton("pmark_cancel", "pmark_dial");

            // bolt mark properties
            akit.Callback("acmd_display_attr_dialog", "smark_dial", "main_frame");
            akit.TabChange("smark_dial", "Container_217", "gr_mark_general_tab");
            akit.PushButton("gr_smark_place", "smark_dial");
            akit.ValueChange("smpl_dial", "text_placing_mode", "1");
            akit.PushButton("txpl_modify", "smpl_dial");
            akit.PushButton("txpl_cancel", "smpl_dial");
            akit.PushButton("smark_cancel", "smark_dial");

            // connection mark properties
            akit.Callback("acmd_display_attr_dialog", "jmark_dial", "main_frame");
            akit.TabChange("jmark_dial", "Container_217", "gr_mark_general_tab");
            akit.PushButton("gr_jmark_place", "jmark_dial");
            akit.ValueChange("jmpl_dial", "text_placing_mode", "1");
            akit.PushButton("txpl_modify", "jmpl_dial");
            akit.PushButton("txpl_cancel", "jmpl_dial");
            akit.PushButton("jmark_cancel", "jmark_dial");

            DrawingHandler.GetDrawingObjectSelector().UnselectAllObjects();
            DrawingHandler.GetDrawingObjectSelector().SelectObjects(PartArray, true);
            akit.Callback("acmd_update_marks_selected", "", "main_frame");
        }
Example #3
0
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();

            if (drawingObjectEnum.GetSize() == 1)
            {
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Weld)
                    {
                        Tekla.Structures.Drawing.Weld drawingWeld = (Tekla.Structures.Drawing.Weld)drawingObjectEnum.Current;
                    }
                }
            }
        }
Example #4
0
        private void GetMarks(string MarkType)
        {
            Model model = new Model();

            Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
            Drawing drawing = drawingHandler.GetActiveDrawing();
            DrawingObjectEnumerator drawingObjectEnumerator = drawingHandler.GetDrawingObjectSelector().GetSelected();
            ArrayList SelectedObjectArray = new ArrayList();
            ArrayList MarkArray           = new ArrayList();

            while (drawingObjectEnumerator.MoveNext())
            {
                if (drawingObjectEnumerator.Current is Tekla.Structures.Drawing.Part)
                {
                    Tekla.Structures.Drawing.Part part = drawingObjectEnumerator.Current as Tekla.Structures.Drawing.Part;
                    SelectedObjectArray.Add(model.SelectModelObject(new Identifier(part.ModelIdentifier.ID)));
                    DrawingObjectArray.Add(part);
                }
            }
            modelObjectSelector.Select(SelectedObjectArray);
            Tekla.Structures.Model.ModelObjectEnumerator modelObjectEnumerator = model.GetModelObjectSelector().GetSelectedObjects();
            while (modelObjectEnumerator.MoveNext())
            {
                if (modelObjectEnumerator.Current is Tekla.Structures.Model.Part)
                {
                    Tekla.Structures.Model.Part modelPart = modelObjectEnumerator.Current as Tekla.Structures.Model.Part;
                    string mark = "";
                    try
                    {
                        modelPart.GetReportProperty(MarkType, ref mark);
                        if (!MarkArray.Contains(mark))
                        {
                            MarkArray.Add(mark);
                        }
                    }
                    catch { }
                }
            }
            MarkArray.Sort();
            string MarkList = "";

            foreach (string strMark in MarkArray)
            {
                MarkList = strMark + " " + MarkList;
            }
            Clipboard.SetDataObject(MarkList); richTextBox1.Text = MarkList;
            drawingHandler.GetDrawingObjectSelector().SelectObjects(DrawingObjectArray, false);
        }
Example #5
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            try
            {
                Model                   model             = new Model();
                DrawingHandler          drawingHandler    = new DrawingHandler();
                DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();
                ArrayList               ModelObjectArray  = new ArrayList();

                if (drawingObjectEnum.GetSize() > 0)
                {
                    while (drawingObjectEnum.MoveNext())
                    {
                        if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Part)
                        {
                            Tekla.Structures.Drawing.Part part = drawingObjectEnum.Current as Tekla.Structures.Drawing.Part;
                            ModelObjectArray.Add(model.SelectModelObject(new Identifier(part.ModelIdentifier.ID)));
                        }
                        if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Bolt)
                        {
                            Tekla.Structures.Drawing.Bolt bolt = drawingObjectEnum.Current as Tekla.Structures.Drawing.Bolt;
                            ModelObjectArray.Add(model.SelectModelObject(new Identifier(bolt.ModelIdentifier.ID)));
                        }
                    }
                }

                Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
                modelObjectSelector.Select(ModelObjectArray);
                akit.Callback("acmd_display_selected_object_dialog", "", "main_frame");
            }
            catch { }
        }
Example #6
0
        /// <summary>
        /// 绘制上翼板左右倾斜时的零件标记;
        /// </summary>
        private void DrawPartMarkNormal()
        {
            mMrPartList.Remove(mMainBeam);

            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            foreach (CMrPart mrPart in mMrPartList)
            {
                CMrMark mrMark = mrPart.GetBeamDoorFrontViewInfo().GetPartMarkNormal();

                if (null == mrMark)
                {
                    continue;
                }
                DS.SelectObject(mrPart.mPartInDrawing);
            }

            mMrPartList.Add(mMainBeam);

            DS.SelectObject(mMainBeam.mPartInDrawing);

            //绘制主梁上的螺钉标记;
            DrawMainBeamBoltMark(1);

            CDimTools.GetInstance().DrawMarkByMacro();
        }
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            Model model = new Model();
            //Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
            DrawingHandler          dh  = new DrawingHandler();
            DrawingObjectEnumerator doe = dh.GetDrawingObjectSelector().GetSelected();

            while (doe.MoveNext())
            {
                string CONN_CODE_END1 = "", CONN_CODE_END2 = "";
                if (doe.Current is Tekla.Structures.Drawing.Part)
                {
                    Tekla.Structures.Drawing.Part dPart = (Tekla.Structures.Drawing.Part)doe.Current;
                    Tekla.Structures.Model.Part   mPart = (Tekla.Structures.Model.Part)model.SelectModelObject((Identifier)dPart.ModelIdentifier);
                    if (mPart is Beam)
                    {
                        Beam     beam = (Beam)mPart;
                        ViewBase view = dPart.GetView();
                        mPart.GetUserProperty("CONN_CODE_END1", ref CONN_CODE_END1);
                        mPart.GetUserProperty("CONN_CODE_END2", ref CONN_CODE_END2);

                        if (CONN_CODE_END1 != "")
                        {
                            Tekla.Structures.Drawing.Text text = new Tekla.Structures.Drawing.Text(view, beam.StartPoint + new Point(200, 200), CONN_CODE_END1, new LeaderLinePlacing(beam.StartPoint));
                            text.Insert();
                        }
                        if (CONN_CODE_END2 != "")
                        {
                            Tekla.Structures.Drawing.Text text = new Tekla.Structures.Drawing.Text(view, beam.EndPoint + new Point(200, 200), CONN_CODE_END2, new LeaderLinePlacing(beam.EndPoint));
                            text.Insert();
                        }
                    }
                }
            }
        }
Example #8
0
        /// <summary>
        /// 绘制主梁上螺钉的标记;
        /// </summary>
        public void DrawMainPartBoltMark()
        {
            CBeamTopViewSetting beamTopViewSetting = CBeamDimSetting.GetInstance().mTopViewSetting;

            bool bNeedMark = beamTopViewSetting.FindMarkValueByName(CBeamTopViewSetting.mstrBolt);

            if (!bNeedMark)
            {
                return;
            }

            List <CMrBoltArray> mrBoltArrayList = mMainBeam.GetBoltArrayList();

            Vector zVector = new Vector(0, 0, 1);

            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            foreach (CMrBoltArray mrBoltArray in mrBoltArrayList)
            {
                //只有与Z轴平行的螺钉组才进行编号;
                if (!CDimTools.GetInstance().IsTwoVectorParallel(zVector, mrBoltArray.mNormal))
                {
                    continue;
                }
                DS.SelectObject(mrBoltArray.mBoltInDrawing);
            }
            CDimTools.GetInstance().DrawMarkByMacro();
        }
Example #9
0
        /// <summary>
        /// 绘制法向与Z轴平行的中间零部件上螺钉的标记;
        /// </summary>
        public void DrawZNormalMiddleBoltMark()
        {
            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            foreach (CMrPart mrPart in mMrPartList)
            {
                Vector normal = mrPart.mNormal;

                double minX = mrPart.GetMinXPoint().X;
                double maxX = mrPart.GetMaxXPoint().X;

                if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1)) || !mrPart.IsHaveBolt())
                {
                    continue;
                }
                if (CDimTools.GetInstance().CompareTwoDoubleValue(minX, 0) >= 0 ||
                    CDimTools.GetInstance().CompareTwoDoubleValue(maxX, 0) <= 0)
                {
                    continue;
                }
                List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList();

                foreach (CMrBoltArray mrBoltArray in mrBoltArrayList)
                {
                    if (!CDimTools.GetInstance().IsTwoVectorParallel(mrBoltArray.mNormal, new Vector(0, 0, 1)))
                    {
                        continue;
                    }
                    DS.SelectObject(mrBoltArray.mBoltInDrawing);
                }
            }
            CDimTools.GetInstance().DrawMarkByMacro();
        }
        /// <summary>
        /// 绘制主梁与Y轴平行时的零件标记;
        /// </summary>
        private void DrawYParallelPartMark()
        {
            Vector zVector = new Vector(0, 0, 1);

            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            foreach (CMrPart mrPart in mMrPartList)
            {
                Vector normal = mrPart.mNormal;

                if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, zVector))
                {
                    continue;
                }
                DS.SelectObject(mrPart.mPartInDrawing);

                //2.对螺钉组进行标注;
                List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList();

                foreach (CMrBoltArray mrBoltArray in mrBoltArrayList)
                {
                    Vector boltNormal = mrBoltArray.mNormal;

                    if (!CDimTools.GetInstance().IsTwoVectorParallel(boltNormal, zVector))
                    {
                        continue;
                    }
                    DS.SelectObject(mrBoltArray.mBoltInDrawing);
                }
            }
            CDimTools.GetInstance().DrawMarkByMacro();
        }
Example #11
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            try
            {
                Model          model          = new Model();
                DrawingHandler drawingHandler = new DrawingHandler();

                ArrayList ModelObjectArray = new ArrayList();

                if (drawingHandler.GetActiveDrawing() != null)
                {
                    DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();
                    if (drawingObjectEnum.GetSize() > 0)
                    {
                        while (drawingObjectEnum.MoveNext())
                        {
                            Tekla.Structures.Drawing.ModelObject dModelObject = (Tekla.Structures.Drawing.ModelObject)drawingObjectEnum.Current;
                            ModelObjectArray.Add(model.SelectModelObject(dModelObject.ModelIdentifier));
                        }
                    }

                    Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
                    modelObjectSelector.Select(ModelObjectArray);
                }

                akit.Callback("acmdZoomToSelected", "", "main_frame");
            }
            catch { }
        }
Example #12
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            var handler   = new DrawingHandler();
            var selection = handler.GetDrawingObjectSelector().GetSelected();


            PointList     pointlist = new PointList();
            List <double> X         = new List <double>();
            List <double> Y         = new List <double>();

            while (selection.MoveNext())
            {
                if (selection.Current is Polygon)
                {
                    Polygon polygon = selection.Current as Polygon;
                    pointlist = polygon.Points;

                    foreach (Point i in pointlist)
                    {
                        X.Add(i.X);
                        Y.Add(i.Y);
                    }
                }
            }
            int n = X.Count;

            double area = polygonArea(X, Y, n) / 1000000;

            string msg = String.Format("Polygon area is: {0} m2", Math.Round(area, 3));

            System.Windows.Forms.MessageBox.Show(msg);
        }
Example #13
0
        /// <summary>
        /// 绘制主梁法向朝X方向的零件标记;
        /// </summary>
        private void DrawXVectorPartMark()
        {
            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            foreach (CMrPart mrPart in mMrPartList)
            {
                Vector vector = mrPart.mNormal;

                if (!CDimTools.GetInstance().IsTwoVectorParallel(vector, new Vector(0, 0, 1)))
                {
                    continue;
                }
                if (!mrPart.IsHaveBolt())
                {
                    continue;
                }

                DS.SelectObject(mrPart.mPartInDrawing);

                //2.绘制螺钉组标记;
                List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList();

                foreach (CMrBoltArray mrBoltArray in mrBoltArrayList)
                {
                    if (CDimTools.GetInstance().IsTwoVectorParallel(mrBoltArray.mNormal, new Vector(0, 0, 1)))
                    {
                        DS.SelectObject(mrBoltArray.mBoltInDrawing);
                    }
                }
            }

            CDimTools.GetInstance().DrawMarkByMacro();
        }
Example #14
0
        /// <summary>
        /// 绘制主梁法向朝Y方向的零件标记;
        /// </summary>
        private void DrawYVectorPartMark()
        {
            BuildLeftAndRightPart();

            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            foreach (CMrPart mrPart in mMrPartList)
            {
                Vector normal = mrPart.mNormal;

                //如果零件的法向量与Z轴平行;
                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1)))
                {
                    DS.SelectObject(mrPart.mPartInDrawing);

                    List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList();

                    foreach (CMrBoltArray mrBoltArray in mrBoltArrayList)
                    {
                        if (CDimTools.GetInstance().IsTwoVectorParallel(mrBoltArray.mNormal, new Vector(0, 0, 1)))
                        {
                            DS.SelectObject(mrBoltArray.mBoltInDrawing);
                        }
                    }
                }
                else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0)))
                {
                    DS.SelectObject(mrPart.mPartInDrawing);
                }
            }

            CDimTools.GetInstance().DrawMarkByMacro();
        }
Example #15
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            var handler   = new DrawingHandler();
            var selection = handler.GetDrawingObjectSelector().GetSelected();

            DrawingHandler.SetMessageExecutionStatus(DrawingHandler.MessageExecutionModeEnum.BY_COMMIT);

            double rotang = 0;

            while (selection.MoveNext())
            {
                if (selection.Current is MarkBase)
                {
                    MarkBase mark = selection.Current as MarkBase;
                    mark.Attributes.RotationAngle             = rotang;
                    mark.Attributes.PlacingAttributes.IsFixed = true;
                    mark.Modify();
                }
                else
                {
                    Text text = selection.Current as Text;
                    text.Attributes.Angle = rotang;
                    text.Attributes.PlacingAttributes.IsFixed = true;
                    text.Modify();
                }
            }
            DrawingHandler.SetMessageExecutionStatus(DrawingHandler.MessageExecutionModeEnum.INSTANT);
            handler.GetActiveDrawing().CommitChanges();
        }
Example #16
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            try
            {
                Model          model          = new Model();
                DrawingHandler drawingHandler = new DrawingHandler();

                ArrayList ModelObjectArray = new ArrayList();

                if (drawingHandler.GetActiveDrawing() != null)
                {
                    DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();
                    while (drawingObjectEnum.MoveNext())
                    {
                        Tekla.Structures.Drawing.ModelObject dModelObject = (Tekla.Structures.Drawing.ModelObject)drawingObjectEnum.Current;
                        ModelObjectArray.Add(model.SelectModelObject(dModelObject.ModelIdentifier));
                    }
                }
                else
                {
                    ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();
                    while (modelObjectEnum.MoveNext())
                    {
                        Tekla.Structures.Model.ModelObject modelObject = (Tekla.Structures.Model.ModelObject)modelObjectEnum.Current;
                        ModelObjectArray.Add(model.SelectModelObject(modelObject.Identifier));
                    }
                }

                Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
                modelObjectSelector.Select(ModelObjectArray);
                akit.Callback("acmdCreateViewBySelectedObjectsExtrema", "", "main_frame");
                akit.Callback("acmd_interrupt", "", "main_frame");
            }
            catch { }
        }
Example #17
0
        /// <summary>
        /// 绘制主梁法向与Y轴平行时的零件标记;
        /// </summary>
        private void DrawYVectorMark()
        {
            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            Vector xVector = new Vector(1, 0, 0);
            Vector yVector = new Vector(0, 1, 0);
            Vector zVector = new Vector(0, 0, 1);

            //1.绘制带螺钉的板的零件标记;
            foreach (CMrPart mrPart in mMrPartList)
            {
                double minY = mrPart.GetMinYPoint().Y;
                double maxY = mrPart.GetMaxYPoint().Y;

                Vector normal = mrPart.mNormal;

                //如果法向与Z轴平行并且有螺钉;
                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, zVector) && mrPart.IsHaveBolt())
                {
                    DS.SelectObject(mrPart.mPartInDrawing);

                    //2.绘制螺钉标记;
                    List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList();

                    foreach (CMrBoltArray mrBoltArray in mrBoltArrayList)
                    {
                        if (CDimTools.GetInstance().IsTwoVectorParallel(mrBoltArray.mNormal, zVector))
                        {
                            DS.SelectObject(mrBoltArray.mBoltInDrawing);
                        }
                    }
                }
                //如果法向与Z轴平行没有螺钉(暂且判定为凸起的螺帽);
                else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, zVector) && !mrPart.IsHaveBolt())
                {
                    if (minY > 0 || maxY < 0)
                    {
                        DS.SelectObject(mrPart.mPartInDrawing);
                    }
                }
                //如果法向与Y轴平行;
                else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, yVector))
                {
                    if (minY > 0 || maxY < 0)
                    {
                        DS.SelectObject(mrPart.mPartInDrawing);
                    }
                }
            }

            CDimTools.GetInstance().DrawMarkByMacro();
        }
Example #18
0
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();

            if (drawingObjectEnum.GetSize() == 1)
            {
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Bolt)
                    {
                        Tekla.Structures.Drawing.Bolt drawingBolt = (Tekla.Structures.Drawing.Bolt)drawingObjectEnum.Current;
                        boltRepresentation = drawingBolt.Attributes.Representation;
                        if (drawingBolt.Attributes.SymbolContainsAxis)
                        {
                            symbolContainsAxis = Bool.True;
                        }
                        else
                        {
                            symbolContainsAxis = Bool.False;
                        }
                        if (drawingBolt.Attributes.SymbolContainsHole)
                        {
                            symbolContainsHole = Bool.True;
                        }
                        else
                        {
                            symbolContainsHole = Bool.False;
                        }
                        colour = drawingBolt.Attributes.Color;
                    }
                }
            }
            else if (drawingObjectEnum.GetSize() > 1)
            {
                boltRepresentation = new Bolt.Representation();
                symbolContainsAxis = new Bool();
                SymbolContainsHole = new Bool();
                colour             = new DrawingColors();
            }
        }
Example #19
0
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();

            if (drawingObjectEnum.GetSize() == 1)
            {
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Mark)
                    {
                        Tekla.Structures.Drawing.Mark drawingMark = (Tekla.Structures.Drawing.Mark)drawingObjectEnum.Current;
                        frameColour = drawingMark.Attributes.Frame.Color;
                        frameType   = (FrameTypeEnum)Enum.Parse(typeof(FrameTypeEnum), drawingMark.Attributes.Frame.Type.ToString());
                    }
                }
            }
            else if (drawingObjectEnum.GetSize() > 1)
            {
                frameColour = new DrawingColors();
                FrameType   = new FrameTypeEnum();
            }
        }
Example #20
0
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();
            if (drawingObjectEnum.GetSize() == 1)
            {
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Symbol)
                    {
                        Tekla.Structures.Drawing.Symbol drawingSymbol = (Tekla.Structures.Drawing.Symbol)drawingObjectEnum.Current;
                        angle = drawingSymbol.Attributes.Angle.ToString();
                        colour = drawingSymbol.Attributes.Color;
                        frameColour = drawingSymbol.Attributes.Frame.Color;
                        frameType = (FrameTypeEnum)Enum.Parse(typeof(FrameTypeEnum), drawingSymbol.Attributes.Frame.Type.ToString());
                        height = drawingSymbol.Attributes.Height.ToString();
                        insertionPoint = drawingSymbol.InsertionPoint;

                        string placing = drawingSymbol.Placing.ToString().Replace("Tekla.Structures.Drawing.", "");
                        placingType = (PlacingTypeEnum)Enum.Parse(typeof(PlacingTypeEnum), placing);

                        symbolFile = drawingSymbol.SymbolInfo.SymbolFile;
                        symbolIndex = drawingSymbol.SymbolInfo.SymbolIndex.ToString();
                    }
                }
            }
            else if (drawingObjectEnum.GetSize() > 1)
            {
                angle = "";
                colour = new DrawingColors();
                frameColour = new DrawingColors();
                frameType = new FrameTypeEnum();
                height = "";
                insertionPoint = null;
                placingType = new PlacingTypeEnum();
                symbolFile = "";
                symbolIndex = "";
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            // select objects
            ArrayList               array          = new ArrayList();
            DrawingHandler          drawingHandler = new DrawingHandler();
            Drawing                 drawing        = drawingHandler.GetActiveDrawing();
            ContainerView           containerView  = drawing.GetSheet();
            DrawingObjectEnumerator drawingObjEnum = containerView.GetObjects();

            foreach (DrawingObject dobj in drawingObjEnum)
            {
                array.Add(dobj);
            }
            drawingHandler.GetDrawingObjectSelector().SelectObjects(array, false);
        }
        /// <summary>
        /// 绘制零件标记;
        /// </summary>
        public void DrawPartMark()
        {
            mViewBase.Select();

            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            foreach (CMrPart mrPart in mMrPartList)
            {
                if (mrPart.IsNeedAddMark())
                {
                    DS.SelectObject(mrPart.mPartInDrawing);
                }
            }
            CDimTools.GetInstance().DrawMarkByMacro();
        }
        /// <summary>
        /// 绘制檩托板的零件标记;
        /// </summary>
        private void DrawMrApronPlateMark()
        {
            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            Dictionary <CMrPart, CMrApronPlate> mapPartToMrApronPlate = CMrCylinderDoorFrontManager.GetInstance().mMapYNormalPartToMrApronPlate;

            foreach (CMrApronPlate mrApronPlate in mapPartToMrApronPlate.Values)
            {
                CMrPart yNormalPart = mrApronPlate.mYNormalPart;
                CMrPart zNormalPart = mrApronPlate.mZNormalPart;

                DS.SelectObject(yNormalPart.mPartInDrawing);
                DS.SelectObject(zNormalPart.mPartInDrawing);
            }
            CDimTools.GetInstance().DrawMarkByMacro();
        }
Example #24
0
        /// <summary>
        /// 绘制零件标记;
        /// </summary>
        public void DrawPartMark()
        {
            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            foreach (CMrPart mrPart in mMrPartList)
            {
                CMrMark mrMark = mrPart.GetCylinderDoorTopViewInfo().GetPartMark();

                if (null == mrMark)
                {
                    continue;
                }

                DS.SelectObject(mrPart.mPartInDrawing);
            }
            CDimTools.GetInstance().DrawMarkByMacro();
        }
        /// <summary>
        /// 绘制主梁上面的螺钉标记;
        /// </summary>
        private void DrawMainBeamBoltMark()
        {
            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            List <CMrBoltArray> mrBoltArrayList = mMainBeam.GetBoltArrayList();

            foreach (CMrBoltArray mrBoltArray in mrBoltArrayList)
            {
                if (!CDimTools.GetInstance().IsTwoVectorParallel(mrBoltArray.mNormal, new Vector(0, 0, 1)))
                {
                    continue;
                }
                DS.SelectObject(mrBoltArray.mBoltInDrawing);
            }

            CDimTools.GetInstance().DrawMarkByMacro();
        }
Example #26
0
        /// <summary>
        /// 绘制主梁上的螺钉标记;
        /// </summary>
        /// <param name="nFlag">nFlag=1:上翼板是倾斜。nFlag=2:上翼板向两侧倾斜</param>
        private void DrawMainBeamBoltMark(int nFlag)
        {
            List <CMrBoltArray> mrBoltArrayList = mMainBeam.GetBoltArrayList();
            Vector zVector = new Vector(0, 0, 1);

            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            foreach (CMrBoltArray mrBoltArray in mrBoltArrayList)
            {
                //只有与Z轴平行的螺钉组才进行编号;
                if (!CDimTools.GetInstance().IsTwoVectorParallel(zVector, mrBoltArray.mNormal))
                {
                    continue;
                }
                DS.SelectObject(mrBoltArray.mBoltInDrawing);
            }
        }
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            DrawingHandler myDrawingHandler = new DrawingHandler();
            if (myDrawingHandler.GetConnectionStatus())
            {
                DrawingObjectEnumerator selectedObjects = myDrawingHandler.GetDrawingObjectSelector().GetSelected();
                while (selectedObjects.MoveNext())
                {
                    if (selectedObjects.Current is StraightDimensionSet)
                    {
                        StraightDimensionSet curDimSet = selectedObjects.Current as TSD.StraightDimensionSet;
                        TSD.ContainerElement LUT = curDimSet.Attributes.LeftUpperTag as TSD.ContainerElement;
                        TSD.ContainerElement RUT = curDimSet.Attributes.RightUpperTag as TSD.ContainerElement;

                        curDimSet.Attributes.LeftUpperTag = RUT;
                        curDimSet.Attributes.RightUpperTag = LUT;
                        curDimSet.Modify();
                    }
                }
            }
        }
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            DrawingHandler myDrawingHandler = new DrawingHandler();

            if (myDrawingHandler.GetConnectionStatus())
            {
                DrawingObjectEnumerator selectedObjects = myDrawingHandler.GetDrawingObjectSelector().GetSelected();
                while (selectedObjects.MoveNext())
                {
                    if (selectedObjects.Current is StraightDimensionSet)
                    {
                        StraightDimensionSet curDimSet = selectedObjects.Current as TSD.StraightDimensionSet;
                        TSD.ContainerElement LUT       = curDimSet.Attributes.LeftUpperTag as TSD.ContainerElement;
                        TSD.ContainerElement RUT       = curDimSet.Attributes.RightUpperTag as TSD.ContainerElement;

                        curDimSet.Attributes.LeftUpperTag  = RUT;
                        curDimSet.Attributes.RightUpperTag = LUT;
                        curDimSet.Modify();
                    }
                }
            }
        }
        /// <summary>
        /// 初始化柱子的轴线;
        /// </summary>
        private void InitCylinderGridLine()
        {
            if (null == mViewBase)
            {
                return;
            }

            DrawingObjectEnumerator gridLines = mViewBase.GetAllObjects(typeof(TSD.GridLine));

            DrawingHandler drawingHandler = new DrawingHandler();

            TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector();

            while (gridLines.MoveNext())
            {
                GridLine gridLine = gridLines.Current as GridLine;

                if (gridLine == null)
                {
                    continue;
                }

                Point startPoint = gridLine.StartLabel.CenterPoint;
                Point endPoint   = gridLine.EndLabel.CenterPoint;

                Vector gridlineDirectionNormal = new Vector(endPoint.X - startPoint.X, endPoint.Y - startPoint.Y, endPoint.Z - startPoint.Z);

                if (!CDimTools.GetInstance().IsTwoVectorParallel(gridlineDirectionNormal, new Vector(1, 0, 0)))
                {
                    continue;
                }

                Point intersectionPoint = CDimTools.GetInstance().ComputeTwoLineIntersectPoint(startPoint, endPoint, new Point(0, 0, 0), new Point(0, 1000, 0));
                mIntersectionPointList.Add(intersectionPoint);
            }
        }
Example #30
0
        private void CopyObjects_Click(object sender, EventArgs e)
        {
            try
            {
                selectedObjects = drawingHandler.GetDrawingObjectSelector().GetSelected();

                selectedObjectsArray.Clear();
                selectedPartsArray.Clear();
                selectedViewsArray.Clear();

                foreach (DrawingObject drawingObject in selectedObjects)
                {
                    if (drawingObject is Tekla.Structures.Drawing.Part)
                    {
                        Tekla.Structures.Drawing.Part drawingPart = (Tekla.Structures.Drawing.Part)drawingObject;
                        selectedPartsArray.Add(drawingPart.ModelIdentifier);
                        v = (Tekla.Structures.Drawing.View)drawingPart.GetView();
                    }
                    if (drawingObject is Tekla.Structures.Drawing.View)
                    {
                        selectedViewsArray.Add(drawingObject);
                    }
                    if (drawingObject is Tekla.Structures.Drawing.GraphicObject)
                    {
                        selectedObjectsArray.Add(drawingObject);
                    }
                    if (drawingObject is Tekla.Structures.Drawing.Text)
                    {
                        selectedObjectsArray.Add(drawingObject);
                    }
                }
                int count = selectedObjectsArray.Count + selectedPartsArray.Count + selectedViewsArray.Count;
                statusLabel.Text = count.ToString() + " objects copied";
            }
            catch { }
        }
Example #31
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            try
            {
                Model          model          = new Model();
                DrawingHandler drawingHandler = new DrawingHandler();
                Drawing        drawing        = drawingHandler.GetActiveDrawing();

                if (drawing != null)
                {
                    Tekla.Structures.Drawing.StraightDimension sd   = null;
                    Tekla.Structures.Drawing.Bolt bolt              = null;
                    DrawingObjectEnumerator       drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();
                    while (drawingObjectEnum.MoveNext())
                    {
                        if (drawingObjectEnum.Current is Tekla.Structures.Drawing.StraightDimension)
                        {
                            sd = (Tekla.Structures.Drawing.StraightDimension)drawingObjectEnum.Current;
                        }
                        if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Bolt)
                        {
                            bolt = (Tekla.Structures.Drawing.Bolt)drawingObjectEnum.Current;
                        }
                    }

                    if (bolt == null)
                    {
                        Tekla.Structures.Drawing.UI.Picker picker = drawingHandler.GetPicker();
                        DrawingObject drawingObject = null;
                        Tekla.Structures.Drawing.ViewBase viewBase    = null;
                        Tekla.Structures.Geometry3d.Point pickedPoint = null;
                        Type[] TypeFilter = new Type[] { typeof(Tekla.Structures.Drawing.Bolt) };

                        picker.PickObject("pick bolt", TypeFilter, out drawingObject, out viewBase, out pickedPoint);
                        bolt = (Tekla.Structures.Drawing.Bolt)drawingObject;
                    }

                    Tekla.Structures.Model.BoltGroup mBolt = (Tekla.Structures.Model.BoltGroup)model.SelectModelObject((Identifier)bolt.ModelIdentifier);
                    string note = "";
                    if (mBolt is BoltArray)
                    {
                        BoltArray boltArray = (BoltArray)mBolt;

                        if (boltArray.GetBoltDistYCount() == 1 && boltArray.GetBoltDistY(0) == 0)
                        {
                            note = (mBolt.BoltPositions.Count - 1).ToString() + " No SPACES @ " + boltArray.GetBoltDistX(1).ToString() + " = ";
                        }

                        if (boltArray.GetBoltDistY(0) > 0)
                        {
                        }
                    }
                    else if (mBolt is BoltXYList)
                    {
                        BoltXYList boltXYList = (BoltXYList)mBolt;
                        note = (boltXYList.BoltPositions.Count - 1).ToString() + " STAGGERED No SPACES @ " + (boltXYList.GetBoltDistX(1)).ToString() + " = ";
                    }

                    Tekla.Structures.Drawing.UI.DrawingObjectSelector drawingObjectSelector = drawingHandler.GetDrawingObjectSelector();
                    drawingObjectSelector.SelectObject(sd);

                    akit.ValueChange("main_frame", "gr_sel_dimension", "1");
                    akit.Callback("acmd_display_attr_dialog", "dim_dial", "main_frame");
                    akit.PushButton("dim_set", "dim_dial");
                    akit.TabChange("dim_dial", "tabWndDimAttrib", "tabMarks");
                    akit.PushButton("dim_on_off", "dim_dial");
                    akit.ValueChange("dim_dial", "txtFldPrefix", note);
                    akit.PushButton("dim_modify", "dim_dial");
                    akit.PushButton("dim_cancel", "dim_dial");
                }
            }
            catch { }
        }