public static ngeometry.VectorGeometry.Ellipse ToCeometricEllipse(Autodesk.AutoCAD.DatabaseServices.Ellipse dbe) { ngeometry.VectorGeometry.Point center = new ngeometry.VectorGeometry.Point(dbe.Center.X, dbe.Center.Y, dbe.Center.Z); ngeometry.VectorGeometry.Vector3d semimajorAxis = new ngeometry.VectorGeometry.Vector3d(dbe.MajorAxis.X, dbe.MajorAxis.Y, dbe.MajorAxis.Z); ngeometry.VectorGeometry.Vector3d semiminorAxis = new ngeometry.VectorGeometry.Vector3d(dbe.MinorAxis.X, dbe.MinorAxis.Y, dbe.MinorAxis.Z); return(new ngeometry.VectorGeometry.Ellipse(center, semimajorAxis, semiminorAxis)); }
public static List <Edge> ToCeometricAcDbEdgeList(ObjectId[] lineIDs) { Database workingDatabase = HostApplicationServices.WorkingDatabase; List <Edge> list = new List <Edge>(); using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction()) { string arg_1D_0 = SymbolUtilityServices.BlockModelSpaceName; LayerTable arg_30_0 = (LayerTable)transaction.GetObject(workingDatabase.LayerTableId, (OpenMode)0); for (int i = 0; i < lineIDs.Length; i++) { Autodesk.AutoCAD.DatabaseServices.Line line = (Autodesk.AutoCAD.DatabaseServices.Line)transaction.GetObject(lineIDs[i], (OpenMode)0, true); LayerTableRecord arg_66_0 = (LayerTableRecord)transaction.GetObject(line.LayerId, (OpenMode)0); Point3d startPoint = line.StartPoint; Point3d endPoint = line.EndPoint; ngeometry.VectorGeometry.Point startPoint2 = new ngeometry.VectorGeometry.Point(startPoint.X, startPoint.Y, startPoint.Z); ngeometry.VectorGeometry.Point endPoint2 = new ngeometry.VectorGeometry.Point(endPoint.X, endPoint.Y, endPoint.Z); list.Add(new Edge(startPoint2, endPoint2) { AcDbLine = line }); } } return(list); }
public static List <Triangle> ToCeometricTriangleList(ObjectId[] idArray) { if (idArray == null) { throw new System.Exception("No faces selected."); } Database workingDatabase = HostApplicationServices.WorkingDatabase; List <Triangle> list = new List <Triangle>(); using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction()) { for (int i = 0; i < idArray.Length; i++) { Autodesk.AutoCAD.DatabaseServices.Face face = (Autodesk.AutoCAD.DatabaseServices.Face)transaction.GetObject(idArray[i], (OpenMode)0, true); Point3d vertexAt = face.GetVertexAt(0); Point3d vertexAt2 = face.GetVertexAt(1); Point3d vertexAt3 = face.GetVertexAt(2); Point3d vertexAt4 = face.GetVertexAt(3); ngeometry.VectorGeometry.Point point = new ngeometry.VectorGeometry.Point(vertexAt.X, vertexAt.Y, vertexAt.Z); ngeometry.VectorGeometry.Point point2 = new ngeometry.VectorGeometry.Point(vertexAt2.X, vertexAt2.Y, vertexAt2.Z); ngeometry.VectorGeometry.Point point3 = new ngeometry.VectorGeometry.Point(vertexAt3.X, vertexAt3.Y, vertexAt3.Z); ngeometry.VectorGeometry.Point point4 = new ngeometry.VectorGeometry.Point(vertexAt4.X, vertexAt4.Y, vertexAt4.Z); if (point != point2 && point != point3 && point != point4 && point2 != point3 && point2 != point4 && point3 != point4) { list.Add(new Triangle(point, point2, point4, false)); list.Add(new Triangle(point2, point3, point4, false)); } else { list.Add(new Triangle(point, point2, point3, false)); } } } return(list); }
public static PointSet SubdivideLine(Autodesk.AutoCAD.DatabaseServices.Line dbl, double d) { PointSet result; try { PointSet pointSet = new PointSet(); ngeometry.VectorGeometry.Point point = new ngeometry.VectorGeometry.Point(dbl.StartPoint.X, dbl.StartPoint.Y, dbl.StartPoint.Z); ngeometry.VectorGeometry.Point point2 = new ngeometry.VectorGeometry.Point(dbl.EndPoint.X, dbl.EndPoint.Y, dbl.EndPoint.Z); double num = point.DistanceTo(point2); int num2 = Math.Max((int)Math.Ceiling(num / d), 1); ngeometry.VectorGeometry.Vector3d vector = point2.method_2() - point.method_2(); for (int i = 0; i <= num2; i++) { double scalar = (double)i / (double)num2; pointSet.Add(new Point(point.method_2() + scalar * vector)); } result = pointSet; } catch (System.Exception ex) { Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("Can not subdivide line (handle: " + dbl.Handle.ToString() + ")\n"); result = null; } return(result); }
public static void Transform(ngeometry.VectorGeometry.Point p, Autodesk.AutoCAD.Geometry.Matrix3d matrix) { Autodesk.AutoCAD.Geometry.Point3d p3d = new Point3d(p.X, p.Y, p.Z); Autodesk.AutoCAD.Geometry.Point3d r = p3d.TransformBy(matrix); p.X = r.X; p.Y = r.Y; p.Z = r.Z; }
public static List <Triangle> ToCeometricCADDataTriangleList(ObjectId[] faceIDs) { Database workingDatabase = HostApplicationServices.WorkingDatabase; List <Triangle> list = new List <Triangle>(); using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction()) { string blockModelSpaceName = SymbolUtilityServices.BlockModelSpaceName; LayerTable arg_30_0 = (LayerTable)transaction.GetObject(workingDatabase.LayerTableId, (OpenMode)0); for (int i = 0; i < faceIDs.Length; i++) { Autodesk.AutoCAD.DatabaseServices.Face face = (Autodesk.AutoCAD.DatabaseServices.Face)transaction.GetObject(faceIDs[i], (OpenMode)0, true); LayerTableRecord layerTableRecord = (LayerTableRecord)transaction.GetObject(face.LayerId, (OpenMode)0); Autodesk.AutoCAD.Colors.Color color = face.Color; if (color.IsByLayer) { color = layerTableRecord.Color; } System.Drawing.Color empty = System.Drawing.Color.Empty; short colorIndex = 256; Conversions.GetColors(color, ref empty, ref colorIndex); CADData cADData = new CADData(); cADData.Layer.Name = layerTableRecord.Name; cADData.Color = empty; cADData.ColorIndex = colorIndex; cADData.BlockName = blockModelSpaceName; Point3d vertexAt = face.GetVertexAt(0); Point3d vertexAt2 = face.GetVertexAt(1); Point3d vertexAt3 = face.GetVertexAt(2); Point3d vertexAt4 = face.GetVertexAt(3); ngeometry.VectorGeometry.Point point = new ngeometry.VectorGeometry.Point(vertexAt.X, vertexAt.Y, vertexAt.Z); ngeometry.VectorGeometry.Point point2 = new ngeometry.VectorGeometry.Point(vertexAt2.X, vertexAt2.Y, vertexAt2.Z); ngeometry.VectorGeometry.Point point3 = new ngeometry.VectorGeometry.Point(vertexAt3.X, vertexAt3.Y, vertexAt3.Z); ngeometry.VectorGeometry.Point point4 = new ngeometry.VectorGeometry.Point(vertexAt4.X, vertexAt4.Y, vertexAt4.Z); if (point != point2 && point != point3 && point != point4 && point2 != point3 && point2 != point4 && point3 != point4) { list.Add(new Triangle(point, point2, point4, false) { CADData = cADData }); list.Add(new Triangle(point2, point3, point4, false) { CADData = cADData }); } else { list.Add(new Triangle(point, point2, point3, false) { CADData = cADData }); } } } return(list); }
public void addSelfInterPoints(ngeometry.VectorGeometry.Point p) { int index = findSelfInterPoint(p); if (index >= 0) { return; } selfIntersectionPoints.Add(p); }
public void Transform(ngeometry.VectorGeometry.Point p) { if (this.bool_0) { return; } double x = p.X; double y = p.Y; double z = p.Z; p.X = this.double_0 * x + this.double_1 * y + this.double_2 * z + this.double_9; p.Y = this.double_3 * x + this.double_4 * y + this.double_5 * z + this.double_10; p.Z = this.double_6 * x + this.double_7 * y + this.double_8 * z + this.double_11; }
public int findSelfInterPoint(ngeometry.VectorGeometry.Point p) { int index = selfIntersectionPoints.FindIndex(item => { ngeometry.VectorGeometry.Point pp = item as ngeometry.VectorGeometry.Point; if (Math.Abs(pp.X - p.X) <= 1e-10 && Math.Abs(pp.Y - p.Y) <= 1e-10) { return(true); } return(false); }); return(index); }
public static CoordinateSystem GetCeometricUcs() { Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Autodesk.AutoCAD.Geometry.Matrix3d currentUserCoordinateSystem = editor.CurrentUserCoordinateSystem; Point3d origin = currentUserCoordinateSystem.CoordinateSystem3d.Origin; Autodesk.AutoCAD.Geometry.Vector3d xaxis = currentUserCoordinateSystem.CoordinateSystem3d.Xaxis; Autodesk.AutoCAD.Geometry.Vector3d yaxis = currentUserCoordinateSystem.CoordinateSystem3d.Yaxis; Autodesk.AutoCAD.Geometry.Vector3d zaxis = currentUserCoordinateSystem.CoordinateSystem3d.Zaxis; ngeometry.VectorGeometry.Point originPoint = new ngeometry.VectorGeometry.Point(origin.X, origin.Y, origin.Z); ngeometry.VectorGeometry.Vector3d e = new ngeometry.VectorGeometry.Vector3d(xaxis.X, xaxis.Y, xaxis.Z); ngeometry.VectorGeometry.Vector3d e2 = new ngeometry.VectorGeometry.Vector3d(yaxis.X, yaxis.Y, yaxis.Z); ngeometry.VectorGeometry.Vector3d e3 = new ngeometry.VectorGeometry.Vector3d(zaxis.X, zaxis.Y, zaxis.Z); return(new ngeometry.VectorGeometry.CoordinateSystem(originPoint, e, e2, e3)); }
internal static ObjectId[] smethod_0(ObjectId[] objectId_0) { Database workingDatabase = HostApplicationServices.WorkingDatabase; List <ObjectId> list = new List <ObjectId>(); using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction()) { BlockTable arg_2A_0 = (BlockTable)transaction.GetObject(workingDatabase.BlockTableId, (OpenMode)0); for (int i = objectId_0.Length - 1; i >= 0; i--) { Autodesk.AutoCAD.DatabaseServices.Face face = (Autodesk.AutoCAD.DatabaseServices.Face)transaction.GetObject(objectId_0[i], (OpenMode)1, true); BlockTableRecord blockTableRecord = (BlockTableRecord)transaction.GetObject(face.BlockId, (OpenMode)1); Point3d vertexAt = face.GetVertexAt(0); Point3d vertexAt2 = face.GetVertexAt(1); Point3d vertexAt3 = face.GetVertexAt(2); Point3d vertexAt4 = face.GetVertexAt(3); ngeometry.VectorGeometry.Point left = new ngeometry.VectorGeometry.Point(vertexAt.X, vertexAt.Y, vertexAt.Z); ngeometry.VectorGeometry.Point point = new ngeometry.VectorGeometry.Point(vertexAt2.X, vertexAt2.Y, vertexAt2.Z); ngeometry.VectorGeometry.Point point2 = new ngeometry.VectorGeometry.Point(vertexAt3.X, vertexAt3.Y, vertexAt3.Z); ngeometry.VectorGeometry.Point right = new ngeometry.VectorGeometry.Point(vertexAt4.X, vertexAt4.Y, vertexAt4.Z); if (left != point && left != point2 && left != right && point != point2 && point != right && point2 != right) { Autodesk.AutoCAD.DatabaseServices.Face face2 = new Autodesk.AutoCAD.DatabaseServices.Face(vertexAt, vertexAt2, vertexAt4, true, true, true, true); face2.LayerId = (face.LayerId); blockTableRecord.AppendEntity(face2); transaction.AddNewlyCreatedDBObject(face2, true); list.Add(face2.ObjectId); Autodesk.AutoCAD.DatabaseServices.Face face3 = new Autodesk.AutoCAD.DatabaseServices.Face(vertexAt2, vertexAt3, vertexAt4, true, true, true, true); face3.LayerId = (face.LayerId); blockTableRecord.AppendEntity(face3); transaction.AddNewlyCreatedDBObject(face3, true); list.Add(face3.ObjectId); if (!face.IsErased) { face.Erase(); } } else { list.Add(face.ObjectId); } } transaction.Commit(); } return(list.ToArray()); }
public static List <Triangle> ToCeometricAcDbTriangleList(ObjectId[] faceIDs) { Database workingDatabase = HostApplicationServices.WorkingDatabase; List <Triangle> list = new List <Triangle>(); using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction()) { for (int i = 0; i < faceIDs.Length; i++) { Autodesk.AutoCAD.DatabaseServices.Face face = (Autodesk.AutoCAD.DatabaseServices.Face)transaction.GetObject(faceIDs[i], (OpenMode)0, true); Point3d vertexAt = face.GetVertexAt(0); Point3d vertexAt2 = face.GetVertexAt(1); Point3d vertexAt3 = face.GetVertexAt(2); Point3d vertexAt4 = face.GetVertexAt(3); ngeometry.VectorGeometry.Point point = new ngeometry.VectorGeometry.Point(vertexAt.X, vertexAt.Y, vertexAt.Z); ngeometry.VectorGeometry.Point point2 = new ngeometry.VectorGeometry.Point(vertexAt2.X, vertexAt2.Y, vertexAt2.Z); ngeometry.VectorGeometry.Point point3 = new ngeometry.VectorGeometry.Point(vertexAt3.X, vertexAt3.Y, vertexAt3.Z); ngeometry.VectorGeometry.Point point4 = new ngeometry.VectorGeometry.Point(vertexAt4.X, vertexAt4.Y, vertexAt4.Z); if (point != point2 && point != point3 && point != point4 && point2 != point3 && point2 != point4 && point3 != point4) { list.Add(new Triangle(point, point2, point4, false) { AcDbFace = face }); list.Add(new Triangle(point2, point3, point4, false) { AcDbFace = face }); } else { list.Add(new Triangle(point, point2, point3, false) { AcDbFace = face }); } } } return(list); }
private string method_5(ngeometry.VectorGeometry.Point point_0, ref int int_2) { string format = this.method_7(IO2.int_1); string text = this.method_6(); string text2 = point_0.X.ToString(format); string text3 = point_0.Y.ToString(format); string text4 = point_0.Z.ToString(format); if (IO2.int_0 > 0) { text2 = text2.PadLeft(IO2.int_0); text3 = text3.PadLeft(IO2.int_0); text4 = text4.PadLeft(IO2.int_0); if (text2.Length > IO2.int_0) { text2 = text2.Remove(0).PadLeft(IO2.int_0, '*'); int_2++; } if (text3.Length > IO2.int_0) { text3 = text3.Remove(0).PadLeft(IO2.int_0, '*'); int_2++; } if (text4.Length > IO2.int_0) { text4 = text4.Remove(0).PadLeft(IO2.int_0, '*'); int_2++; } } return(string.Concat(new string[] { text2, text, text3, text, text4, text })); }
public static List <Edge> ToCeometricCADDataEdgeList(ObjectId[] lineIDs) { Database workingDatabase = HostApplicationServices.WorkingDatabase; List <Edge> list = new List <Edge>(); using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction()) { string blockModelSpaceName = SymbolUtilityServices.BlockModelSpaceName; LayerTable arg_30_0 = (LayerTable)transaction.GetObject(workingDatabase.LayerTableId, (OpenMode)0); for (int i = 0; i < lineIDs.Length; i++) { Autodesk.AutoCAD.DatabaseServices.Line line = (Autodesk.AutoCAD.DatabaseServices.Line)transaction.GetObject(lineIDs[i], (OpenMode)0, true); LayerTableRecord layerTableRecord = (LayerTableRecord)transaction.GetObject(line.LayerId, (OpenMode)0); Autodesk.AutoCAD.Colors.Color color = line.Color; if (color.IsByLayer) { color = layerTableRecord.Color; } System.Drawing.Color empty = System.Drawing.Color.Empty; short colorIndex = 256; Conversions.GetColors(color, ref empty, ref colorIndex); CADData cADData = new CADData(); cADData.Layer.Name = layerTableRecord.Name; cADData.Color = empty; cADData.ColorIndex = colorIndex; cADData.BlockName = blockModelSpaceName; Point3d startPoint = line.StartPoint; Point3d endPoint = line.EndPoint; ngeometry.VectorGeometry.Point startPoint2 = new ngeometry.VectorGeometry.Point(startPoint.X, startPoint.Y, startPoint.Z); ngeometry.VectorGeometry.Point endPoint2 = new ngeometry.VectorGeometry.Point(endPoint.X, endPoint.Y, endPoint.Z); list.Add(new Edge(startPoint2, endPoint2) { CADData = cADData }); } } return(list); }
public static Region NewRegion(ngeometry.VectorGeometry.Point seedP) { Point3d p = new Point3d(seedP.X, seedP.Y, seedP.Z); return(NewRegion(p)); }
public void ProjectLinesCommand() { Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; try { //LicenseManager.CheckValid("FULL"); ObjectId[] objectId_ = CommandLineQuerries.SelectFaces(false); ObjectId[] objectId_2 = CommandLineQuerries.SelectLines(false); LineProjection.string_2 = CommandLineQuerries.SpecifyProjectionDirection(LineProjection.string_2); //new Vector3d(0.0, 0.0, 1.0); ngeometry.VectorGeometry.Vector3d directionVector = new ngeometry.VectorGeometry.Vector3d(1.0, 0.0, 0.0); ngeometry.VectorGeometry.Vector3d directionVector2 = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0); string a; if ((a = LineProjection.string_2.ToUpper()) != null) { if (!(a == "X")) { if (!(a == "Y")) { if (!(a == "Z")) { if (!(a == "U")) { if (!(a == "2P")) { goto IL_267; } CommandLineQuerries.Specify2PDirection().BasisVector[2].Normalize(); } else { Conversions.GetUCS().BasisVector[2].Normalize(); } } else { directionVector = new ngeometry.VectorGeometry.Vector3d(1.0, 0.0, 0.0); directionVector2 = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0); //new Vector3d(0.0, 0.0, 1.0); } } else { directionVector = new ngeometry.VectorGeometry.Vector3d(1.0, 0.0, 0.0); directionVector2 = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0); //new Vector3d(0.0, 1.0, 0.0); } } else { directionVector = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0); directionVector2 = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0); //new Vector3d(0.0, 0.0, 1.0); } ngeometry.VectorGeometry.Point point = new ngeometry.VectorGeometry.Point(0.0, 0.0, 0.0); ngeometry.VectorGeometry.Plane plane = new ngeometry.VectorGeometry.Plane(point, directionVector, directionVector2); CoordinateSystem coordinateSystem_ = new CoordinateSystem(plane); LineProjection.string_1 = CommandLineQuerries.InsertOnLayer_Current_Face_Line(LineProjection.string_1); LineProjection.string_0 = CommandLineQuerries.KeywordYesNo("Delete original lines", LineProjection.string_0, false, false); this.method_0(objectId_2, objectId_, coordinateSystem_, true); return; } IL_267: throw new System.Exception("Invalid option keyword."); } catch (System.Exception ex) { editor.WriteMessage("\n" + ex.Message + "\n"); } }
public static List <Edge> ToCeometricEdgeList(ObjectId[] idArray) { Database workingDatabase = HostApplicationServices.WorkingDatabase; List <Edge> list = new List <Edge>(); using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction()) { for (int i = 0; i < idArray.Length; i++) { DBObject @object = transaction.GetObject(idArray[i], (OpenMode)0); if (!(@object == null)) { Autodesk.AutoCAD.DatabaseServices.Line line = @object as Autodesk.AutoCAD.DatabaseServices.Line; if (line != null) { ngeometry.VectorGeometry.Point startPoint = Conversions.ToCeometricPoint(line.StartPoint); ngeometry.VectorGeometry.Point endPoint = Conversions.ToCeometricPoint(line.EndPoint); list.Add(new Edge(startPoint, endPoint)); } else { PointSet pointSet = null; Polyline polyline = @object as Polyline; if (polyline != null) { pointSet = PointGeneration.SubdivideLWPolyline(polyline, 0.0); if (polyline.Closed) { pointSet.Add(pointSet[0]); } } Polyline2d polyline2d = @object as Polyline2d; if (polyline2d != null) { pointSet = PointGeneration.SubdividePolyline2d(polyline2d, transaction, 0.0); if (polyline2d.Closed) { pointSet.Add(pointSet[0]); } } Polyline3d polyline3d = @object as Polyline3d; if (polyline3d != null) { pointSet = PointGeneration.SubdividePolyline3d(polyline3d, transaction, 0.0); if (polyline3d.Closed) { pointSet.Add(pointSet[0]); } } if (pointSet != null) { for (int j = 0; j < pointSet.Count - 1; j++) { list.Add(new Edge(pointSet[j], pointSet[j + 1])); } } } } } } return(list); }
public static Hatch NewHatch(ngeometry.VectorGeometry.Point seedP) { Point3d p = new Point3d(seedP.X, seedP.Y, seedP.Z); return(NewHatch(p)); }
private void method_3(ObjectId[] objectId_0) { Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Database workingDatabase = HostApplicationServices.WorkingDatabase; MessageFilter messageFilter = new MessageFilter(); System.Windows.Forms.Application.AddMessageFilter(messageFilter); ProgressMeter progressMeter = new ProgressMeter(); progressMeter.SetLimit(objectId_0.Length); progressMeter.Start("Writing 3df"); try { CoordinateTransformator2 coordinateTransformator = new CoordinateTransformator2(CoordinateSystem.Global(), Conversions.GetUCS()); int num = 0; int num2 = 0; string text = this.method_6(); using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction()) { using (StreamWriter streamWriter = new StreamWriter(IO2.string_2)) { streamWriter.WriteLine(string.Concat(new object[] { "C ", IO2.string_2, " generated ", DateTime.Now })); if (text == ",") { streamWriter.WriteLine("C Format: Layer name, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4"); } if (text == ";") { streamWriter.WriteLine("C Format: Layer name; x1; y1; z1; x2; y2; z2; x3; y3; z3; x4; y4; z4"); } if (text == " ") { streamWriter.WriteLine("C Format: Layer name x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4"); } for (int i = 0; i < objectId_0.Length; i++) { Autodesk.AutoCAD.DatabaseServices.Face face = (Autodesk.AutoCAD.DatabaseServices.Face)transaction.GetObject(objectId_0[i], (OpenMode)0, true); Point3d vertexAt = face.GetVertexAt(0); Point3d vertexAt2 = face.GetVertexAt(1); Point3d vertexAt3 = face.GetVertexAt(2); Point3d vertexAt4 = face.GetVertexAt(3); ngeometry.VectorGeometry.Point point = new ngeometry.VectorGeometry.Point(vertexAt.X, vertexAt.Y, vertexAt.Z); ngeometry.VectorGeometry.Point point2 = new ngeometry.VectorGeometry.Point(vertexAt2.X, vertexAt2.Y, vertexAt2.Z); ngeometry.VectorGeometry.Point point3 = new ngeometry.VectorGeometry.Point(vertexAt3.X, vertexAt3.Y, vertexAt3.Z); ngeometry.VectorGeometry.Point point4 = new ngeometry.VectorGeometry.Point(vertexAt4.X, vertexAt4.Y, vertexAt4.Z); coordinateTransformator.Transform(point); coordinateTransformator.Transform(point2); coordinateTransformator.Transform(point3); coordinateTransformator.Transform(point4); string text2 = face.Layer.PadLeft(IO2.int_0) + text; text2 += this.method_5(point, ref num); text2 += this.method_5(point2, ref num); text2 += this.method_5(point3, ref num); text2 += this.method_5(point4, ref num); streamWriter.WriteLine(text2.TrimEnd(new char[0])); progressMeter.MeterProgress(); messageFilter.CheckMessageFilter((long)i, 10000); num2++; } streamWriter.Flush(); } } progressMeter.Stop(); if (num > 0) { editor.WriteMessage(string.Concat(new object[] { Environment.NewLine, num, " conversion errors occurred writing ", IO2.string_2, ". Increase the column width and/or decrease the number of decimal digits." })); Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(string.Concat(new object[] { num, " conversion errors occurred writing ", IO2.string_2, ".\nIncrease the column width and/or decrease the number of decimal digits." })); } FileInfo fileInfo = new FileInfo(IO2.string_2); editor.WriteMessage(Environment.NewLine + "Output file name : " + fileInfo.FullName); editor.WriteMessage(Environment.NewLine + "Number of faces written : " + num2.ToString()); editor.WriteMessage(Environment.NewLine + "Coordinate conversion errors: " + num.ToString()); } catch (System.Exception ex) { progressMeter.Stop(); throw; } }
public static ngeometry.VectorGeometry.Circle ToCeometricCircle(Autodesk.AutoCAD.DatabaseServices.Circle circle /*ng:类型存疑*/) { ngeometry.VectorGeometry.Point center = new ngeometry.VectorGeometry.Point(circle.Center.X, circle.Center.Y, circle.Center.Z); ngeometry.VectorGeometry.Vector3d normalVector = new ngeometry.VectorGeometry.Vector3d(circle.Normal.X, circle.Normal.Y, circle.Normal.Z); return(new ngeometry.VectorGeometry.Circle(center, circle.Radius, normalVector)); }
public void WriteXYZ(ObjectId[] pointIDs) { Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Database workingDatabase = HostApplicationServices.WorkingDatabase; MessageFilter messageFilter = new MessageFilter(); System.Windows.Forms.Application.AddMessageFilter(messageFilter); ProgressMeter progressMeter = new ProgressMeter(); progressMeter.SetLimit(pointIDs.Length); progressMeter.Start("Writing XYZ"); try { CoordinateTransformator2 coordinateTransformator = new CoordinateTransformator2(CoordinateSystem.Global(), Conversions.GetUCS()); int num = 0; int num2 = 0; string a = this.method_6(); using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction()) { using (StreamWriter streamWriter = new StreamWriter(IO2.string_5)) { streamWriter.WriteLine(string.Concat(new object[] { "C ", IO2.string_5, " generated ", DateTime.Now })); if (a == ",") { streamWriter.WriteLine("C Format: x, y, z,"); } if (a == ";") { streamWriter.WriteLine("C Format: x; y; z;"); } if (a == " ") { streamWriter.WriteLine("C Format: x y z"); } for (int i = 0; i < pointIDs.Length; i++) { DBPoint dBPoint = (DBPoint)transaction.GetObject(pointIDs[i], (OpenMode)0, true); ngeometry.VectorGeometry.Point point = new ngeometry.VectorGeometry.Point(dBPoint.Position.X, dBPoint.Position.Y, dBPoint.Position.Z); coordinateTransformator.Transform(point); string text = this.method_5(point, ref num); streamWriter.WriteLine(text.TrimEnd(new char[0])); progressMeter.MeterProgress(); messageFilter.CheckMessageFilter((long)i, 10000); num2++; } streamWriter.Flush(); } } progressMeter.Stop(); if (num > 0) { editor.WriteMessage(string.Concat(new object[] { Environment.NewLine, num, " conversion errors occurred writing ", IO2.string_5, ". Increase the column width and/or decrease the number of decimal digits." })); Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(string.Concat(new object[] { num, " conversion errors occurred writing ", IO2.string_5, ".\nIncrease the column width and/or decrease the number of decimal digits." })); } FileInfo fileInfo = new FileInfo(IO2.string_5); editor.WriteMessage(Environment.NewLine + "Output file name : " + fileInfo.FullName); editor.WriteMessage(Environment.NewLine + "Number of points written : " + num2.ToString()); editor.WriteMessage(Environment.NewLine + "Coordinate conversion errors: " + num.ToString()); } catch (System.Exception ex) { progressMeter.Stop(); throw; } }
public static Edge ToCeometricEdge(Autodesk.AutoCAD.DatabaseServices.Line line) { ngeometry.VectorGeometry.Point startPoint = new ngeometry.VectorGeometry.Point(line.StartPoint.X, line.StartPoint.Y, line.StartPoint.Z); ngeometry.VectorGeometry.Point endPoint = new ngeometry.VectorGeometry.Point(line.EndPoint.X, line.EndPoint.Y, line.EndPoint.Z); return(new Edge(startPoint, endPoint)); }