(strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar "cprofile") "\\Dialogs\\Overkill")
returns the location of all saved options for the OVERKILL command.(vl-registry-read registry "OptimizePolylines")
and reset them like (vl-registry-write registry "OptimizePolylines" "1")
run the OVERKILL command using command-s then reset the previous settings.Domenico, hai provato questo: http://www.theswamp.org/index.php?topic=19865.msg244892#msg244892purge-pline is certainly a great routine. . .
If someone finds me a situation where it doesn't work,
(setq v-lst '((1192.63 291.385) (1208.37 301.527) (1224.28 311.405) (1240.35 321.018) (1256.58 330.362) (1272.96 339.434) (1289.49 348.233) (1306.16 356.756) (1322.97 365.0) (1339.92 372.964) (1357.0 380.644) (1374.2 388.039) (1391.52 395.148) (1408.96 401.967) (1426.51 408.495) (1444.17 414.73) (1461.93 420.67) (1479.78 426.315) (1497.73 431.661) (1515.76 436.709) (1533.87 441.456) (1552.06 445.9) (1570.32 450.042) (1588.65 453.879) (1607.04 457.411) (1625.49 460.637) (1643.98 463.555) (1662.53 466.165) (1681.11 468.467) (1699.73 470.459) (1718.38 472.141)))
(while (and (setq p2 (car v-lst)) (setq p3 (cadr v-lst)))
(setq ang23 (angle p2 p3))
(if (equal prev-ang ang23 ang-fuzz)
(setq r (cons p3 (cdr r)))
(setq r (cons p3 r)
prev-ang ang23 ;fix
)
)
(setq v-lst (cdr v-lst))
)
of many segments that differ by a very small anglehttps://imgur.com/a/elMb6Zt
... just adjust the ang-fuzz value ...
the problem with your code is that you compare angles between nonexistent (removed) points
Let me know, please.i see that your fix is different from my proposal in https://www.theswamp.org/index.php?topic=57443.msg609304#msg609304
(defun DouglasPeucker_elimPtos (PointList CorridorWidth / p1 p2 distan valmax nn 2lis)
(if (< (length PointList) 3)
PointList (progn
(setq p1 (car PointList)
p2 (last PointList)
distan (mapcar (function (lambda (pt) (PerDist p1 p2 pt))) (reverse (cdr (reverse (cdr PointList)))))
valmax (apply (function max) distan)
)
(if (> valmax CorridorWidth) (progn
(setq nn (vl-position valmax distan) ;hay uno menos, se suman 2
2lis (breaklistAt (+ 2 nn) PointList T))
(append (DouglasPeucker_elimPtos (car 2lis) CorridorWidth)
(cdr (DouglasPeucker_elimPtos (cadr 2lis) CorridorWidth)))
)
(list p1 p2))
))
)
(defun PerDist (pt1 pt2 pt3 / ang1 ang2)
; Compute perpendiculat distance
; c. 1992 author unknown, Mod KJM 1994
; perpendicular distance from pt3 to line segment pt1-pt2
(setq ang1 (angle pt1 pt2)
ang2 (angle pt1 pt3)
ang1 (if (> ang2 ang1)(+ ang1 2pi) ang1)
)
(abs (* (distance pt1 pt3) (sin (- ang1 ang2))))
)
(defun breaklistAt (n l repeat? / r)
(while (and l (< 0 n))
(setq r (cons (car l) r)
l (cdr l)
n (1- n)
)
)
(list (reverse r) (if repeat? (cons (car r) l) l))
)
Another approach using Douglas-Puecker algorithm, which reduces excess vertices based on a corridor width. Originally found on Compuserve message board as 'Polyweed.lsp' with no author listed.Hello Kirby,
Domenico, hai provato questo: http://www.theswamp.org/index.php?topic=19865.msg244892#msg244892
:-)Domenico, hai provato questo: http://www.theswamp.org/index.php?topic=19865.msg244892#msg244892
I tested the GILE code . . .
It is GREAT !
Thank you for the link, Marco
Ciao