Author Topic: [XDrX-PlugIn(1)]small pieces to remove  (Read 1476 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 527
[XDrX-PlugIn(1)]small pieces to remove
« on: November 22, 2023, 08:34:01 PM »
https://www.theswamp.org/index.php?topic=57930.15



Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt ()
  2.   (defun _process-shortline (ss)
  3.     (mapcar '(lambda (x)
  4.                (if (< (xdrx-getpropertyvalue x "length") len)
  5.                  (xdrx-entity-delete x)
  6.                )
  7.              )
  8.             (xdrx-pickset->ents ss)
  9.     )
  10.   )
  11.   (if (and (setq len (getreal "\nEnter shortest distance <exit>:"))
  12.            (setq ss (xdrx-ssget
  13.                       "\nSelect the curve to be processed <Exit>:"
  14.                       '((0 . "*line,arc,ellipse"))
  15.                     )
  16.            )
  17.       )
  18.     (progn
  19.       (xdrx-begin)
  20.       (setq ents (xdrx-pickset->ents ss))
  21.       (while (cdr ents)
  22.         (setq e1 (car ents))
  23.         (mapcar
  24.           '(lambda (x)
  25.              (if (and (setq ints (xdrx-entity-intersectwith e1 x))
  26.                       (setq ss1 (xdrx-curve-getsplitcurves e1 ints))
  27.                  )
  28.                (_process-shortline ss1)
  29.              )
  30.            )
  31.           (cdr ents)
  32.         ) ;_ end of mapcar
  33.         (setq ents (cdr ents))
  34.       ) ;_ end of while
  35.       (xdrx-end)
  36.     )
  37.   ) ;_ end of if
  38.   (princ)
  39. )
« Last Edit: November 23, 2023, 12:43:37 AM by xdcad »
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net

domenicomaria

  • Swamp Rat
  • Posts: 743
Re: [XDrX-PlugIn(1)]small pieces to remove
« Reply #1 on: November 23, 2023, 04:59:32 AM »
yes, it's fine...
... but there is a side effect which is not good...

because the curves are interrupted at all intersection points... even where it's not needed...

xdrx-curve-getsplitcurves is certainly a very useful function in many situations,
but the algorithm must interrupt the curves
only when the small piece that sticks out is less than a certain distance...

... and that's it

xdcad

  • Swamp Rat
  • Posts: 527
Re: [XDrX-PlugIn(1)]small pieces to remove
« Reply #2 on: November 23, 2023, 10:15:14 AM »
yes, it's fine...
... but there is a side effect which is not good...

because the curves are interrupted at all intersection points... even where it's not needed...

xdrx-curve-getsplitcurves is certainly a very useful function in many situations,
but the algorithm must interrupt the curves
only when the small piece that sticks out is less than a certain distance...

... and that's it

If it is disconnected, you can use xdrx-curve-join to merge it again.
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net

domenicomaria

  • Swamp Rat
  • Posts: 743
Re: [XDrX-PlugIn(1)]small pieces to remove
« Reply #3 on: November 23, 2023, 12:15:10 PM »
Quote
If it is disconnected, you can use xdrx-curve-join to merge it again.
But this will add in every intersection a new vertex to the curves.
« Last Edit: November 23, 2023, 12:35:16 PM by domenicomaria »

ribarm

  • Gator
  • Posts: 3328
  • Marko Ribar, architect
Re: [XDrX-PlugIn(1)]small pieces to remove
« Reply #4 on: November 23, 2023, 01:55:14 PM »
Quote
If it is disconnected, you can use xdrx-curve-join to merge it again.
But this will add in every intersection a new vertex to the curves.

Cinsider this answer : https://www.theswamp.org/index.php?topic=57930.msg617266#msg617266
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

xdcad

  • Swamp Rat
  • Posts: 527
Re: [XDrX-PlugIn(1)]small pieces to remove
« Reply #5 on: November 23, 2023, 02:39:06 PM »
Quote
If it is disconnected, you can use xdrx-curve-join to merge it again.
But this will add in every intersection a new vertex to the curves.

In cycle

Code - Auto/Visual Lisp: [Select]
  1. (setq ss (xdrx-curve-getsplitcurves e1 pts))

Interrupt at the point list. After the interruption, judge the short deletion.
Then add the selection set of the curves generated after the interruption,

After removing very short lines, all the selections that can be JOIN are JOIN together.
Code - Auto/Visual Lisp: [Select]
  1. (xdrx-curve-join ss)
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net