Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working on a LISP to get and sort polyline start and end coordinates. This is what I have so far. Line 7 is giving me issues. How should I change this?
(defun C:PLINESELSET
(/ ssMessenger i vlaObject points alldata_plines)
(setq ssMessenger (ssget "x" '(0 . "LINE,*LWPOLYLINE")))
(repeat (setq i (sslength ssMessenger)) ; repeat for each line found
(setq vlaObject (vlax-ename->vla-object (ssname ssMessenger (setq i (1 - i)))))
(setq points (vlax-get-property vlaObject 'coordinates)) ; get coordinates
(setq alldata_plines
(cons
(list points)))
) ; repeat
(print alldata_plines)
) ; defun PLINESELSET
One I get the start and end coordinates of a single polyline, they should be sorted from west to east. Then, once there is a list of all the polyline coordinates in the drawing, they should be sorted from north to south. For example:
PLINE 1 from (0,0) to (1,0)
PLINE 2 from (1,1) to (-1,1)
First, sort each coordinate pair from west to east:
PLINE 1: (0,0) to (1,0)
PLINE 2: (-1,1) to (1,1)
Then, sort each coordinate pair from north to south(can just use y-coordinate of the first coordinate in the pair:
PLINE 2: (-1,1) to (1,1)
PLINE 1: (0,0) to (1,0)
Hopefully this question makes sense. Thanks.
Solved! Go to Solution.