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


C# Point3d.Convert2d方法代码示例

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


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

示例1: 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

示例2: BreakAtPoint

        /// <summary>
        /// Breaks the polyline at specified point.
        /// </summary>
        /// <param name="pline">The polyline this method applies to.</param>
        /// <param name="brkPt">The point where to break the polyline.</param>
        /// <returns>An array of the two resullting polylines.</returns>
        public static Polyline[] BreakAtPoint(this Polyline pline, Point3d brkPt)
        {
            brkPt = pline.GetClosestPointTo(brkPt, false);

            // le point spécifié est sur le point de départ de la polyligne
            if (brkPt.IsEqualTo(pline.StartPoint))
                return new Polyline[2] { null, (Polyline)pline.Clone() };

            // le point spécifié est sur le point de fin de la polyligne
            if (brkPt.IsEqualTo(pline.EndPoint))
                return new Polyline[2] { (Polyline)pline.Clone(), null };

            double param = pline.GetParameterAtPoint(brkPt);
            int index = (int)param;
            int num = pline.NumberOfVertices;
            Polyline pl1 = (Polyline)pline.Clone();
            if (pline.Closed)
            {
                pl1.AddVertexAt(
                    pline.NumberOfVertices,
                    pline.GetPoint2dAt(0),
                    pline.GetStartWidthAt(num - 1),
                    pline.GetEndWidthAt(num - 1),
                    pline.GetBulgeAt(num - 1));
                pl1.Closed = false;
            }
            Polyline pl2 = (Polyline)pl1.Clone();

            // le point spécifié est sur un sommet de la polyligne
            if (Math.Round(param, 6) == index)
            {
                for (int i = pl1.NumberOfVertices - 1; i > index; i--)
                {
                    pl1.RemoveVertexAt(i);
                }
                for (int i = 0; i < index; i++)
                {
                    pl2.RemoveVertexAt(0);
                }
                return new Polyline[2] { pl1, pl2 };
            }

            // le point spécifié est sur un segment
            Point2d pt = brkPt.Convert2d(new Plane(Point3d.Origin, pline.Normal));
            for (int i = pl1.NumberOfVertices - 1; i > index + 1; i--)
            {
                pl1.RemoveVertexAt(i);
            }
            pl1.SetPointAt(index + 1, pt);
            for (int i = 0; i < index; i++)
            {
                pl2.RemoveVertexAt(0);
            }
            pl2.SetPointAt(0, pt);
            if (pline.GetBulgeAt(index) != 0.0)
            {
                double bulge = pline.GetBulgeAt(index);
                pl1.SetBulgeAt(index, MultiplyBulge(bulge, param - index));
                pl2.SetBulgeAt(0, MultiplyBulge(bulge, index + 1 - param));
            }
            return new Polyline[2] { pl1, pl2 };
        }
开发者ID:vildar82,项目名称:AcadLib,代码行数:68,代码来源:PolylineExtensions.cs

示例3: InsertArrowBlRef

 protected void InsertArrowBlRef(Point3d ptArrowBlPos, Point3d ptArrowDirect, bool doTrans, Matrix3d trans)
 {
     // Вставка стрелки и направление ее на указанную точку
      if (!panelBase.Service.Env.IdBtrArrow.IsNull)
      {
     if (doTrans)
     {
        ptArrowBlPos = ptArrowBlPos.TransformBy(trans);
        ptArrowDirect = ptArrowDirect.TransformBy(trans);
     }
     // вставка блока стрелки
     var blRefArrow = CreateBlRefInBtrDim(ptArrowBlPos, panelBase.Service.Env.IdBtrArrow, Settings.Default.SheetScale);
     if (blRefArrow == null) return;
     // поворот стрелки и установка длины
     Vector2d vecArrow = ptArrowDirect.Convert2d() - ptArrowBlPos.Convert2d();
     blRefArrow.Rotation = vecArrow.Angle;
     // длина стрелки
     setDynParam(blRefArrow, "Длина", vecArrow.Length);
      }
 }
开发者ID:vildar82,项目名称:PanelColorAlbum,代码行数:20,代码来源:DimensionAbstract.cs

示例4: CreateRoll

        /// <summary>
        /// Построение разверток стены
        /// </summary>        
        public void CreateRoll(Point3d ptStart, BlockTableRecord btr)
        {
            var rooms = Rooms.Where(r => r.HasRoll).OrderBy(r => r.Number?.Num);
            if (!rooms.Any())
            {
                return;
            }

            Options opt = Options.Instance;
            Transaction t = btr.Database.TransactionManager.TopTransaction;
            Point2d ptRoom = ptStart.Convert2d();
            var textHeight = 2.5 * (1 / btr.Database.Cannoscale.Scale);
            string textValue = string.Empty;

            // Подпись квартиры
            var ptTextFlat = new Point3d(ptStart.X, ptStart.Y + DrawHeight - 500, 0);
            using (var textFlat = addText(btr, t, ptTextFlat, Name, textHeight, TextHorizontalMode.TextLeft))
            {
                textFlat.LayerId = RollUpService.LayerNonPlotId;
            }

            foreach (var room in rooms)
            {
                Point2d ptRoll = ptRoom;

                foreach (var roll in room.Rolls.OrderBy(r => r.Num, RollUpService.CompareName))
                {
                    Point2d ptSegment = ptRoll;

                    foreach (var segment in roll.Segments)
                    {
                        // Полилиня сегмента
                        addRectangle(btr, t, ptSegment, segment.Length, segment.Height);

                        // Размер
                        Point3d ptDim1 = ptSegment.Convert3d();
                        Point3d ptDim2 = new Point3d(ptDim1.X + segment.Length, ptDim1.Y, 0);
                        Point3d ptDimLine = new Point3d(ptDim1.X + segment.Length * 0.5, ptDim1.Y - 500, 0);
                        addDim(btr, t, ptDim1, ptDim2, ptDimLine);

                        //// Для Тестов - индекс сегмента
                        //var ptSegCenter = new Point2d(ptSegment.X + segment.Length * 0.5, ptSegment.Y + segment.Height * 0.5);
                        //addText(btr, t, ptSegCenter, segment.Index.ToString(), textHeight);

                        ptSegment = new Point2d(ptSegment.X + segment.Length, ptSegment.Y);
                    }

                    var ptText = new Point3d(ptRoll.X + roll.Length * 0.5, ptRoll.Y + roll.Height + textHeight, 0);
                    textValue = "Вид " + (roll.View == null ? "0" : roll.Num.ToString());
                    addText(btr, t, ptText, textValue, textHeight);

                    ptRoll = new Point2d(ptRoll.X + roll.Length + opt.RollViewOffset, ptRoll.Y);
                }

                // Полилиня помещения
                var ptRoomRectangle = new Point2d(ptRoom.X - 500, ptRoom.Y - 1000);
                using (var plRoomRect = addRectangle(btr, t, ptRoomRectangle, room.DrawLength + 1000, room.DrawHeight))
                {
                    plRoomRect.LayerId = RollUpService.LayerNonPlotId;
                }

                var ptTextRoom = new Point3d(ptRoom.X + room.DrawLength * 0.5, ptRoom.Y + room.Height + 1000 + textHeight, 0);
                textValue = "Помещение " + (room.Number == null ? "0" : room.Number.Num.ToString());
                using (var textRoom = addText(btr, t, ptTextRoom, textValue, textHeight))
                {
                    textRoom.LayerId = RollUpService.LayerNonPlotId;
                }
                ptRoom = new Point2d(ptRoom.X + room.DrawLength + 2000, ptRoom.Y);
            }
        }
开发者ID:vildar82,项目名称:AR_Materials,代码行数:73,代码来源:Flat.cs


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