Over 1.104.000 registered users (EN+CZ).
AutoCAD tips, Inventor tips, Revit tips, Civil tips, Fusion tips.
Try the new precise Engineering calculator.
New AutoCAD 2026 commands and sys.variables and env.variables,.
Discussion forum
?CAD discussions, advices, exchange of experience
CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.
Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
|
Post Reply
|
| Author | |
thinker
Groupie
Joined: 08.Jun.2013 Location: United Arab Emirates Using: AutoCAD2024 Status: Offline Points: 38 |
Topic: Lisp To Label The Polyline CoordinatesPosted: 12.Jun.2013 at 17:02 |
|
Here I ask to make change in a lisp, now i am looking for one lisp that can label the coordinates of selected polylines i attach a simple image to describe the requirments
Edited by thinker - 12.Jun.2013 at 17:55 |
|
![]() |
|
Kent Cooper
Senior Member
Joined: 12.Mar.2013 Location: United States Using: AutoCAD2020, 2023 Status: Offline Points: 686 |
Posted: 13.Jun.2013 at 15:02 |
|
I will assume you want to label all vertices, including all ends, though your illustration appears to have labels on some but not all ends. [If there are tiny end segments not visible, and you don't want any ends, that can be arranged.] Getting the text content is not difficult, but getting a routine to find the location at which to put it for each vertex seems like a real challenge, so the following leaves that to the User, and steps through each vertex. In simplest terms, and minimally tested, this seems to work:
(vl-load-com) (defun C:PVCL ; = PolyLine Vertex Coordinates Labeler(/ pl par ver txt) (setq pl (car (entsel "\nSelect Polyline to label its vertices: ")) par -1 ); setq (repeat (cdr (assoc 90 (entget pl))); number of vertices (setq ver (vlax-curve-getPointAtParam pl (setq par (1+ par))) txt (strcat (rtos (car ver) 2 3) "\\P" (rtos (cadr ver) 2 3)) ); setq (command "_.leader" "_none" ver pause "" txt "") ); repeat ); defun You would want to add things to set the Leader style and perhaps Layer, maybe your own prompt for the second point of the Leader, and the usual other controls [error handling, command echo suppression (in which case you would need to supply that prompt), maybe object-snap suppression (in which case you could take out the "_none"), etc.].
|
|
![]() |
|
thinker
Groupie
Joined: 08.Jun.2013 Location: United Arab Emirates Using: AutoCAD2024 Status: Offline Points: 38 |
Posted: 13.Jun.2013 at 16:19 |
|
Thank you Mr. Kent Cooper i really need this lisp
I need to label all vertices including ends, in screenshot all vertices are labelled.I need put text location manually as in routine so text loction doesnot matter,as I check it works very good, only problem is it works in world ucs only other ucs it doesnot support,
I did not have good knowledge of lisp but as my requirement i change the code, new code is here
(vl-load-com)
(defun C:CV ; = PolyLine Vertex Coordinates Labeler (/ pl par ver txt) (setq pl (car (entsel "\nSelect Polyline to label its vertices: ")) par -1 ); setq (repeat (cdr (assoc 90 (entget pl))); number of vertices (setq ver (vlax-curve-getPointAtParam pl (setq par (1+ par))) txt (strcat (rtos (/(cadr ver) 2) 2 3) "\\P" (rtos (car ver) 2 3)) ); setq (command "_.leader" "_none" ver pause "" txt "") ); repeat ); defun Thanks. Edited by thinker - 13.Jun.2013 at 16:20 |
|
![]() |
|
Kent Cooper
Senior Member
Joined: 12.Mar.2013 Location: United States Using: AutoCAD2020, 2023 Status: Offline Points: 686 |
Posted: 17.Jun.2013 at 17:10 |
|
For other-than-World Coordinate Systems, you can translate the vertex locations [which will always be returned in WCS value]. Try replacing this:
with this:
ver (trans (vlax-curve-getPointAtParam pl (setq par (1+ par))) 0 1)
The 0 means translate from the WCS, and the 1 means translate to the current Coordinate System [see the AutoLISP Reference about the (trans) function]. Edited by Kent Cooper - 17.Jun.2013 at 17:11 |
|
![]() |
|
Vladimir Michl
Moderator Group
Arkance Systems CZ Joined: 26.Jul.2007 Location: Czech Republic Using: Autodesk software Status: Offline Points: 2143 |
Posted: 19.Jun.2013 at 13:59 |
|
You can also use dynamic blocks and the VerticesBlk tool - see the video:
and the tip:
|
|
|
Vladimir Michl (moderator)
ARKANCE - https://arkance.world - Autodesk Platinum Partner |
|
![]() |
|
thinker
Groupie
Joined: 08.Jun.2013 Location: United Arab Emirates Using: AutoCAD2024 Status: Offline Points: 38 |
Posted: 26.Jun.2013 at 05:58 |
|
sorry for late reply i am too busy in my office
@Kent Cooper thank you it works very good, i will study your recomanded function
@Vladimir Michl as per my illustration i need coordinates with leader, i will see video later
Thanks to all. Edited by thinker - 26.Jun.2013 at 06:28 |
|
![]() |
|
sahaj
Newbie
Joined: 26.Jun.2013 Location: India Using: Autocad 2013, Revit 2013 Status: Offline Points: 3 |
Posted: 26.Jun.2013 at 14:44 |
|
I have used this lisp many times for labeling the x - y co-ordinates
; Limitation ; ---------- ; Will use current leader style and current units setting (defun c:lb (/ p x y ptcoord textloc) (while (setq p (getpoint "\nPick Point: ")) (setq textloc (getpoint "\nPick Label Location: ")) (setq x (rtos (car p))) (setq y (rtos (cadr p))) (setq ptcoord (strcat x ", " y)) (command "_LEADER" p textloc "" ptcoord "") ) ) |
|
|
Cad Services
|
|
![]() |
|
thinker
Groupie
Joined: 08.Jun.2013 Location: United Arab Emirates Using: AutoCAD2024 Status: Offline Points: 38 |
Posted: 04.Jul.2013 at 11:12 |
|
@sahaj, this lisp does not pick next vertex automatically.
|
|
![]() |
|
John Connor
Senior Member
Joined: 01.Feb.2011 Location: United States Using: AutoCAD 2018 Status: Offline Points: 7175 |
Posted: 04.Jul.2013 at 12:51 |
|
The Stones: "You can't always get what you want."
|
|
|
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."
<<AutoCAD 2015>> |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
This page was generated in 0,242 seconds.
![CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]](/common/arkance_186.png)


Lisp To Label The Polyline Coordinates
Topic Options


