Example #1
0
        private void AddView(string Name, TSD.Drawing MyDrawing, ArrayList Parts, TSG.CoordinateSystem coordinateSystem)
        {
            TSD.View MyView = new TSD.View(MyDrawing.GetSheet(), coordinateSystem, coordinateSystem, Parts);

            MyView.Name = Name;
            MyView.Insert();
        }
Example #2
0
        private DrawingObject getSingleObjectFromUser <T>()
        {
            DrawingHandler myDrawingHandler = new TSDrg.DrawingHandler();

            TSDrg.UI.Picker pointPicker = myDrawingHandler.GetPicker();
            DrawingObject   usrObject   = null;
            ViewBase        myViewBase  = null;

            TSDrg.View myView = myViewBase as TSDrg.View;

            try
            {
                pointPicker.PickObject("Please select a bar", out usrObject, out myViewBase);
                myView = myViewBase as TSDrg.View;

                while (myView == null || !(usrObject is T))
                {
                    pointPicker.PickObject("Please select a bar", out usrObject, out myViewBase);
                    myView = myViewBase as TSDrg.View;
                }

                return(usrObject);
            }

            catch (Tekla.Structures.Drawing.PickerInterruptedException interrupted)
            {
                //Tekla.Structures.Model.Operations.Operation.DisplayPrompt("THIS METHOD NOT WORKING BECAUSE TEKLA API IS THE WORST THING I HAVE EVER WORKED WITH");
                lbl_info.Text = "User interrupted action.";
                return(usrObject);
            }
        }
Example #3
0
        /// <summary>
        /// 框架结构的一键标注;
        /// </summary>
        /// <param name="nType"></param>
        public void DrawDrawingOneKey(string strDimType)
        {
            DrawingHandler drawingHandler = new DrawingHandler();
            Drawing        drawing        = drawingHandler.GetActiveDrawing();

            if (null == drawing)
            {
                return;
            }
            AssemblyDrawing assemblyDrawing = drawing as AssemblyDrawing;

            if (assemblyDrawing == null)
            {
                return;
            }
//             try
//             {
            Assembly assembly = new Assembly
            {
                Identifier = assemblyDrawing.AssemblyIdentifier
            };

            assembly.Select();
            Identifier identifier = assembly.GetMainPart().Identifier;

            TSM.Part modelObject = mModel.SelectModelObject(identifier) as TSM.Part;

            //1.首先创建自动剖面;
            if (CCommonPara.mAutoSectionType == MrAutoSectionType.MrOneKeyDim || CCommonPara.mAutoSectionType == MrAutoSectionType.MrTwoTypeDim)
            {
                CreateAutoSection(strDimType, modelObject, assemblyDrawing);
            }

            //2.对图纸进行标注;
            DrawingObjectEnumerator allViews = assemblyDrawing.GetSheet().GetAllViews();

            while (allViews.MoveNext())
            {
                if (allViews.Current != null)
                {
                    TSD.View view = allViews.Current as TSD.View;

                    if (view != null)
                    {
                        DrawDrawingByView(view, modelObject, strDimType);
                    }
                }
            }
            assemblyDrawing.IsFrozen = true;
            assemblyDrawing.PlaceViews();
            assemblyDrawing.Modify();
//             }
//             catch (System.Exception ex)
//             {
//                 string strName = assemblyDrawing.Name;
//                 MessageBox.Show("图纸" + strName + "标注失败,请确认模型或图纸内是否有问题。异常信息:" + ex.Message);
//             }

            MessageBox.Show("扬州Tekla培训石头哥提示您标注结束,感谢您对智能标注系统的支持。");
        }
Example #4
0
        public void Modify(PropertyValueChangedEventArgs e)
        {
            string  label   = e.ChangedItem.Label;
            Drawing drawing = drawingHandler.GetActiveDrawing();
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();

            while (drawingObjectEnum.MoveNext())
            {
                if (drawingObjectEnum.Current is Tekla.Structures.Drawing.View)
                {
                    Tekla.Structures.Drawing.View drawingView = (Tekla.Structures.Drawing.View)drawingObjectEnum.Current;
                    if (label == "Scale")
                    {
                        drawingView.Attributes.Scale = double.Parse(scale);
                    }
                    if (label == "SizeXMin")
                    {
                        drawingView.RestrictionBox.MinPoint.X = double.Parse(sizeXMin);
                    }
                    if (label == "SizeXMax")
                    {
                        drawingView.RestrictionBox.MaxPoint.X = double.Parse(sizeXMax);
                    }
                    if (label == "SizeYMin")
                    {
                        drawingView.RestrictionBox.MinPoint.Y = double.Parse(sizeYMin);
                    }
                    if (label == "SizeYMax")
                    {
                        drawingView.RestrictionBox.MaxPoint.Y = double.Parse(sizeYMax);
                    }
                    if (label == "SizeDepthDown")
                    {
                        drawingView.RestrictionBox.MinPoint.Z = double.Parse(sizeDepthDown) * -1;
                    }
                    if (label == "SizeDepthUp")
                    {
                        drawingView.RestrictionBox.MaxPoint.Z = double.Parse(sizeDepthUp);
                    }
                    if (label == "ViewExtension")
                    {
                        drawingView.Attributes.ViewExtensionForNeighbourParts = double.Parse(viewExtension);
                    }
                    if (label == "FixedViewPlacing")
                    {
                        drawingView.Attributes.FixedViewPlacing = bool.Parse(fixedViewPlacing.ToString());
                    }
                    if (label == "CutParts")
                    {
                        drawingView.Attributes.Shortening.CutParts = bool.Parse(cutParts.ToString());
                    }
                    if (label == "MinimumLength")
                    {
                        drawingView.Attributes.Shortening.MinimumLength = double.Parse(minimumLength);
                    }
                    drawingView.Modify();
                    drawing.CommitChanges();
                }
            }
        }
Example #5
0
        private TSDrg.StraightDimensionSet CreateNewDim(TSDrg.View view, TSDrg.PointList pointList)
        {
            TSG.Vector upDirection;

            if (checkBox1.Checked)
            {
                upDirection = new TSG.Vector(1, 0, 0);
            }
            else if (checkBox2.Checked)
            {
                upDirection = new TSG.Vector(0, 1, 0);
            }
            else
            {
                lbl_status.Text = "Please select dimension orientation";
                upDirection     = new TSG.Vector(1, 0, 0);
            }

            double height = 0.0;

            TSDrg.StraightDimensionSet.StraightDimensionSetAttributes attr = new TSDrg.StraightDimensionSet.StraightDimensionSetAttributes();

            TSDrg.StraightDimensionSetHandler myDimSetHandler = new TSDrg.StraightDimensionSetHandler();
            TSDrg.StraightDimensionSet        newDim          = myDimSetHandler.CreateDimensionSet(view, pointList, upDirection, height, attr);
            return(newDim);
        }
Example #6
0
        private Tuple <TSG.Point, TSDrg.View> GetPointViewFromUser()
        {
            TSDrg.DrawingHandler myDrawingHandler = new TSDrg.DrawingHandler();
            TSDrg.UI.Picker      pointPicker      = myDrawingHandler.GetPicker();
            TSG.Point            myPoint          = null;
            TSDrg.ViewBase       myViewBase       = null;
            TSDrg.View           myView           = myViewBase as TSDrg.View;

            try
            {
                pointPicker.PickPoint("Pick a point to insert dimesnion", out myPoint, out myViewBase);
                myView = myViewBase as TSDrg.View;

                while (myView == null)
                {
                    pointPicker.PickPoint("Selected point is not inside a view. Pick a point to insert dimension", out myPoint, out myViewBase);
                    myView = myViewBase as TSDrg.View;
                }

                return(new Tuple <TSG.Point, TSDrg.View>(myPoint, myView));
            }

            catch (Tekla.Structures.Drawing.PickerInterruptedException interrupted)
            {
                //Tekla.Structures.Model.Operations.Operation.DisplayPrompt("THIS METHOD NOT WORKING BECAUSE TEKLA API IS THE WORST THING I HAVE EVER WORKED WITH");
                lbl_status.Text = "User interrupted action.";
                return(new Tuple <TSG.Point, TSDrg.View>(myPoint, myView));
            }
        }
 /// <summary>
 /// 构造函数;
 /// </summary>
 /// <param name="viewBase"></param>
 /// <param name="model"></param>
 public CCylinderTopView(TSD.View viewBase, Model model) : base(viewBase)
 {
     mViewBase      = viewBase;
     mModel         = model;
     mLeftTopPoint  = new Point();
     mRightTopPoint = new Point();
 }
Example #8
0
        private Tuple <TSDrg.PointList, TSDrg.View> getRectangleCornersFromUser()
        {
            TSDrg.DrawingHandler myDrawingHandler = new TSDrg.DrawingHandler();
            TSDrg.UI.Picker      pointPicker      = myDrawingHandler.GetPicker();
            TSDrg.PointList      myPoints         = null;
            TSDrg.ViewBase       myViewBase       = null;
            TSDrg.View           myView           = myViewBase as TSDrg.View;
            TSDrg.StringList     promptMsg        = new TSDrg.StringList();
            promptMsg.Add("Select first corner of the rectangle");
            promptMsg.Add("Select second corner of the rectangle");

            try
            {
                pointPicker.PickPoints(2, promptMsg, out myPoints, out myViewBase);
                myView = myViewBase as TSDrg.View;

                while (myView == null)
                {
                    pointPicker.PickPoints(2, promptMsg, out myPoints, out myViewBase);
                    myView = myViewBase as TSDrg.View;
                }

                return(new Tuple <TSDrg.PointList, TSDrg.View>(myPoints, myView));
            }

            catch (Tekla.Structures.Drawing.PickerInterruptedException interrupted)
            {
                //Tekla.Structures.Model.Operations.Operation.DisplayPrompt("THIS METHOD NOT WORKING BECAUSE TEKLA API IS THE WORST THING I HAVE EVER WORKED WITH");
                lbl_info.Text = "User interrupted action.";
                return(new Tuple <TSDrg.PointList, TSDrg.View>(myPoints, myView));
            }
        }
Example #9
0
        /// <summary>
        /// 绘制门式框架结构中选择的多张图纸;
        /// </summary>
        public void DrawSelectListDrawingDoor()
        {
            DrawingHandler drawingHandler = new DrawingHandler();

            foreach (CMrAssemblyDrawing mrDrawing in mrAssemblyDrawingList)
            {
                AssemblyDrawing assemblyDrawing = mrDrawing.mAssemblyDring;

                Identifier assemblyDrawingIdentifier = assemblyDrawing.AssemblyIdentifier;

                if (assemblyDrawing == null)
                {
                    continue;
                }
                try
                {
                    Assembly assembly = new Assembly
                    {
                        Identifier = assemblyDrawing.AssemblyIdentifier
                    };

                    assembly.Select();
                    Identifier identifier  = assembly.GetMainPart().Identifier;
                    Beam       modelObject = mModel.SelectModelObject(identifier) as Beam;
                    drawingHandler.SetActiveDrawing(assemblyDrawing, true);
                    DrawingObjectEnumerator allViews = assemblyDrawing.GetSheet().GetAllViews();

                    while (allViews.MoveNext())
                    {
                        if (allViews.Current != null)
                        {
                            TSD.View view = allViews.Current as TSD.View;

                            if (view != null)
                            {
                                DrawDrawingDoorByView(view, modelObject, mrDrawing.mDimType);
                            }
                        }
                    }
                    assemblyDrawing.IsFrozen = true;
                    assemblyDrawing.PlaceViews();
                    assemblyDrawing.Modify();
                    drawingHandler.SaveActiveDrawing();
                    drawingHandler.CloseActiveDrawing();
                }
                catch (System.Exception ex)
                {
                    string strName = assemblyDrawing.Name;

                    MessageBox.Show("图纸" + strName + "标注失败,请确认模型或图纸内是否有问题。异常信息:" + ex.Message);
                    drawingHandler.SaveActiveDrawing();
                    drawingHandler.CloseActiveDrawing();
                    continue;
                }
            }
            MessageBox.Show("扬州Tekla培训石头哥提示您标注结束,感谢您对智能标注系统的支持。");
        }
Example #10
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    = "";
            }
        }
Example #11
0
        /// <summary>
        /// 初始化视图;
        /// </summary>
        /// <param name="view"></param>
        private void InitView(TSD.View view)
        {
            Point maxPoint = view.RestrictionBox.MaxPoint;
            Point minPoint = view.RestrictionBox.MinPoint;

            CCommonPara.mViewMaxX  = maxPoint.X;
            CCommonPara.mViewMinX  = minPoint.X;
            CCommonPara.mViewMinY  = minPoint.Y;
            CCommonPara.mViewMaxY  = maxPoint.Y;
            CCommonPara.mViewScale = view.Attributes.Scale;
        }
Example #12
0
        private static bool isView2D(TSD.View currentView)
        {
            T3D.CoordinateSystem disp  = currentView.DisplayCoordinateSystem as T3D.CoordinateSystem;
            T3D.CoordinateSystem viewp = currentView.ViewCoordinateSystem as T3D.CoordinateSystem;

            if (disp.AxisX.Z != viewp.AxisX.Z || disp.AxisY.Z != viewp.AxisY.Z)
            {
                return(false);
            }

            return(true);
        }
Example #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            //reset dialog
            resetFormStatus();

            //get insertion point inpit from user
            Tuple <TSG.Point, TSDrg.View> usrInp = GetPointViewFromUser();

            TSG.Point  basePoint = usrInp.Item1;
            TSG.Point  endPoint;
            TSDrg.View currentView = usrInp.Item2;

            if (basePoint == null)
            {
                return;
            }

            //create dimension
            foreach (DataGridViewRow row in dgv_dimTable.Rows)
            {
                if (row.Index < dgv_dimTable.Rows.Count - 1)
                {
                    var    dimLengthInp = row.Cells["dimLength"].Value;
                    double dimLength    = Convert.ToDouble(dimLengthInp.ToString());

                    if (checkBox1.Checked)
                    {
                        endPoint = new TSG.Point(basePoint.X, basePoint.Y + dimLength);
                    }
                    else if (checkBox2.Checked)
                    {
                        endPoint = new TSG.Point(basePoint.X + dimLength, basePoint.Y);
                    }
                    else
                    {
                        lbl_status.Text = "Please select dimension orientation";
                        return;
                    }


                    TSDrg.PointList pointList = new TSDrg.PointList();
                    pointList.Add(basePoint);
                    pointList.Add(endPoint);

                    TSDrg.StraightDimensionSet newDimSet = CreateNewDim(currentView, pointList);
                    newDimSet.Select();
                    newDimSet.Attributes.LoadAttributes(txb_preset.Text);
                    newDimSet.Modify();
                    basePoint = endPoint;
                }
            }
        }
        public static ArrayList factorPointArray(ArrayList pps, TSD.View vv)
        {
            ArrayList factored = new ArrayList();

            T3D.Matrix convMatrix = T3D.MatrixFactory.ToCoordinateSystem(vv.DisplayCoordinateSystem);

            foreach (T3D.Point pp in pps)
            {
                T3D.Point fp = convMatrix.Transform(pp);
                factored.Add(fp);
            }

            return(factored);
        }
Example #15
0
        private void AddRotatedView(String Name, Drawing MyDrawing, ArrayList Parts, Tekla.Structures.Geometry3d.CoordinateSystem coordinateSystem)
        {
            Tekla.Structures.Geometry3d.CoordinateSystem displayCoordinateSystem = new Tekla.Structures.Geometry3d.CoordinateSystem();
            Tekla.Structures.Geometry3d.Matrix           AroundX = Tekla.Structures.Geometry3d.MatrixFactory.Rotate(20.0 * Math.PI * 2.0 / 360.0, coordinateSystem.AxisX);
            Tekla.Structures.Geometry3d.Matrix           AroundZ = Tekla.Structures.Geometry3d.MatrixFactory.Rotate(30.0 * Math.PI * 2.0 / 360.0, coordinateSystem.AxisY);

            Tekla.Structures.Geometry3d.Matrix Rotation = AroundX * AroundZ;

            displayCoordinateSystem.AxisX = new Tekla.Structures.Geometry3d.Vector(Rotation.Transform(new Tekla.Structures.Geometry3d.Point(coordinateSystem.AxisX)));
            displayCoordinateSystem.AxisY = new Tekla.Structures.Geometry3d.Vector(Rotation.Transform(new Tekla.Structures.Geometry3d.Point(coordinateSystem.AxisY)));
            Tekla.Structures.Drawing.View RotatedView = new Tekla.Structures.Drawing.View(MyDrawing.GetSheet(), coordinateSystem, displayCoordinateSystem, Parts);

            RotatedView.Name = Name;
            RotatedView.Insert();
        }
Example #16
0
        private void AddRotatedView(string Name, TSD.Drawing MyDraiwng, ArrayList Parts, TSG.CoordinateSystem coordinateSystem)
        {
            TSG.CoordinateSystem displayCoordinateSystem = new TSG.CoordinateSystem();

            TSG.Matrix RotationAroundX = TSG.MatrixFactory.Rotate(20.0 * Math.PI * 2.0 / 360.0, coordinateSystem.AxisX);
            TSG.Matrix RotationAroundZ = TSG.MatrixFactory.Rotate(30.0 * Math.PI * 2.0 / 360.0, coordinateSystem.AxisY);

            TSG.Matrix Rotation = RotationAroundX * RotationAroundZ;

            displayCoordinateSystem.AxisX = new TSG.Vector(Rotation.Transform(new TSG.Point(coordinateSystem.AxisX)));
            displayCoordinateSystem.AxisY = new TSG.Vector(Rotation.Transform(new TSG.Point(coordinateSystem.AxisY)));

            TSD.View FrontView = new TSD.View(MyDraiwng.GetSheet(), coordinateSystem, displayCoordinateSystem, Parts);

            FrontView.Name = Name;
            FrontView.Insert();
        }
Example #17
0
        public static void pview(TSD.View vv)
        {
            MainForm._form.add_text("---  VIEW  ---");
            pcor(vv.DisplayCoordinateSystem, "DisplayCoordinateSystem");
            pcor(vv.ViewCoordinateSystem, "ViewCoordinateSystem");

            //ppoint(vv.ExtremaCenter, "ExtremaCenter");
            //pvector(vv.FrameOrigin, "FrameOrigin");

            //Form1._form.add_text("IsSheet : " + vv.IsSheet.ToString());
            //Form1._form.add_text("Name : " + vv.Name);
            ppoint(vv.Origin, "Origin");

            //Form1._form.add_text("Height : " + vv.Height.ToString("F1"));
            //Form1._form.add_text("Width : " + vv.Width.ToString("F1"));
            //Form1._form.add_text("");
        }
Example #18
0
        /// <summary>
        /// 创建梁的门式框架结构的前视图;
        /// </summary>
        public void CreateBeamDoorFrontView()
        {
            ViewBase  frontViewBase = null;
            PointList pointList     = new PointList();

            CDimTools.GetInstance().PickPoints(1, ref pointList, ref frontViewBase);

            if (frontViewBase != null)
            {
                frontViewBase.Select();
                TSD.View           frontView  = frontViewBase as TSD.View;
                CBeamDoorFrontView mFrontView = new CBeamDoorFrontView(frontView, mModel);

                InitMainPart();
                InitView(frontView);
                mFrontView.CreateDim();
            }
        }
Example #19
0
        /// <summary>
        /// 创建柱的门式框架结构顶视图;
        /// </summary>
        public void CreateCylinderDoorTopView()
        {
            ViewBase  topViewBase = null;
            PointList pointList   = new PointList();

            CDimTools.GetInstance().PickPoints(1, ref pointList, ref topViewBase);

            if (topViewBase != null)
            {
                topViewBase.Select();
                TSD.View             topView  = topViewBase as TSD.View;
                CCylinderDoorTopView mTopView = new CCylinderDoorTopView(topView, mModel);

                InitMainPart();
                InitView(topView);
                mTopView.CreateDim();
            }
        }
Example #20
0
        /// <summary>
        /// 创建柱的门式框架结构剖视图;
        /// </summary>
        public void CreateCylinderDoorSectionView()
        {
            ViewBase  sectionViewBase = null;
            PointList pointList       = new PointList();

            CDimTools.GetInstance().PickPoints(1, ref pointList, ref sectionViewBase);

            if (sectionViewBase != null)
            {
                sectionViewBase.Select();
                TSD.View sectionView = sectionViewBase as TSD.View;
                CCylinderDoorSectionView mSectionView = new CCylinderDoorSectionView(sectionView, mModel);

                InitMainPart();
                InitView(sectionView);
                mSectionView.CreateDim();
            }
        }
Example #21
0
        private void GetModelObjectStartAndEndPoint(TSM.ModelObject modelObject, View partView, out Point partStartPoint, out Point PartEndPoint)
        {
            TSM.Part modelPart = (TSM.Part)modelObject;

            TransformationPlane savePlane = new Model().GetWorkPlaneHandler().GetCurrentTransformationPlane();

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

            partStartPoint   = modelPart.GetSolid().MinimumPoint;
            partStartPoint.Z = 0.0;
            PartEndPoint     = modelPart.GetSolid().MaximumPoint;

            Matrix convMatrix = MatrixFactory.ToCoordinateSystem(partView.DisplayCoordinateSystem);

            partStartPoint = convMatrix.Transform(partStartPoint);
            PartEndPoint   = convMatrix.Transform(PartEndPoint);

            new Model().GetWorkPlaneHandler().SetCurrentTransformationPlane(savePlane);
        }
        /// <summary>
        /// Edit opened drawing, take string from dialog and write it under every view in the drawing.
        /// Draws also rectangle around the text string.
        /// </summary>
        private void EditOpenedDrawing()
        {
            if (MyDrawingHandler.GetConnectionStatus())
            {
                Drawing MyDrawing = MyDrawingHandler.GetActiveDrawing();

                ContainerView           Sheet            = MyDrawing.GetSheet();
                DrawingObjectEnumerator MyViewEnumerator = Sheet.GetViews();

                //Looping through views in the drawing
                while (MyViewEnumerator.MoveNext())
                {
                    View CurrentView = MyViewEnumerator.Current as View; //If ViewBase used instead of View, then multidrawing's container views would work here also

                    if (CurrentView != null)
                    {
                        //Getting bounding box for the view frame and calculating then the CenterPoint under it
                        RectangleBoundingBox ViewAABB = CurrentView.GetAxisAlignedBoundingBox();
                        Point CenterPoint             = new Point();
                        CenterPoint.X = ViewAABB.LowerLeft.X + (ViewAABB.LowerRight.X - ViewAABB.LowerLeft.X) / 2.0;
                        CenterPoint.Y = ViewAABB.LowerLeft.Y - 5.0;  //5.0 mm below the view's bounding box

                        Text MyViewTitle = new Text(Sheet, CenterPoint, ViewTitle.Text, new Text.TextAttributes());
                        if (!MyViewTitle.Insert())
                        {
                            Console.WriteLine("Insert failed.");
                        }
                        else
                        {
                            RectangleBoundingBox TitleAABB = MyViewTitle.GetAxisAlignedBoundingBox();
                            Rectangle            myBox     = new Rectangle(Sheet, TitleAABB.LowerLeft, TitleAABB.UpperRight);
                            myBox.Insert();
                        }
                    }
                }
                MyDrawing.CommitChanges();
            }
        }
Example #23
0
        public void LuoPiirros()
        {
            if (laatanLeveys == 0 || laatanKorkeus == 0)
            {
                throw new NullReferenceException("Laske tasaukset!");
            }
            Drawing.DrawingHandler dHandler = new Drawing.DrawingHandler();
            Drawing.Drawing        drawing  = new Drawing.GADrawing("standard");

            CoordinateSystem cSystem = new CoordinateSystem(new Point(), new Vector(1, 0, 0), new Vector(0, 1, 0));

            Drawing.View view = new Drawing.View(drawing.GetSheet(), cSystem, cSystem, new AABB(new Point(-500, -500), new Point(laatanLeveys, laatanKorkeus, 3300)));
            if (!view.Attributes.LoadAttributes(Paaikkuna.HAKEMISTO + @"\Tiedostot\kantavat_laatat.vi"))
            {
                view.Attributes.LoadAttributes("standard");
            }
            view.Attributes.Scale = 50.0;
            view.Attributes.Shortening.CutParts = false;
            drawing.PlaceViews();
            drawing.Insert();
            dHandler.SetActiveDrawing(drawing);
            view.Insert();
        }
Example #24
0
        public static double getHighestScale(TSD.Drawing currentDrawing)
        {
            double highestScale = 0;

            TSD.DrawingObjectEnumerator ViewEnum = currentDrawing.GetSheet().GetViews();

            while (ViewEnum.MoveNext())
            {
                if (ViewEnum.Current is TSD.View)
                {
                    TSD.View currentView = ViewEnum.Current as TSD.View;

                    if (isView2D(currentView))
                    {
                        double currentScale = currentView.Attributes.Scale;
                        highestScale = Math.Max(currentScale, highestScale);
                    }
                }
            }

            MainWindow._form.consoleOutput("EXPORT - Scale: " + highestScale.ToString(), "L2");

            return(highestScale);
        }
Example #25
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 { }
        }
        private static void createDetailMarks(List <TSD.DetailMark> input, List <TSD.DetailMark> output, TSD.View outputView)
        {
            foreach (TSD.DetailMark inputDetail in input)
            {
                T3D.Point centerPoint   = __GeometryOperations.applyGlobalOffset(inputDetail.CenterPoint);
                T3D.Point boundaryPoint = __GeometryOperations.applyGlobalOffset(inputDetail.BoundaryPoint);
                T3D.Point labelPoint    = __GeometryOperations.applyGlobalOffset(inputDetail.LabelPoint);

                bool found = false;
                foreach (TSD.DetailMark outputDetailMark in output)
                {
                    if (outputDetailMark.CenterPoint == centerPoint &&
                        outputDetailMark.BoundaryPoint == boundaryPoint &&
                        outputDetailMark.LabelPoint == labelPoint)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == false)
                {
                    TSD.DetailMark outputDetailMark = new TSD.DetailMark(outputView, centerPoint, boundaryPoint, labelPoint);
                    outputDetailMark.Attributes = inputDetail.Attributes;
                    outputDetailMark.Insert();
                }
            }
        }
        private static void createSectionMarks(List <_SectionMark> input, List <_SectionMark> output, TSD.View outputView)
        {
            foreach (_SectionMark inputSection in input)
            {
                T3D.Point leftPoint  = __GeometryOperations.applyGlobalOffset(inputSection._obj.LeftPoint);
                T3D.Point rightPoint = __GeometryOperations.applyGlobalOffset(inputSection._obj.RightPoint);

                bool found = false;
                foreach (_SectionMark outputSectionMark in output)
                {
                    if (outputSectionMark._obj.LeftPoint == leftPoint &&
                        outputSectionMark._obj.RightPoint == rightPoint)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == false)
                {
                    TSD.SectionMark outputSectionMark = new TSD.SectionMark(outputView, leftPoint, rightPoint);
                    outputSectionMark.Attributes = inputSection._obj.Attributes;

                    //if (inputSection._txt != null)
                    //{
                    //    outputSectionMark.Attributes.TagsAttributes.TagA2.TagContent.Clear();
                    //    outputSectionMark.Attributes.TagsAttributes.TagA2.TagContent.Add(inputSection._txt);
                    //    outputSectionMark.Modify();
                    //}

                    outputSectionMark.Insert();
                }
            }
        }
 private static void repositionViewWithOffset(TSD.View input, TSD.View output)
 {
     T3D.Point minus       = __GeometryOperations.getLocalOffset(__GeometryOperations.sheetOutputPoint, __GeometryOperations.sheetInputPoint);
     T3D.Point localOffset = __GeometryOperations.applyLocalOffset(output.Origin, minus);
     output.Origin = localOffset;
 }
Example #29
0
        /// <summary>
        /// 获取图纸中的视图信息;
        /// </summary>
        private void GetDrawingViewInfo()
        {
            DrawingObjectEnumerator allViews = mAssemblyDrawing.GetSheet().GetAllViews();

            while (allViews.MoveNext())
            {
                if (allViews.Current == null)
                {
                    continue;
                }

                TSD.View view = allViews.Current as TSD.View;

                if (view == null)
                {
                    continue;
                }

                view.Select();

                //创建自定义的主梁对象;
                CMrMainBeam mainBeam = new CMrMainBeam(mMainPart, null);
                CMrMainBeam.SetInstance(mainBeam);

                double dblFlangeThickness = 0.0;
                double dblWebThickness    = 0.0;

                mMainPart.GetReportProperty("PROFILE.FLANGE_THICKNESS", ref dblFlangeThickness);
                mMainPart.GetReportProperty("PROFILE.WEB_THICKNESS", ref dblWebThickness);

                mainBeam.mFlangeThickness = dblFlangeThickness;
                mainBeam.mWebThickness    = dblWebThickness;

                int size = view.GetObjects(new Type[] { typeof(TSD.Part) }).GetSize();

                if (size == 0 || size == 1)
                {
                    continue;
                }

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

                CDimTools.GetInstance().InitMrPart(mMainPart, view, mainBeam);

                Vector vector         = mainBeam.mNormal;
                double minY           = mainBeam.GetMinYPoint().Y;
                double maxY           = mainBeam.GetMaxYPoint().Y;
                double mainBeamHeight = Math.Abs(maxY - minY);

                //顶视图标注;
                if (CDimTools.GetInstance().IsTwoVectorParallel(vector, xVector))
                {
                    Point viewMinPoint = view.RestrictionBox.MinPoint;
                    Point viewMaxPoint = view.RestrictionBox.MaxPoint;

                    double viewHeight = Math.Abs(viewMaxPoint.Y - viewMinPoint.Y);

                    if (CDimTools.GetInstance().CompareTwoDoubleValue(viewHeight, mainBeamHeight) >= 0)
                    {
                        continue;
                    }
                    else
                    {
                        mAllSectionViewList.Add(view);
                    }
                }
                //前视图标注;
                else if (CDimTools.GetInstance().IsTwoVectorParallel(vector, zVector))
                {
                    Point viewMinPoint = view.RestrictionBox.MinPoint;
                    Point viewMaxPoint = view.RestrictionBox.MaxPoint;

                    double viewHeight = Math.Abs(viewMaxPoint.Y - viewMinPoint.Y);

                    if (CDimTools.GetInstance().CompareTwoDoubleValue(viewHeight, mainBeamHeight) >= 0)
                    {
                        mFrontView = view;
                    }
                    else
                    {
                        mAllSectionViewList.Add(view);
                    }
                }
                //剖视图标注;
                else
                {
                    mAllSectionViewList.Add(view);
                }
            }
        }
Example #30
0
 /// <summary>
 /// 门式框架结构顶视图对象;
 /// </summary>
 /// <param name="viewBase"></param>
 /// <param name="model"></param>
 public CCylinderDoorTopView(TSD.View viewBase, Model model)
     : base(viewBase)
 {
     mViewBase = viewBase;
     mModel    = model;
 }