Message 1 of 14
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
¿Is it possible to have a .lsp that removes consecutive duplicate points of a opened or closed pline?
Solved! Go to Solution.
¿Is it possible to have a .lsp that removes consecutive duplicate points of a opened or closed pline?
Solved! Go to Solution.
One way:
EXPLODE the Polyline.
Use QSELECT or FILTER to select all Lines [and possibly Arcs?] of zero length, and ERASE them.
JOIN or PEDIT / Join what's left back into a Polyline.
I expect an AutoLisp routine could be written to do that, if that sounds like what you want. I also expect there's something like that already out there, available for the Searching.
I´m looking for a quick mode, so a lsp could be perfect. I delete this kind of duplicated points several times in one hour. Found this but doesn´t work properly for me
yes it works but ideally not quick enought
@kibitotato wrote:
.... Found this but doesn´t work properly for me ....
That is never enough information. What's not proper about it?
I am skeptical that a custom AutoLisp routine is going to be enough quicker than OVERKILL to justify the effort of writing one. What makes OVERKILL not quick enough?
I understand.
So, in order to be quicker, is it possible to have overkill without this window???
yes, use _-OVERKILL
Example:
(setq ss (ssget "_X" '((0 . "LWPOLYLINE"))))
(command "_-overkill" ss "" "_PL" "_y" "")
Or without the "_X" for manual selection:
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(command "_-overkill" ss "" "_PL" "_y" "")
I think that this works for all objects into the drawing. I want to work it witch only one...
Is it possible to associate it to a shortcut like WQ or something... ? Tried to edit it into .pgp but doesnt work...
yes like this. Save as .lsp
(defun c:wq (/ ss)
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(command "_-overkill" ss "" "_PL" "_y" "")
(princ)
)
it is surely possible. check the following.
;**********************************************************************************************************************************************************
(defun remove_duplicates (_list / duplicateless_list)
(while _list
(if (not (equal (car (setq list_element (car _list))) (caar (setq _list (cdr _list)))))
(setq duplicateless_list (append duplicateless_list (list list_element)))
)
)
)
;**********************************************************************************************************************************************************
(defun c:remove_duplicate_vertices (/ pline_sset deleted_number pline_dxf number_before)
(if (setq deleted_number 0 pline_sset (ssget ":l" '((0 . "lwpolyline"))))
(foreach pline (vl-remove-if 'listp (mapcar 'cadr (ssnamex pline_sset)))
(setq pline_dxf (entget pline)
number_before (fix (vlax-curve-getendparam pline))
vertices_bulge_list (remove_duplicates (mapcar 'cons (mapcar 'cdr (vl-remove-if-not '(lambda (group) (= 10 (car group))) pline_dxf))
(mapcar 'cdr (vl-remove-if-not '(lambda (group) (= 42 (car group))) pline_dxf))
)
)
)
(vla-put-coordinates (vlax-ename->vla-object pline)
(vlax-safearray-fill (vlax-make-safearray vlax-vbdouble (cons 1 (* 2 (length vertices_bulge_list))))
(apply 'append (mapcar 'car vertices_bulge_list))
)
)
(setq deleted_number (+ deleted_number (- number_before (fix (vlax-curve-getendparam pline)))))
(setq index 0)
(foreach vertex vertices_bulge_list
(vla-setbulge (vlax-ename->vla-object pline) index (cdr vertex))
(setq index (1+ index))
)
(princ (strcat "\rTotal deleted duplicate vertices: " (itoa deleted_number)))
)
)
(princ)
)
;**********************************************************************************************************************************************************