I am using AutoCAd 2016 and need to access and exract a sub-set of points from the point cloud that is attached to the working drawing. I need to let the user click-drag a rectangle and or select few points individually and write out their coordinates to a text file. Is this possible - and if so which API should I use? Thank you!
Something along this?
[CommandMethod("Test", CommandFlags.Modal)] public static void ExtractCoordinatesOfPOintsToTextFile() { Document Acdoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database dbs = Acdoc.Database; Editor edt = Acdoc.Editor; PromptSelectionOptions sel = new PromptSelectionOptions(); TypedValue[] typV = { new TypedValue(0, "POINT") }; var ss = edt.GetSelection(new SelectionFilter(typV)); if (ss.Status == PromptStatus.OK) { SaveFileDialog sv = new SaveFileDialog(); sv.Title = "Specify Text file name :"; sv.Filter = "Txt File:|*.txt"; if (sv.ShowDialog() == DialogResult.OK) { using (Transaction trs = dbs.TransactionManager.StartTransaction()) { try { StreamWriter writer = new StreamWriter(sv.FileName); foreach (ObjectId id in ss.Value.GetObjectIds()) { DBPoint p = (DBPoint)trs.GetObject(id, OpenMode.ForRead); writer.Write(p.Position + Environment.NewLine); } writer.Close(); } catch (System.Exception x) { edt.WriteMessage(x.Message); } } } } }
Thanks for the sample code. But that would only select point entities that are par tof the drawing. What I need to do is to select a sub-set of points that are part of a pointcloud that is attached to the working drawing. Any suggestions?
Hi.
I have no idea about the pointcloud , is it create with AutoCAD ?
Point clouds are created in Autodesk ReCap from .LAS files. It is attached to AutoCAD by the PCATTACH command.
Can you attach a sample drawing to have a look ?
Point clouds are very large. Please download a .las file from following link and convert it to .rcp or .rcs file using Autrodesk ReCap (feree desktop version). The you can attach that point cloud to a drawing using POINTCLOUDATTACH command.
Hi
i am trying to start writing à plugin for autocad to make some special tasks on point cloud,
can anyone tell me how and where to start please? I used to creat autocad plugins in vb and c# under Visual studio.
Please help.
I think you need to have a library/sdk (https://www.autodesk.com/developer-network/platform-technologies/reality-solutions-sdk)
And to have it you need be a stantard ADN member witch is not free.
For pointclouds, it is best to use ObjectARX, there are more methods and you can accomplish things not possible in .NET. Like spatialfilters or the pointAttributes method which is what could probably be used by the original poster to get coordinates of points.
Accessing the points in a Point Cloud attached to AutoCAD is not possible with the AutoCAD API as far as I know.
You can build your own .las/laz Point Cloud file reader using this library: https://github.com/shintadono/laszip.net
Then you can access the points of the file directly without converting it to a .rcs file.
Can't find what you're looking for? Ask the community or share your knowledge.