←  Technical Questions

nanoCAD forum

»

LIST command or coordinates of all the ver...

anan's Photo anan 18 Dec 2013

Hello! I would like to get the coordinates of all the vertex of a polyline nanoCAD using a command like "list" in autocad.
I can not find any similar command. There?
It is now possible to obtain otherwise using lisp for example?
Congratulations nanoCAD and thank you very much for your attention.
Quote

ISL's Photo ISL 18 Dec 2013

There is no LIST command yet. Please use instead the following JScript wrapped into NSF command container:

<?xml version="1.0"?>
<package>
  <command name="list_plines" weight="30" cmdtype="1" caps="2">
		<description>list_plines</description>
		<script lang="JScript"><![CDATA[
forEach(ThisDrawing.PickFirstSelectionSet, function(ent) {
if (ent.EntityName != "AcDbPolyline") return;
var vv = new VBArray(ThisDrawing.Utility.CreateSafeArrayFromVector(ent.Coordinates));
var coords = vv.toArray();
//echo(coords.length);
echo(coords);
})
function echo(msg) {ThisDrawing.Utility.Prompt(msg);}
function forEach(coll, fn) {for (var enu = new Enumerator(coll); !enu.atEnd(); enu.moveNext()) fn(enu.item());}
		]]></script>
  </command>
</package>

Save the script as list_plines.nsf and APPLOAD the file. You can also place the file into Startup Suite to auto-load it every time nanoCAD is started.

The new command is LIST_PLINES. Polylines should be selected before calling this command.
Quote

kapathita's Photo kapathita 20 Nov 2015

Hello there.
I have just installed nanoCAD 5.0 and it seems great.
I also need the same command. A command like "list" in autocad.
I copied the above script to notepad++ and saved it as list_plines.nsf.
I don't know though how to "APPLOAD the file".
I also don't know how to "place the file into Startup Suite to auto-load it every time nanoCAD is started" which is something I need.
Any advice will be more than welcome.
Thank you in advance.
K.
Quote

ISL's Photo ISL 20 Nov 2015

Just type APPLOAD in the command line and the Application Load dialog box will appear. Startup Suite is also there, look for a briefcase icon.

By the way, nanoCAD is partially translated into Greek language, the localization files can be found at http://developer.nan...alization.html.
Quote

kapathita's Photo kapathita 20 Nov 2015

Thank you very much.
It worked just fine.
I have one last question:
When I use that command the result is :
x,y,x,y,x,y,x,y etc
Is it possible to display the coordinates like :
x,y
x,y
x,y
x,y
x,y
etc?

If no, then is it possible to display the coordinates like:
x,y,,x,y,,x,y,,x,y,,x,y,,x,y,,x,y etc or something similar?

I need this because sometimes the coordinates of a polygon are about 100 or more and the separation between one couple of coordinates x,y from the next couple x,y is much easier if there is something different between them (for example two commas (,,) instead of one (,) or another symbol).
Thanks in advance.
Quote

ISL's Photo ISL 20 Nov 2015

To change the output format, you need to manually iterate coords variable that is a JavaScript array and print its contents in the required format.
Quote