public static IList <Autodesk.DesignScript.Geometry.Point> GetPolylineVertices(Autodesk.AutoCAD.DatabaseServices.Polyline polyline) { int curIndex = 0; //CivilDynamoTools.AutoCAD.Point2dCollection points = new CivilDynamoTools.AutoCAD.Point2dCollection(new Point2dCollection()); //System.Collections.ArrayList points = new System.Collections.ArrayList(); IList <Autodesk.DesignScript.Geometry.Point> points = new List <Autodesk.DesignScript.Geometry.Point>(); while (curIndex < polyline.NumberOfVertices) { double x = polyline.GetPoint2dAt(curIndex).X; double y = polyline.GetPoint2dAt(curIndex).Y; double z = 0.0; points.Add(Autodesk.DesignScript.Geometry.Point.ByCoordinates(x, y, z)); //points.Add(polyline.GetPoint2dAt(curIndex)); curIndex = curIndex + 1; } return(points); }
private static void RemoveVertexFromCurrentWipeout(ObjectId wipeoutId) { var doc = Application.DocumentManager.MdiActiveDocument; var ed = doc.Editor; var loop = true; while (loop) { using (doc.LockDocument()) { using (var tr = doc.TransactionManager.StartTransaction()) { var wipeout = tr.GetObject(wipeoutId, OpenMode.ForWrite) as Wipeout; if (wipeout != null) { var points3D = wipeout.GetVertices(); if (points3D.Count > 3) { var polyline = new Polyline(); for (var i = 0; i < points3D.Count; i++) { polyline.AddVertexAt(i, new Point2d(points3D[i].X, points3D[i].Y), 0.0, 0.0, 0.0); } var pickedPt = ed.GetPoint($"\n{Language.GetItem(LangItem, "msg22")}:"); if (pickedPt.Status != PromptStatus.OK) { loop = false; } else { var pt = polyline.GetClosestPointTo(pickedPt.Value, false); var param = polyline.GetParameterAtPoint(pt); var vertex = Convert.ToInt32(Math.Truncate(param)); polyline.RemoveVertexAt(vertex); var new2DPoints = new Point2dCollection(); for (var i = 0; i < polyline.NumberOfVertices; i++) { new2DPoints.Add(polyline.GetPoint2dAt(i)); } wipeout.SetFrom(new2DPoints, polyline.Normal); } } else { // message loop = false; } } tr.Commit(); } } } }
private static void AddVertexToCurrentWipeout(ObjectId wipeoutId) { var doc = Application.DocumentManager.MdiActiveDocument; var loop = true; while (loop) { using (doc.LockDocument()) { using (var tr = doc.TransactionManager.StartTransaction()) { var wipeout = tr.GetObject(wipeoutId, OpenMode.ForWrite) as Wipeout; if (wipeout != null) { var points3D = wipeout.GetVertices(); var polyline = new Polyline(); for (var i = 0; i < points3D.Count; i++) { polyline.AddVertexAt(i, new Point2d(points3D[i].X, points3D[i].Y), 0.0, 0.0, 0.0); } var jig = new AddVertexJig(); var result = jig.StartJig(polyline); if (result.Status != PromptStatus.OK) { loop = false; } else { polyline.AddVertexAt(jig.Vertex() + 1, jig.PickedPoint(), 0.0, 0.0, 0.0); var new2DPoints = new Point2dCollection(); for (var i = 0; i < polyline.NumberOfVertices; i++) { new2DPoints.Add(polyline.GetPoint2dAt(i)); } wipeout.SetFrom(new2DPoints, polyline.Normal); } } tr.Commit(); } } } }
public Polyline CopyPolyline(BlockTableRecord spaceRecord, ref Polyline pline, Transaction tr) { Polyline newpLine = new Polyline(); int max = pline.NumberOfVertices; for (int i = 0; i < max; i++) { newpLine.AddVertexAt(i, pline.GetPoint2dAt(i), pline.GetBulgeAt(i), pline.GetStartWidthAt(i), pline.GetEndWidthAt(i)); } newpLine.Closed = pline.Closed; //newpLine.Layer = pline.Layer.Split('|').Last(); newpLine.Layer = frameBlockAboveLayer; newpLine.Normal = pline.Normal; newpLine.Color = pline.Color; newpLine.ColorIndex = pline.ColorIndex; spaceRecord.UpgradeOpen(); spaceRecord.AppendEntity(newpLine); tr.AddNewlyCreatedDBObject(newpLine, true); spaceRecord.DowngradeOpen(); return(newpLine); }
public void ExportGeoJSON() { //select the objects that want to export as geojson List <BaseC3dObject> featureCollection = GetObjects("Export etmek istediğin objeleri seç"); //defining the variables for coordinate transformation string src1 = "+proj=tmerc +lat_0=0 +lon_0=30 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"; DotSpatial.Projections.ProjectionInfo info = ProjectionInfo.FromProj4String(src1); DotSpatial.Projections.ProjectionInfo info2 = ProjectionInfo.FromEpsgCode(4326); double[] zet = new double[] { 0, 0 }; StringBuilder vertexCoordinates = new StringBuilder(); string center = ""; //seperating the object type of selected objects for specific action using (Transaction ts = Dwg.TransactionManager.StartTransaction()) { foreach (BaseC3dObject item in featureCollection) { List <double[]> pnts = new List <double[]>(); if (item.Name == "LWPOLYLINE") { Autodesk.AutoCAD.DatabaseServices.Polyline lwp = ts.GetObject(item.Id, OpenMode.ForWrite) as Autodesk.AutoCAD.DatabaseServices.Polyline; int vn = lwp.NumberOfVertices; double[] fromPoint = new double[vn * 2]; int syc = 0; for (int i = 0; i < vn; i++) { double east = lwp.GetPoint2dAt(i).X; double nort = lwp.GetPoint2dAt(i).Y; fromPoint[syc] = east; fromPoint[syc + 1] = nort; syc += 2; } syc = 0; Reproject.ReprojectPoints(fromPoint, zet, info, info2, 0, vn); for (int i = 0; i < vn; i++) { string str = string.Format("[{0},{1}]", fromPoint[syc + 1], fromPoint[syc]); vertexCoordinates.Append(str); syc += 2; if (i != vn - 1) { vertexCoordinates.Append(","); } center = str; } // polyline kapalı ise son kısmına ilk noktayı tekrar atmamız gerekiyor. if (lwp.Closed) { vertexCoordinates.Append(","); string str = string.Format("[{0},{1}]", fromPoint[1], fromPoint[0]); vertexCoordinates.Append(str); } } string geo = GeoObject("LineString", vertexCoordinates.ToString()); //WritingToHTML(geo, center); } } }
static public void ListVertices() { Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; Database db = doc.Database; HostApplicationServices hs = HostApplicationServices.Current; string path = hs.FindFile(doc.Name, doc.Database, FindFileHint.Default); //ed.WriteMessage("\nTo List all the points in the 3D string, type command LISTVERTICES."); long adjustX = 0; long adjustY = 0; long scaler = 1; PromptEntityResult per = ed.GetEntity("Select polylines"); ObjectId oid = per.ObjectId; if (per.Status == PromptStatus.OK) { Transaction tr = db.TransactionManager.StartTransaction(); DBObject objPick = tr.GetObject(oid, OpenMode.ForRead); Entity objEnt = objPick as Entity; string sLayer = objEnt.Layer.ToString(); path += "_" + sLayer; ObjectIdCollection oDBO = CADops.SelectAllPolyline(sLayer); //Handle handseed = db.Handseed; try { using (tr) { long shtNo = 1; List <string> data = new List <string>(); foreach (ObjectId id in oDBO) { //DBObject obj = tr.GetObject(per.ObjectId, OpenMode.ForRead); DBObject obj = tr.GetObject(id, OpenMode.ForRead); Entity ent = obj as Entity; string layerName = ent.Layer.ToString(); //create list for storing x,y,z value of point string StrId = ""; // If a "lightweight" (or optimized) polyline Autodesk.AutoCAD.DatabaseServices.Polyline lwp = obj as Autodesk.AutoCAD.DatabaseServices.Polyline; if (lwp != null) { //StrId = lwp.ObjectId.ToString(); StrId = lwp.Handle.ToString(); ed.WriteMessage("\n" + StrId); // Use a for loop to get each vertex, one by one int vn = lwp.NumberOfVertices; for (int i = 0; i < vn; i++) { // Could also get the 3D point here Point2d pt = lwp.GetPoint2dAt(i); string temp = CADops.scaleNmove(pt.X, adjustX, scaler) + "," + CADops.scaleNmove(pt.Y, adjustY, scaler) + ", ," + StrId + "," + layerName; data.Add(temp); ed.WriteMessage("\n" + pt.ToString()); } } else { // If an old-style, 2D polyline Polyline2d p2d = obj as Polyline2d; if (p2d != null) { StrId = p2d.Handle.ToString(); ed.WriteMessage("\n" + StrId); // Use foreach to get each contained vertex foreach (ObjectId vId in p2d) { Vertex2d v2d = (Vertex2d)tr.GetObject(vId, OpenMode.ForRead); string temp = CADops.scaleNmove(v2d.Position.X, adjustX, scaler) + "," + CADops.scaleNmove(v2d.Position.Y, adjustY, scaler) + "," + v2d.Position.Z * scaler + "," + StrId + "," + layerName; data.Add(temp); ed.WriteMessage("\n" + v2d.Position.ToString()); } } else { // If an old-style, 3D polyline Polyline3d p3d = obj as Polyline3d; if (p3d != null) { StrId = p3d.Handle.ToString(); ed.WriteMessage("\n" + StrId); // Use foreach to get each contained vertex foreach (ObjectId vId in p3d) { PolylineVertex3d v3d = (PolylineVertex3d)tr.GetObject(vId, OpenMode.ForRead); string temp = CADops.scaleNmove(v3d.Position.X, adjustX, scaler) + "," + CADops.scaleNmove(v3d.Position.Y, adjustY, scaler) + "," + v3d.Position.Z * scaler + "," + StrId + "," + layerName; data.Add(temp); ed.WriteMessage("\n" + v3d.Position.ToString()); } } } } //create dataarray to populate in excel int no = data.Count; ed.WriteMessage("\n Number of Point:" + no); //createCSV(data, shtNo); shtNo += 1; } Excel.createCSV(data, path); // Committing is cheaper than aborting ed.WriteMessage("\ncsv file has been created under path " + path); ed.WriteMessage("\nData format: Easting, Northing, Elevation, String ID, Layer Name."); tr.Commit(); } } catch { } } }
public void OutputMap() { //Point3d p = line1.StartPoint; Database acCurDb; acCurDb = Application.DocumentManager.MdiActiveDocument.Database; // Get the image dictionary ObjectId acImgDctID = RasterImageDef.GetImageDictionary(acCurDb); // Check to see if the dictionary does not exist, it not then create it if (acImgDctID.IsNull) { acImgDctID = RasterImageDef.CreateImageDictionary(acCurDb); } using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction()) { Autodesk.AutoCAD.DatabaseServices.Polyline Rect = WorldEdgeRect.GetObject(OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Polyline; Point2d pmax = Rect.GetPoint2dAt(2); AllMap[CurrentWorldMap].width = pmax.X; AllMap[CurrentWorldMap].height = pmax.Y; foreach (var Map in AllMap[CurrentWorldMap].maps[CurrentLayer]) { if (!Map.ID.IsNull) { //acRasterDef = acTrans.GetObject(ID, OpenMode.ForWrite) as RasterImageDef; //} //RasterImage image = new RasterImage(); //image.ImageDefId = ID; //Point3d p2 = image.Position; RasterImage image = null; image = Map.ID.GetObject(OpenMode.ForRead) as RasterImage; if (image != null) { Point3d p = image.Orientation.Origin; Map.x = p.X; Map.y = p.Y; Map.width = image.Width; double width2 = image.ImageWidth; Map.height = image.Height; double height2 = image.ImageHeight; } } } WriteMapData(); // Open the Block table for read BlockTable acBlkTbl; acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable; // Open the Block table record Model space for write BlockTableRecord acBlkTblRec; acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord; System.Drawing.Image img = null; string name = acBlkTblRec.Name; if (!String.IsNullOrEmpty(name)) { img = GetBlockImageFromDrawing(name); } string path = mapDir + "\\" + CurrentWorldMap + "_" + CurrentLayer + ".bmp"; if (File.Exists(path)) { try { File.Delete(path); } catch (System.Exception ex) { ed.WriteMessage(path + " 被占用,请重试"); } } try { if (img != null) { img.Save(path); } } catch (System.Exception ex) { ed.WriteMessage(path + " 被占用,请重试"); } } }
public static PolyLineModel Polyline2Model(Autodesk.AutoCAD.DatabaseServices.Polyline polyLine, AttributeModel atModel) { PolyLineModel polylineModel = new PolyLineModel(); polylineModel.individualName = ""; polylineModel.individualFactor = ""; polylineModel.individualCode = ""; polylineModel.individualStage = ""; // 增加个体编码、个体要素、个体名称 System.Data.DataTable tb = Method.AutoGenerateNumMethod.GetAllPolylineNumsEx(polyLine); if (tb.Rows != null && tb.Rows.Count > 0) { foreach (System.Data.DataRow row in tb.Rows) { if ((string)row["多段线id"] == polyLine.Id.Handle.Value.ToString()) { polylineModel.individualName = (string)row["个体名称"]; polylineModel.individualFactor = (string)row["个体要素"]; polylineModel.individualCode = (string)row["个体编码"]; polylineModel.individualStage = (string)row["个体阶段"]; } } } polylineModel.Area = polyLine.Area; polylineModel.Closed = polyLine.Closed; polylineModel.Color = polyLine.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(polyLine.LayerId) : System.Drawing.ColorTranslator.ToHtml(polyLine.Color.ColorValue); polylineModel.Vertices = new System.Collections.ArrayList(); int vn = polyLine.NumberOfVertices; //lwp已知的多段线 for (int i = 0; i < vn; i++) { Point2d pt = polyLine.GetPoint2dAt(i); SegmentType st = polyLine.GetSegmentType(i); if (st == SegmentType.Arc) { ArcModel arc = new ArcModel(); CircularArc2d cir = polyLine.GetArcSegment2dAt(i); // arc.Center = new System.Drawing.PointF((float)cir.Center.X,(float)cir.Center.Y); arc.Center = Point2d2Pointf(cir.Center); arc.Radius = cir.Radius; arc.Startangel = cir.StartAngle; arc.EndAngel = cir.EndAngle; // arc.StartPoint = new System.Drawing.PointF((float)cir.StartPoint.X, (float)cir.StartPoint.Y); if (cir.HasStartPoint) { arc.StartPoint = Point2d2Pointf(cir.StartPoint); } // arc.EndPoint = new System.Drawing.PointF((float)cir.EndPoint.X, (float)cir.EndPoint.Y); if (cir.HasEndPoint) { arc.EndPoint = Point2d2Pointf(cir.EndPoint); } MyPoint spt = new MyPoint(arc.StartPoint.X, arc.StartPoint.Y); MyPoint ept = new MyPoint(arc.EndPoint.X, arc.EndPoint.Y); MyPoint center = new MyPoint(arc.Center.X, arc.Center.Y); arc.Color = polylineModel.Color; // arc.pointList = MethodCommand.GetRoationPoint(spt, ept, center, arc.Startangel,arc.EndAngel,cir.IsClockWise); arc.pointList = MethodCommand.GetArcPointsByPoint2d(cir.GetSamplePoints(20)); //arc.pointList = MethodCommand.GetArcPoints(arc.Center,arc.Startangel,arc.EndAngel,arc.Radius); // arc.pointList.Insert(0, arc.StartPoint); // arc.pointList.Add(arc.EndPoint); foreach (AttributeItemModel item in atModel.attributeItems) { string attValue = ""; switch (item.AtItemType) { case AttributeItemType.Area: attValue = polyLine.Area.ToString(); break; case AttributeItemType.TxtHeight: break; case AttributeItemType.Color: attValue = polylineModel.Color; break; case AttributeItemType.Content: break; case AttributeItemType.LayerName: attValue = polyLine.Layer; break; case AttributeItemType.LineScale: attValue = polyLine.LinetypeScale.ToString(); break; case AttributeItemType.LineType: attValue = GetLayerLineTypeByID(polyLine); break; case AttributeItemType.Overallwidth: attValue = polyLine.ConstantWidth.ToString(); break; case AttributeItemType.TotalArea: break; } if (!string.IsNullOrEmpty(attValue)) { item.AtValue = attValue; arc.attItemList.Add(item); } } polylineModel.Vertices.Add(arc); } else if (st == SegmentType.Line) { LineModel line = new LineModel(); LineSegment2d lineSe = polyLine.GetLineSegment2dAt(i); if (lineSe.HasStartPoint) { line.StartPoint = Point2d2Pointf(lineSe.StartPoint); } if (lineSe.HasEndPoint) { line.EndPoint = Point2d2Pointf(lineSe.EndPoint); } if (line.StartPoint.X == line.EndPoint.X && line.StartPoint.Y == line.EndPoint.Y) { line.Angle = 0; line.Length = 0; } else if (line.StartPoint.X == line.EndPoint.X) { line.Angle = 90; } line.Color = polylineModel.Color; foreach (AttributeItemModel item in atModel.attributeItems) { string attValue = ""; switch (item.AtItemType) { case AttributeItemType.Area: attValue = polyLine.Area.ToString(); break; case AttributeItemType.TxtHeight: break; case AttributeItemType.Color: attValue = polylineModel.Color; break; case AttributeItemType.Content: break; case AttributeItemType.LayerName: attValue = polyLine.Layer; break; case AttributeItemType.LineScale: attValue = polyLine.LinetypeScale.ToString(); break; case AttributeItemType.LineType: attValue = GetLayerLineTypeByID(polyLine); break; case AttributeItemType.Overallwidth: attValue = polyLine.ConstantWidth.ToString(); break; case AttributeItemType.TotalArea: break; } item.AtValue = attValue; line.attItemList.Add(item); } polylineModel.Vertices.Add(line); } } return(polylineModel); }
public static PolyLineModel Polyline2Model(Autodesk.AutoCAD.DatabaseServices.Polyline polyLine) { PolyLineModel polylineModel = new PolyLineModel(); polylineModel.individualName = ""; polylineModel.individualFactor = ""; polylineModel.individualCode = ""; polylineModel.individualStage = ""; // 增加个体编码、个体要素、个体名称 System.Data.DataTable tb = Method.AutoGenerateNumMethod.GetAllPolylineNumsEx(polyLine); if (tb.Rows != null && tb.Rows.Count > 0) { foreach (System.Data.DataRow row in tb.Rows) { if ((string)row["多段线id"] == polyLine.Id.Handle.Value.ToString()) { polylineModel.individualName = (string)row["个体名称"]; polylineModel.individualFactor = (string)row["个体要素"]; polylineModel.individualCode = (string)row["个体编码"]; polylineModel.individualStage = (string)row["个体阶段"]; } } } polylineModel.Area = polyLine.Area; polylineModel.Closed = polyLine.Closed; polylineModel.Color = polyLine.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(polyLine.LayerId) : System.Drawing.ColorTranslator.ToHtml(polyLine.Color.ColorValue); polylineModel.Vertices = new System.Collections.ArrayList(); int vn = polyLine.NumberOfVertices; //lwp已知的多段线 //if(polylineModel.Closed) //{ // for (int i = 0; i < vn; i++) // { // Point2d pt = polyLine.GetPoint2dAt(i); // PointF ptf = new PointF((float)pt.X, (float)pt.Y); // polylineModel.Vertices.Add(ptf); // } //} //else //{ for (int i = 0; i < vn; i++) { Point2d pt = polyLine.GetPoint2dAt(i); SegmentType st = polyLine.GetSegmentType(i); if (st == SegmentType.Arc) { ArcModel arc = new ArcModel(); CircularArc2d cir = polyLine.GetArcSegment2dAt(i); // arc.Center = new System.Drawing.PointF((float)cir.Center.X,(float)cir.Center.Y); arc.Center = Point2d2Pointf(cir.Center); arc.Radius = cir.Radius; arc.Startangel = cir.StartAngle; arc.EndAngel = cir.EndAngle; // arc.StartPoint = new System.Drawing.PointF((float)cir.StartPoint.X, (float)cir.StartPoint.Y); if (cir.HasStartPoint) { arc.StartPoint = Point2d2Pointf(cir.StartPoint); } // arc.EndPoint = new System.Drawing.PointF((float)cir.EndPoint.X, (float)cir.EndPoint.Y); if (cir.HasEndPoint) { arc.EndPoint = Point2d2Pointf(cir.EndPoint); } MyPoint spt = new MyPoint(arc.StartPoint.X, arc.StartPoint.Y); MyPoint ept = new MyPoint(arc.EndPoint.X, arc.EndPoint.Y); MyPoint center = new MyPoint(arc.Center.X, arc.Center.Y); arc.Color = polylineModel.Color; // arc.pointList = MethodCommand.GetRoationPoint(spt, ept, center, arc.Startangel,arc.EndAngel,cir.IsClockWise); arc.pointList = MethodCommand.GetArcPointsByPoint2d(cir.GetSamplePoints(20)); //arc.pointList = MethodCommand.GetArcPoints(arc.Center,arc.Startangel,arc.EndAngel,arc.Radius); // arc.pointList.Insert(0, arc.StartPoint); // arc.pointList.Add(arc.EndPoint); polylineModel.Vertices.Add(arc); } else if (st == SegmentType.Line) { LineModel line = new LineModel(); LineSegment2d lineSe = polyLine.GetLineSegment2dAt(i); if (lineSe.HasStartPoint) { line.StartPoint = Point2d2Pointf(lineSe.StartPoint); } if (lineSe.HasEndPoint) { line.EndPoint = Point2d2Pointf(lineSe.EndPoint); } if (line.StartPoint.X == line.EndPoint.X && line.StartPoint.Y == line.EndPoint.Y) { line.Angle = 0; line.Length = 0; } else if (line.StartPoint.X == line.EndPoint.X) { line.Angle = 90; } line.Color = polylineModel.Color; polylineModel.Vertices.Add(line); } } //} polylineModel.isDashed = GetLayerLineTypeByIDEx(polyLine); return(polylineModel); }
public static bool GetData(Db.ObjectId ObjectId) { SettingsParser settings = SettingsParser.getInstance(); Db.Database acCurDb = App.Application.DocumentManager.MdiActiveDocument.Database; using (Db.Transaction acTrans = acCurDb.TransactionManager.StartOpenCloseTransaction()) { Db.Polyline acPLine = acTrans.GetObject(ObjectId, Db.OpenMode.ForRead) as Db.Polyline; //Блокируем повторный выбор линии if (curveDict.FirstOrDefault(s => s.ObjId == ObjectId) == null) { Curve crv = new Curve(ObjectId); crv.Number = settings.startNumberCurve; crv.Area = round(acPLine.Area, settings.areaTolerance); crv.AreaOutput = round(acPLine.Area * settings.allAreaTolerance, settings.coordinateTolerance); settings.startNumberCurve++; if (pointDict.Count > 0) { settings.startNumberPoint = pointDict.Count; } int countVertix = acPLine.NumberOfVertices; for (int i = 0; i < countVertix; i++) { Gem.Point2d pt = acPLine.GetPoint2dAt(i); int iMin = (i == 0) ? iMin = countVertix - 1 : iMin = i - 1; int iMax = (i == countVertix - 1) ? iMax = 0 : iMax = i + 1; //Поучаю все три точки угла Gem.Point3d ptO = new Gem.Point3d(acPLine.GetPoint2dAt(i).X, acPLine.GetPoint2dAt(i).Y, 0); Gem.Point3d ptMin = new Gem.Point3d(acPLine.GetPoint2dAt(iMin).X, acPLine.GetPoint2dAt(iMin).Y, 0); Gem.Point3d ptMax = new Gem.Point3d(acPLine.GetPoint2dAt(iMax).X, acPLine.GetPoint2dAt(iMax).Y, 0); Gem.Vector3d vMin = ptO.GetVectorTo(ptMin); Gem.Vector3d vMax = ptO.GetVectorTo(ptMax); Gem.Vector3d vNormaliseMin = vMin / vMin.Length; Gem.Vector3d vNormaliseMax = vMax / vMax.Length; Gem.Vector3d vNormalise = vNormaliseMin + vNormaliseMax; vNormalise = vNormalise / vNormalise.Length; //Тут нужно проверять, попадает ли точка нормализованного вектора внутрь фигуры или наружу using (Db.Ray cl = new Db.Ray()) { cl.BasePoint = ptO + vNormalise; cl.UnitDir = vNormalise; Gem.Point3dCollection pnt3dCol = new Gem.Point3dCollection(); acPLine.IntersectWith(cl, Db.Intersect.OnBothOperands, pnt3dCol, IntPtr.Zero, IntPtr.Zero); if ((pnt3dCol.Count % 2) != 0) { vNormalise = vNormalise * (-1); } } int namb = 0; //Номер вершины if (pointDict.FirstOrDefault(s => s.IsEqualTo(pt, settings.coordinateTolerance)) == null) { Point pnt = new Point(round(pt.X, settings.coordinateTolerance), round(pt.Y, settings.coordinateTolerance), settings.startNumberPoint); //Добавляем нормализованный вектор биссектриссы угла pnt.vNormalise = vNormalise; //Добавляем в список точек pointDict.Add(pnt); //Добавляем в кривую crv.Vertixs.Add(pnt); namb = settings.startNumberPoint; settings.startNumberPoint++; } else { //Добавляем в список вершин уже обраотанную точку crv.Vertixs.Add(pointDict.FirstOrDefault(s => s.IsEqualTo(pt, settings.coordinateTolerance))); } } //Добавляем в список линий curveDict.Add(crv); //Вывожу данные линии в чертеж View.TextToDwg(crv); //View.AddText(crv.textPoint(), $"{crv.Number} \\P S={crv.Area} кв.м."); } acTrans.Commit(); } return(true); }