Jump to content


LIST command or coordinates of all the vertex of a polyline



5 replies to this topic

#1 anan

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 18 December 2013 - 03:32 PM

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.

#2 ISL

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 18 December 2013 - 04:20 PM

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.
Build your own nanoCAD. Visit the nanoCAD API Blog. Join the nanoCAD Developers' Club.

#3 kapathita

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 20 November 2015 - 08:27 AM

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.

#4 ISL

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 20 November 2015 - 08:45 AM

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.
Build your own nanoCAD. Visit the nanoCAD API Blog. Join the nanoCAD Developers' Club.

#5 kapathita

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 20 November 2015 - 11:13 AM

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.

#6 ISL

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 20 November 2015 - 11:32 AM

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.
Build your own nanoCAD. Visit the nanoCAD API Blog. Join the nanoCAD Developers' Club.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users