I have a point3d array, and i should create a surface or region by them, but i faild:
-2717.21,-2745.87,-72135
-2717.21,-2745.87,-71835
-2662.88,-2661.92,-71835
-2662.88,-2661.92,-71847
-2711.78,-2737.47,-71854.2
-2711.78,-2737.47,-72115.8
-2662.88,-2661.92,-72123
-2662.88,-2661.92,-72135
-2717.21,-2745.87,-72135
First, i create eight lines by these point3d, the use Region.CreateFromCurves() to create region but faild, then i try to create the region in AutoCAD, but it's faild too and show me: Open objects must be coplanar.
Is there anybody can give me some help? thanks a lot!
Solved! Go to Solution.
Solved by Alexander.Rivilis. Go to Solution.
You can create a region from any closed loop. See this article.
If your point array defines a closed loop, you can create a closed polyline from it and then create the region.
I have try to draw a 3dpoly by these point3d in AutoCAD, then create region by this 3dpoly, but faild too with a message:1 closed, degenerate or unsupported object rejected.
If points do not belong to the same plane it is impossible to create Region from those points.
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
I know the points must belong to the same plane to create Region, but is there anyway to create a object like region or surface by these points? thanks a lot!
It is impossible create Region with this set of points.
I do not understand what can be done from this set of points in general. This set of points looks like a set of vertical bars.
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
These data are come from another 3D software, in this software these points can create a polyhedron as shown below. So i'm try to create it in AutoCAD with these points:
Ok. As far as all points in your set is on one plane - it is possible to create Region.
using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.EditorInput; #pragma warning disable 0618 [assembly: CommandClass(typeof(CreateRegion.MyCommands))] namespace CreateRegion { public class MyCommands { [CommandMethod("CreateRegsFromPoints")] public void MyCommand() // This method can have any name { // Put your command code here Document doc = Application.DocumentManager.MdiActiveDocument; if (doc == null) return; Editor ed = doc.Editor; Point3dCollection pts = GetPoints(); Plane plane = new Plane(pts[0], pts[1], pts[2]); for (int i = 0; i < pts.Count; i++) { pts[i] = pts[i].OrthoProject(plane); } ObjectId plineId = ObjectId.Null; using (Polyline pline = new Polyline()) { pline.Normal = plane.Normal; Matrix3d mat = Matrix3d.PlaneToWorld(plane).Inverse(); for (int i = 0; i < pts.Count; i++) { Point3d p = pts[i].TransformBy(mat); pline.AddVertexAt(i, new Point2d(p.X, p.Y), 0, 0, 0); } mat = Matrix3d.Displacement(pts[0] - pline.GetPoint3dAt(0)); pline.TransformBy(mat); using (BlockTableRecord btr = doc.Database.CurrentSpaceId.Open(OpenMode.ForWrite) as BlockTableRecord) { // plineId = btr.AppendEntity(pline); DBObjectCollection objs = new DBObjectCollection(); objs.Add(pline); DBObjectCollection regs = Region.CreateFromCurves(objs); if (regs != null) { for (int i = 0; i < regs.Count; i++) { using (regs[i]) { Entity ent = regs[i] as Entity; if (ent != null) btr.AppendEntity(ent); } } } } } } Point3dCollection GetPoints() { Point3dCollection pts = new Point3dCollection(); pts.Add(new Point3d(-2717.21, -2745.87, -72135)); pts.Add(new Point3d(-2717.21, -2745.87, -71835)); pts.Add(new Point3d(-2662.88, -2661.92, -71835)); pts.Add(new Point3d(-2662.88, -2661.92, -71847)); pts.Add(new Point3d(-2711.78, -2737.47, -71854.2)); pts.Add(new Point3d(-2711.78, -2737.47, -72115.8)); pts.Add(new Point3d(-2662.88, -2661.92, -72123)); pts.Add(new Point3d(-2662.88, -2661.92, -72135)); pts.Add(new Point3d(-2717.21, -2745.87, -72135)); return pts; } } }
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Can't find what you're looking for? Ask the community or share your knowledge.