当前位置: 首页>>代码示例>>C#>>正文


C# Point3d.TransformBy方法代码示例

本文整理汇总了C#中Point3d.TransformBy方法的典型用法代码示例。如果您正苦于以下问题:C# Point3d.TransformBy方法的具体用法?C# Point3d.TransformBy怎么用?C# Point3d.TransformBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point3d的用法示例。


在下文中一共展示了Point3d.TransformBy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetRotatedAndMovedPoint

 public static Point3d GetRotatedAndMovedPoint(Point3d p, double xr, double yr, double zr, Vector3d moveV)
 {
     p = p.TransformBy(Matrix3d.Rotation(xr * System.Math.PI / 180, Vector3d.XAxis, Point3d.Origin));
     p = p.TransformBy(Matrix3d.Rotation(yr * System.Math.PI / 180, Vector3d.YAxis, Point3d.Origin));
     p = p.TransformBy(Matrix3d.Rotation(zr * System.Math.PI / 180, Vector3d.ZAxis, Point3d.Origin));
     p = p.TransformBy(Matrix3d.Displacement(moveV));
     return p;
 }
开发者ID:komelio,项目名称:Dimeng.LinkToMicrocad,代码行数:8,代码来源:MathHelper.cs

示例2: GetTangentsTo

        /// <summary>
        /// Returns the tangents between the active CircularArc3d instance complete circle and a point.
        /// </summary>
        /// <remarks>
        /// Tangents start points are on the object to which this method applies, end points on the point passed as argument.
        /// Tangents are always returned in the same order: the tangent on the left side of the line from the circular arc center
        /// to the point before the one on the right side. 
        /// </remarks>
        /// <param name="arc">The instance to which this method applies.</param>
        /// <param name="pt">The Point3d to which tangents are searched</param>
        /// <returns>An array of LineSegement3d representing the tangents (2) or null if there is none.</returns>
        /// <exception cref="Autodesk.AutoCAD.Runtime.Exception">
        /// eNonCoplanarGeometry is thrown if the objects do not lies on the same plane.</exception>
        public static LineSegment3d[] GetTangentsTo(this CircularArc3d arc, Point3d pt)
        {
            // check if arc and point lies on the plane
            Vector3d normal = arc.Normal;
            Matrix3d WCS2OCS = Matrix3d.WorldToPlane(normal);
            double elevation = arc.Center.TransformBy(WCS2OCS).Z;
            if (Math.Abs(elevation - pt.TransformBy(WCS2OCS).Z) < Tolerance.Global.EqualPoint)
                throw new Autodesk.AutoCAD.Runtime.Exception(
                    Autodesk.AutoCAD.Runtime.ErrorStatus.NonCoplanarGeometry);

            Plane plane = new Plane(Point3d.Origin, normal);
            Matrix3d OCS2WCS = Matrix3d.PlaneToWorld(plane);
            CircularArc2d ca2d = new CircularArc2d(arc.Center.Convert2d(plane), arc.Radius);
            LineSegment2d[] lines2d = ca2d.GetTangentsTo(pt.Convert2d(plane));

            if (lines2d == null)
                return null;

            LineSegment3d[] result = new LineSegment3d[lines2d.Length];
            for (int i = 0; i < lines2d.Length; i++)
            {
                LineSegment2d ls2d = lines2d[i];
                result[i] = new LineSegment3d(ls2d.StartPoint.Convert3d(normal, elevation), ls2d.EndPoint.Convert3d(normal, elevation));
            }
            return result;
        }
开发者ID:vildar82,项目名称:AcadLib,代码行数:39,代码来源:CircularArc3dExtensions.cs

示例3: ToMachining

        public override void ToMachining(double AssociatedDist, ToolFile toolFile)
        {
            FindAssociatedFaces(AssociatedDist + this.GapDist);

            PartFace pf = this.Part.GetPartFaceByNumber(FaceNumber);

            if (pf.AssociatedPartFaces.Count != 0)//数量不为0,说明有关联的板件
            {
                double totolDist = DistToBottom + DistToTop;
                int number = (int)(totolDist / DistBetweenTwoHoles);
                for (int i = 0; i < number; i++)
                {
                    foreach (PartFace f in pf.AssociatedPartFaces)
                    {
                        if (f.IsHorizontalFace)//不对水平面处理
                            continue;


                        //TODO:关于生成的孔的排列
                        /*
                         * 1、无论层板如何旋转,计算上下时总是按未位移旋转时的下平面为基准
                         * 2、排列时,无论本身如何旋转,在加工板件上总是竖直平行于板件的一边
                         * 3、平行的难点:是平行于长边,还是平行于短边?
                         * 
                         */


                        double firstPointX = GetFirstPointX();
                        double firstPointY = GetFirstPointY();
                        double firstPointZ = DistToBottom - i * DistBetweenTwoHoles;
                        //firstPointZ = -Part.Thickness - DistToBottom + i * DistBetweenTwoHoles;
                        Point3d holeposition = new Point3d(firstPointX, firstPointY, firstPointZ);

                        holeposition = holeposition.TransformBy(Matrix3d.AlignCoordinateSystem(new Point3d(),
                                                                                                           Vector3d.XAxis,
                                                                                                           Vector3d.YAxis,
                                                                                                           Vector3d.ZAxis,
                                                                                                           Part.MPPoint,
                                                                                                           Part.MPXAxis,
                                                                                                           Part.MPYAxis,
                                                                                                           Part.MPZAxis));
                        holeposition = Math.MathHelper.GetRotatedAndMovedPoint(holeposition, Part.TXRotation, Part.YRotation, Part.ZRotation, Part.CenterVector);
                        holeposition = holeposition.TransformBy(Matrix3d.AlignCoordinateSystem(f.Part.MovedMPPoint,
                                                                                               f.Part.MovedMPXAxis,
                                                                                               f.Part.MovedMPYAxis,
                                                                                               f.Part.MovedMPZAxis,
                                                                                               new Point3d(),
                                                                                               Vector3d.XAxis,
                                                                                               Vector3d.YAxis,
                                                                                               Vector3d.ZAxis));
                        double dimx = holeposition.X;
                        double dimy = holeposition.Y;

                        VDrilling vdrill = new VDrilling(f.FaceNumber, dimx, dimy, this.FaceHoleDiameter, this.FaceHoleDepth, f.Part);
                        f.Part.VDrillings.Add(vdrill);
                    }
                }
            }
        }
开发者ID:komelio,项目名称:Dimeng.LinkToMicrocad,代码行数:59,代码来源:SHELFMachiningToken.cs

示例4: ToMachining

        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            //先以当前点为坐标系,建立两点坐标
            double xydist = System.Math.Sqrt(DistX * DistX + DistY * DistY);
            double cos = DistX / xydist;
            double sin = DistY / xydist;
            Point3d firstPt = new Point3d(DistX + LeadIn * cos, -LeadIn * sin, Depth);
            Point3d secondPt = new Point3d(-LeadIn * cos, DistY + LeadIn * sin, Depth);

            //把两点坐标,转换为世界坐标,再转为MP坐标系
            Point3d pt = Part.GetPartPointByNumber(EdgeNumber.ToString());
            Matrix3d matrix1 = Matrix3d.AlignCoordinateSystem(
                Point3d.Origin,
                Vector3d.XAxis,
                Vector3d.YAxis,
                Vector3d.ZAxis,
                pt,
                (Part.MachinePoint.IsRotated) ? this.GetPointYAxis(EdgeNumber) : this.GetPointXAxis(EdgeNumber),
                (Part.MachinePoint.IsRotated) ? this.GetPointXAxis(EdgeNumber) : this.GetPointYAxis(EdgeNumber),
                Vector3d.ZAxis);
            Matrix3d matrix2 = Matrix3d.AlignCoordinateSystem(
                Part.MPPoint,
                Part.MPXAxis,
                Part.MPYAxis,
                Part.MPZAxis,
                Point3d.Origin,
                Vector3d.XAxis,
                Vector3d.YAxis,
                Vector3d.ZAxis);

            firstPt = firstPt.TransformBy(matrix1).TransformBy(matrix2);
            secondPt = secondPt.TransformBy(matrix1).TransformBy(matrix2);

            ToolComp comp = ToolComp.None;

            if (firstPt.X >= secondPt.X && firstPt.Y >= secondPt.Y)
                comp = ToolComp.Left;
            else if (firstPt.X >= secondPt.X && firstPt.Y < secondPt.Y)
                comp = ToolComp.Right;
            else if (firstPt.X < secondPt.X && firstPt.Y < secondPt.Y)
                comp = ToolComp.Left;
            else if (firstPt.X < secondPt.X && firstPt.Y >= secondPt.Y)
                comp = ToolComp.Right;

            List<Point3d> points = new List<Point3d>() { firstPt, secondPt };

            Machinings.Routing route = new Machinings.Routing();
            route.ToolName = ToolName;
            route.Points = points;
            route.Part = Part;
            route.ToolComp = comp;
            route.Bulges = (new double[] { 0, 0 }).ToList();
            if (FaceNumber == 5) route.OnFace5 = true;
            else route.OnFace5 = false;

            Part.Routings.Add(route);
        }
开发者ID:komelio,项目名称:Dimeng.LinkToMicrocad,代码行数:57,代码来源:CHAMFERMachiningToken.cs

示例5: getProjectPoint

        /// <summary>
        /// 取得世界坐标系下的点在这个板件的MP坐标系下的坐标
        /// </summary>
        /// <param name="pt"></param>
        /// <returns></returns>
        private Point3d getProjectPoint(Point3d pt)
        {
            //先把世界坐标系下的pt转换成mp坐标系下
            pt = pt.TransformBy(Matrix3d.AlignCoordinateSystem(this.Part.MovedMPPoint,
                                                               this.Part.MovedMPXAxis,
                                                               this.Part.MovedMPYAxis,
                                                               this.Part.MovedMPZAxis,
                                                               Point3d.Origin,
                                                               Vector3d.XAxis,
                                                               Vector3d.YAxis,
                                                               Vector3d.ZAxis));
            //取有效数字两个,是为了避免精确计算的情况下的误差导致判断错误
            double x = System.Math.Round(pt.X, 2);
            double y = System.Math.Round(pt.Y, 2);
            double z = System.Math.Round(pt.Z, 2);

            return new Point3d(x, y, z);
        }
开发者ID:komelio,项目名称:Dimeng.LinkToMicrocad,代码行数:23,代码来源:PartFace.cs

示例6: SizesRight

        protected void SizesRight(bool doTrans, Matrix3d trans)
        {
            double yWinMax=0;
             double yWinMin=0;
             var win = panelBase.Panel.windows?.window?.First();
             if (win == null)
             {
            var balc = panelBase.Panel.balconys?.balcony?.First();
            if (balc!=null)
            {
               yWinMax = balc.posi.Y + balc.height;
               yWinMin = balc.posi.Y;
            }
             }
             else
             {
            yWinMax = win.posi.Y + win.height;
            yWinMin = win.posi.Y;
             }

             var heightTile = Settings.Default.TileHeight + Settings.Default.TileSeam;
             // y последней плитки
             var countTile = Convert.ToInt32(panelBase.Height / heightTile);
             var yLastTile = (countTile * heightTile)-12;

             Point3d ptBotRight = new Point3d(panelBase.XMaxPanel, 0, 0);
             Point3d ptTopRight = new Point3d(ptBotRight.X, yLastTile, 0);

             bool hasIndentDim = yWinMax > 0;
             xDimLineRightMax = hasIndentDim ? ptBotRight.X+indentDimLineFromDraw+indentBetweenDimLine : ptBotRight.X + indentDimLineFromDraw;

             // Общий размер
             Point3d ptDimLineTotal = new Point3d(xDimLineRightMax, 0, 0);
             CreateDim(ptBotRight, ptTopRight, ptDimLineTotal, doTrans, trans, rangeSize: rangeSizeVertic, rotation: 90);
             // Промежуточные размеры
             if (hasIndentDim)
             {
            Point3d ptDimLineIndent = new Point3d(xDimLineRightMax - indentBetweenDimLine, 0, 0);
            Point3d ptMinWin= ptBotRight;
            if (yWinMin>0)
            {
               var countTileMinWin = Convert.ToInt32(yWinMin / heightTile);
               var yTilesMinWin = (countTileMinWin * heightTile) - 12;
               ptMinWin = new Point3d(ptBotRight.X, yTilesMinWin, 0);
               CreateDim(ptBotRight, ptMinWin, ptDimLineIndent, doTrans, trans, rangeSize: rangeSizeVertic, rotation: 90, interlineText:true);
               var ptMinWinSeam = new Point3d(ptMinWin.X, ptMinWin.Y+12, 0);
               var dimSeamMin= CreateDim(ptMinWin, ptMinWinSeam, ptDimLineIndent, doTrans, trans, rotation: 90);
               Point3d ptTextSeamMin = new Point3d(ptDimLineIndent.X, ptMinWinSeam.Y+65,0);
               dimSeamMin.TextPosition = doTrans? ptTextSeamMin.TransformBy(trans): ptTextSeamMin;
               ptMinWin = ptMinWinSeam;
            }
            var countTileMaxWin = Convert.ToInt32(yWinMax / heightTile);
            var yTilesMaxWin = (countTileMaxWin * heightTile) - 12;
            Point3d ptMaxWin = new Point3d(ptMinWin.X, yTilesMaxWin, 0);
            CreateDim(ptMinWin, ptMaxWin, ptDimLineIndent, doTrans, trans, rangeSize: rangeSizeVertic, rotation: 90, interlineText: true);
            Point3d ptMaxWinSeam = new Point3d(ptMaxWin.X, ptMaxWin.Y+12, 0);
            var dimSeamMax = CreateDim(ptMaxWin, ptMaxWinSeam, ptDimLineIndent, doTrans, trans, rotation: 90);
            Point3d ptTextSeamMax = new Point3d(ptDimLineIndent.X, ptMaxWin.Y - 65, 0);
            dimSeamMax.TextPosition = doTrans ? ptTextSeamMax.TransformBy(trans) : ptTextSeamMax;
            // размер до верха плиток
            CreateDim(ptMaxWinSeam, ptTopRight, ptDimLineIndent, doTrans, trans, rangeSize: rangeSizeVertic, rotation: 90, interlineText: true);
             }
        }
开发者ID:vildar82,项目名称:PanelColorAlbum,代码行数:63,代码来源:DimensionAbstract.cs

示例7: Ucs2Wcs

        ///<summary>
        ///Converts the coordinate system of point from UCS to WCS
        ///<summary>
        ///<param name = "sourcePoint">[in] The source point</param>
        ///<returns>Returns the point after transformed.</returns>
        public static Point3d Ucs2Wcs(Point3d sourcePoint)
        {
            Matrix3d ucsMatrix = Utility.AcadEditor.CurrentUserCoordinateSystem;
            Matrix3d wcsMatrix = ucsMatrix.Inverse();
            Point3d transformedPoint =  sourcePoint.TransformBy(wcsMatrix);

            return transformedPoint;
        }
开发者ID:guchanghai,项目名称:Cut,代码行数:13,代码来源:HelperFunctions.cs

示例8: SetCenterVector

        private void SetCenterVector(Point3d OriginPoint, double zr)
        {
            this.TZRotation += zr;

            Point3d position = new Point3d(this.XOrigin, this.YOrigin, this.ZOrigin);
            position = (OriginPoint == Point3d.Origin) ? position :
                                     position.TransformBy(Matrix3d.Displacement(new Vector3d(OriginPoint.X, OriginPoint.Y, OriginPoint.Z)));
            position = position.TransformBy(Matrix3d.Rotation(zr / 180 * System.Math.PI, Vector3d.ZAxis, OriginPoint));

            this.TXOrigin = position.X;
            this.TYOrigin = position.Y;
            this.TZOrigin = position.Z;

            Vector3d BaseVector = new Vector3d();//定位向量
            if (BasePoint == 1)
                BaseVector = new Vector3d(-Length / 2, -Width / 2, -Thickness / 2);
            else if (BasePoint == 2)
                BaseVector = new Vector3d(-Length / 2, -Width / 2, Thickness / 2);
            else if (BasePoint == 3)
                BaseVector = new Vector3d(-Length / 2, Width / 2, -Thickness / 2);
            else if (BasePoint == 4)
                BaseVector = new Vector3d(-Length / 2, Width / 2, Thickness / 2);
            else if (BasePoint == 5)
                BaseVector = new Vector3d(Length / 2, Width / 2, -Thickness / 2);
            else if (BasePoint == 6)
                BaseVector = new Vector3d(Length / 2, Width / 2, Thickness / 2);
            else if (BasePoint == 7)
                BaseVector = new Vector3d(Length / 2, -Width / 2, -Thickness / 2);
            else if (BasePoint == 8)
                BaseVector = new Vector3d(Length / 2, -Width / 2, Thickness / 2);
            else throw new System.Exception("Unknown Basepoint" + BasePoint.ToString());

            Vector3d MoveVector = MathHelper.GetRotateVector(BaseVector, TXRotation, TYRotation, TZRotation);
            Vector3d DimVector = new Vector3d(TXOrigin, TYOrigin, TZOrigin);

            CenterVector = -MoveVector + DimVector;
        }
开发者ID:komelio,项目名称:Dimeng.LinkToMicrocad,代码行数:37,代码来源:Part.cs

示例9: addProfileTile

        /// <summary>
        /// Вставка блока профиля и стрелок к местам установки профиля на стыке плиток в торце панели
        /// </summary>
        protected void addProfileTile(bool doTrans, Matrix3d trans)
        {
            double xPtProfile = 0;
             double yPtProfile = 0;
             double xPtArrowDirect = 0;
             if (panelBase.IsCheekLeft)
             {
            // Для торца слева - профиль вставляется в одну и туже точку (-400,-600)
            xPtProfile = -400;
            yPtProfile = -600;
            ptPosArrowToHorSec = ptPosHorizontalPanelSection;
             }
             else if (panelBase.IsCheekRight)
             {
            // Для торца справа - на раст (400,600) от нижнего правого края последней плитки
            xPtProfile = panelBase.XMaxContour + 400;
            yPtProfile = -600;
            xPtArrowDirect = panelBase.XMaxContour;
            ptPosArrowToHorSec = new Point3d(panelBase.XMaxContour, ptPosHorizontalPanelSection.Y, 0);
             }
             else
             {
            // Не нужен профиль для панелей без торцов (Cheek)
            return;
             }

             // Поиск блока профиля в инвентаре
             BlockInfo biProfile = panelBase.Service.Env.BlocksInFacade.FirstOrDefault(b => b.BlName.Equals(Settings.Default.BlockProfileTile));
             if (biProfile == null)
             {
            return;
             }

             ObjectId idBtrProfile = biProfile.IdBtr;
             // Точка вставки блока профиля
             ptPosProfile = new Point3d(xPtProfile, yPtProfile, 0);
             Point3d ptBlrefProfile = ptPosProfile;
             if (doTrans)
             {
            ptBlrefProfile = ptPosProfile.TransformBy(trans);
             }

             // Вставка блока профиля - название и марка
             var blRefProfile = CreateBlRefInBtrDim(ptBlrefProfile, idBtrProfile, Settings.Default.SheetScale);
             if (blRefProfile == null) return;

             // Добавление атрибутов Названия и марки
             // Атрибут Названия - из вхождения атрибута
             var atrRefName = biProfile.AttrsRef.FirstOrDefault(a => a.Tag.Equals("НАЗВАНИЕ"));
             if (atrRefName != null)
             {
            // определение атрибута
            var atrDefName = biProfile.AttrsDef.FirstOrDefault(a => a.Tag.Equals("НАЗВАНИЕ"));
            if (atrDefName != null)
            {
               AddAttrToBlockRef(blRefProfile, atrDefName.IdAtr, atrRefName.Text);
            }
             }
             // Атрибут Марки - из вхождения атрибута
             var atrRefMark = biProfile.AttrsRef.FirstOrDefault(a => a.Tag.Equals("МАРКА"));
             if (atrRefMark != null)
             {
            // определение атрибута
            var atrDefMark = biProfile.AttrsDef.FirstOrDefault(a => a.Tag.Equals("МАРКА"));
            if (atrDefMark != null)
            {
               AddAttrToBlockRef(blRefProfile, atrDefMark.IdAtr, atrRefMark.Text);
            }
             }

             // Вставка стрелки до угла панели
             Point3d ptArrowPos = new Point3d(xPtProfile, yPtProfile + 4 * Settings.Default.SheetScale, 0);
             Point3d ptArrowDirect = new Point3d(xPtArrowDirect, 0, 0);
             InsertArrowBlRef(ptArrowPos, ptArrowDirect, doTrans, trans);
        }
开发者ID:vildar82,项目名称:PanelColorAlbum,代码行数:78,代码来源:DimensionAbstract.cs

示例10: ScreenFromDrawingPoint

 //坐标系转换
 private static System.Windows.Point ScreenFromDrawingPoint(Editor ed, Point3d ucsPt, short viewportNum)
 {
     Point3d wcsPt = ucsPt.TransformBy(ed.CurrentUserCoordinateSystem);
     System.Windows.Point res = ed.PointToScreen(wcsPt, viewportNum);
     return res;
 }
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:7,代码来源:ScreenshotUtil.cs

示例11: addCheekViewText

 private void addCheekViewText(bool doTrans, Matrix3d trans, double xMinCheek)
 {
     // Текст с именем вида
      DBText textView = new DBText();
      textView.TextString = "Вид А";
      textView.Height = 75;
      Point3d ptTextPos = new Point3d(xMinCheek, panelBase.Height + 170, 0);
      if (doTrans)
      {
     ptTextPos = ptTextPos.TransformBy(trans);
     ptTextPos = new Point3d(ptTextPos.X - 290, ptTextPos.Y, 0);
      }
      textView.Position = ptTextPos;
      btrDim.AppendEntity(textView);
      t.AddNewlyCreatedDBObject(textView, true);
 }
开发者ID:vildar82,项目名称:PanelColorAlbum,代码行数:16,代码来源:DimensionAbstract.cs

示例12: sizesCheek

        private void sizesCheek(bool doTrans, Matrix3d trans)
        {
            double xMinCheek = panelBase.PtsForBotDimCheek.First();
             Point3d ptDimLineCheek = new Point3d(xMinCheek, -165, 0);
             Point3d ptFirstCheek = new Point3d(xMinCheek, 0, 0);
             Point3d ptLastCheek = new Point3d(panelBase.PtsForBotDimCheek.Last(), 0, 0);

             if (panelBase.IsCheekLeft)
             {
            addCheekViewText(doTrans, trans, xMinCheek);
            addCheekViewBlock(doTrans, trans, xMinCheek+650, true);
             }
             if (panelBase.IsCheekRight)
             {
            addCheekViewText(doTrans, trans, xMinCheek);
            addCheekViewBlock(doTrans, trans, xMinCheek - 365, false);
             }

             Point3d ptPrevCheek = ptFirstCheek;
             foreach (var ptX in panelBase.PtsForBotDimCheek.Skip(1))
             {
            Point3d ptNextCheek = new Point3d(ptX, 0, 0);
            var dimCheek = CreateDim(ptPrevCheek, ptNextCheek, ptDimLineCheek, doTrans, trans);
            // Если размер маленький, то перемещение текста размера
            if (dimCheek.Measurement < 90)
            {
               double deltaX = panelBase.IsCheekLeft ? 70 : -70;
               Point3d ptText = new Point3d(ptPrevCheek.X + deltaX, ptDimLineCheek.Y - 100, 0);
               dimCheek.TextPosition = doTrans? ptText.TransformBy(trans) : ptText;
            }
            ptPrevCheek = ptNextCheek;
             }
             // Общий размер торца
             CreateDim(ptFirstCheek, ptLastCheek, new Point3d(0, ptDimLineCheek.Y - 150, 0), doTrans, trans);
        }
开发者ID:vildar82,项目名称:PanelColorAlbum,代码行数:35,代码来源:DimensionAbstract.cs

示例13: ToMachining

        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            //由于这个指令是指定了板件的1-8个点进行定位的,所以要把空间的绝对坐标换算回机加工原点的相对坐标 
            //matrix1负责把所在点的坐标转换为板件中心的坐标
            //matrix2负责把板件中心的坐标,再转换为MP中心的坐标
            Point3d pt = Part.GetPartPointByNumber(EdgeNumber.ToString());
            Matrix3d matrix1 = Matrix3d.AlignCoordinateSystem(
                Point3d.Origin,
                Vector3d.XAxis,
                Vector3d.YAxis,
                Vector3d.ZAxis,
                pt,
                (Part.MachinePoint.IsRotated) ? this.GetPointYAxis(EdgeNumber) : this.GetPointXAxis(EdgeNumber),
                (Part.MachinePoint.IsRotated) ? this.GetPointXAxis(EdgeNumber) : this.GetPointYAxis(EdgeNumber),
                Vector3d.ZAxis);
            Matrix3d matrix2 = Matrix3d.AlignCoordinateSystem(
                Part.MPPoint,
                Part.MPXAxis,
                Part.MPYAxis,
                Part.MPZAxis,
                Point3d.Origin,
                Vector3d.XAxis,
                Vector3d.YAxis,
                Vector3d.ZAxis);

            if (LeadIn > 0)
            {
                double rRadius = LeadIn;
                Point3d firstPt = new Point3d(Radius + rRadius, -rRadius, Depth);
                Point3d secondPt = new Point3d(Radius, 0, Depth);
                Point3d thirdPt = new Point3d(0, Radius, Depth);
                Point3d forthPt = new Point3d(-rRadius, Radius + rRadius, Depth);

                firstPt = firstPt.TransformBy(matrix1).TransformBy(matrix2);
                secondPt = secondPt.TransformBy(matrix1).TransformBy(matrix2);
                thirdPt = thirdPt.TransformBy(matrix1).TransformBy(matrix2);
                forthPt = forthPt.TransformBy(matrix1).TransformBy(matrix2);

                double firstBulge = -0.414214;
                ToolComp comp = ToolComp.None;

                if (firstPt.X >= thirdPt.X && firstPt.Y >= thirdPt.Y)
                {
                    comp = ToolComp.Left;
                    firstBulge *= -1;
                }
                else if (firstPt.X >= thirdPt.X && firstPt.Y < thirdPt.Y)
                {
                    comp = ToolComp.Right;
                }
                else if (firstPt.X < thirdPt.X && firstPt.Y < thirdPt.Y)
                {
                    comp = ToolComp.Left;
                    firstBulge *= -1;
                }
                else if (firstPt.X < thirdPt.X && firstPt.Y >= thirdPt.Y)
                {
                    comp = ToolComp.Right;
                }

                Machinings.Routing route = new Machinings.Routing();
                route.ToolName = ToolName;
                route.Points = new List<Point3d>() { firstPt, secondPt, thirdPt, forthPt };
                route.Part = Part;
                route.ToolComp = comp;
                route.Bulges = (new double[] { firstBulge, -firstBulge, firstBulge, 0 }).ToList();
                if (FaceNumber == 5) route.OnFace5 = true;
                else route.OnFace5 = false;

                Part.Routings.Add(route);
            }
        }
开发者ID:komelio,项目名称:Dimeng.LinkToMicrocad,代码行数:72,代码来源:FILLETCORNERMachiningToken.cs

示例14: addCheekViewBlock

        private void addCheekViewBlock(bool doTrans, Matrix3d trans, double xPosView, bool isLeft)
        {
            // Добавление блока вида.
             // Если блока нет, то выход.
             if (panelBase.Service.Env.IdBtrView.IsNull)
             {
            return;
             }

             Point3d ptBlView = new Point3d(xPosView, 860, 0);
             if (doTrans)
             {
            ptBlView = ptBlView.TransformBy(trans);
             }
             BlockReference blRefView = CreateBlRefInBtrDim(ptBlView, panelBase.Service.Env.IdBtrView, Settings.Default.SheetScale);
             if (blRefView == null)
             {
            return;
             }

             // атрибут Вида
             if (!panelBase.Service.Env.IdAttrDefView.IsNull)
             {
            using (var attrDefView = panelBase.Service.Env.IdAttrDefView.GetObject(OpenMode.ForRead, false, true) as AttributeDefinition)
            {
               var attrRefView = new AttributeReference();
               attrRefView.SetAttributeFromBlock(attrDefView, blRefView.BlockTransform);
               attrRefView.TextString = "А";

               blRefView.AttributeCollection.AppendAttribute(attrRefView);
               t.AddNewlyCreatedDBObject(attrRefView, true);

               if ((!isLeft || doTrans) && !(!isLeft && doTrans))
               {
                  attrRefView.TransformBy(Matrix3d.Mirroring(
                     new Line3d(attrRefView.AlignmentPoint, new Point3d(attrRefView.AlignmentPoint.X, 0, 0))));
               }
            }
             }

             if ((!isLeft || doTrans) && !(!isLeft && doTrans))
             {
            blRefView.TransformBy(Matrix3d.Mirroring(new Line3d(ptBlView, new Point3d(ptBlView.X, 0, 0))));
             }
        }
开发者ID:vildar82,项目名称:PanelColorAlbum,代码行数:45,代码来源:DimensionAbstract.cs

示例15: SizesLeft

        protected void SizesLeft(bool doTrans, Matrix3d trans)
        {
            var heightTile = Settings.Default.TileHeight + Settings.Default.TileSeam;
             // y последней плитки
             var countTile = Convert.ToInt32((panelBase.Height - heightTile) / heightTile);
             var yLastTile = countTile * heightTile;

             Point3d ptBotLeft = new Point3d(panelBase.XMinPanel, 0, 0);
             Point3d ptTopLeft = new Point3d(ptBotLeft.X, yLastTile, 0);

             xDimLineLeftMin = ptBotLeft.X-indentDimLineFromDraw;
             Point3d ptDimLine = new Point3d(xDimLineLeftMin, 0, 0);

             var dim= CreateDim(ptBotLeft, ptTopLeft, ptDimLine, doTrans, trans, rotation: 90);
             dim.Prefix = $"({Settings.Default.TileHeight}+{Settings.Default.TileSeam})x{countTile}=";

             Point3d ptLastTile = new Point3d(ptTopLeft.X, ptTopLeft.Y + Settings.Default.TileHeight, 0);
             dim = CreateDim(ptTopLeft, ptLastTile, ptDimLine, doTrans, trans, rotation:90);
             Point3d ptText = new Point3d(ptDimLine.X, ptTopLeft.Y - 65, 0);
             dim.TextPosition = doTrans? ptText.TransformBy(trans): ptText;
        }
开发者ID:vildar82,项目名称:PanelColorAlbum,代码行数:21,代码来源:DimensionAbstract.cs


注:本文中的Point3d.TransformBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。