Author Topic: small pieces to remove  (Read 7021 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8584
  • AKA Daniel
Re: small pieces to remove
« Reply #15 on: November 16, 2022, 03:35:27 AM »
Basically, splits the curve into segments, at each of the points in the argument
https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-RefGuide-AcDbCurve__getSplitCurves_AcGePoint3dArray__AcDbVoidPtrArray__const

I donít think itís available to lisp though. I think Bigalís suggestion might be a better alternative, just move the end, instead of splitting it and deleting the short ends


DEVITG

  • Bull Frog
  • Posts: 479
Re: small pieces to remove
« Reply #16 on: November 16, 2022, 08:01:01 PM »
@domenicomaria Just do a google , and get it

Quote
https://www.google.com/search?q=getSplitCurves&sourceid=chrome&ie=UTF-8

Could you, please upload your sample dwg?
Location @ Cůrdoba Argentina Using ACAD 2019  at Window 10

domenicomaria

  • Swamp Rat
  • Posts: 720
Re: small pieces to remove
« Reply #17 on: November 17, 2022, 12:16:11 AM »
@ Daniel & DEVITG

Thank you

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8584
  • AKA Daniel
Re: small pieces to remove
« Reply #18 on: November 17, 2022, 01:23:26 AM »
mine fails in some cases

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8584
  • AKA Daniel
Re: small pieces to remove
« Reply #19 on: November 17, 2022, 02:57:37 AM »
fixed it, getsplitcurves wants the points sorted  :mrgreen:
added
Code - C: [Select]
  1.             std::sort(item.second.begin(), item.second.end(), [&](const auto& a, const auto& b) -> bool
  2.             {
  3.                 double da, db;
  4.                 pLine->getDistAtPoint(a, da);
  5.                 pLine->getDistAtPoint(b, db);
  6.                 return da < db;
  7.             });
  8.  

i attached the source and a binary for autocad 2021-2023.
the command is CHOPPER  :lol:

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8584
  • AKA Daniel
Re: small pieces to remove
« Reply #20 on: November 17, 2022, 03:01:13 AM »
BTW, the sort is a lambda expression in c++, just in case I can convert you to the darkside  :devilsidesmile:

domenicomaria

  • Swamp Rat
  • Posts: 720
Re: small pieces to remove
« Reply #21 on: November 17, 2022, 03:37:24 AM »
Daniel, you are great !

I want try to translate it into vlisp

xdcad

  • Bull Frog
  • Posts: 424
Re: small pieces to remove
« Reply #22 on: November 22, 2023, 05:29:08 PM »
@Daniel

Daniel, forgive my ignorance.
I'm trying to figure out what you did.
I know the C language very little.
And I would like to know what getSplitCurves does


Can you explain it to me?

Now you can try xdrx_curve_getSplitCurves
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
[XDrx-Sub Forum]
https://www.theswamp.org/index.php?board=78.0
https://github.com/xdcad/XDrx-API
http://bbs.xdcad.net

xdcad

  • Bull Frog
  • Posts: 424
Re: small pieces to remove
« Reply #23 on: November 22, 2023, 06:04:56 PM »
Daniel, you are great !

I want try to translate it into vlisp

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. )
  40.  
« Last Edit: November 22, 2023, 06:11:15 PM by xdcad »
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
[XDrx-Sub Forum]
https://www.theswamp.org/index.php?board=78.0
https://github.com/xdcad/XDrx-API
http://bbs.xdcad.net

domenicomaria

  • Swamp Rat
  • Posts: 720
Re: small pieces to remove
« Reply #24 on: November 23, 2023, 12:34:54 AM »
@xdcad
... great !

domenicomaria

  • Swamp Rat
  • Posts: 720
Re: small pieces to remove
« Reply #25 on: November 23, 2023, 05:01:22 AM »

ribarm

  • Gator
  • Posts: 3185
  • Marko Ribar, architect
Re: small pieces to remove
« Reply #26 on: November 23, 2023, 05:22:59 AM »
I think there should be no lacks with ARCs when using CAB's BreakObjects.lsp that I modified and added (c:BreakAll-nogaps)... After breaking it's only needed to remove small pieces with length tolerance... I'll attach my version of BreakObjects.lsp if you or someone else is interested...
« Last Edit: November 27, 2023, 01:13:04 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

BIGAL

  • Swamp Rat
  • Posts: 1386
  • 40 + years of using Autocad
Re: small pieces to remove
« Reply #27 on: November 23, 2023, 05:54:45 PM »
Like Ribarm used Cab's breakall, I used recently for a task, then just do a ssget and look at length of objects if short then delete.
A man who never made a mistake never made anything

ribarm

  • Gator
  • Posts: 3185
  • Marko Ribar, architect
Re: small pieces to remove
« Reply #28 on: November 24, 2023, 04:24:55 AM »
FYI,
I've changed posted *.lsp as I founded some lacks and I brefly remedy *.lsp...
You can find it here : https://www.theswamp.org/index.php?topic=57930.msg617266#msg617266

Regards,
HTH.
M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

domenicomaria

  • Swamp Rat
  • Posts: 720
Re: small pieces to remove
« Reply #29 on: November 24, 2023, 05:25:06 AM »
Like Ribarm used Cab's breakall, I used recently for a task, then just do a ssget and look at length of objects if short then delete.

but Cab's breakall will break all curves at all intersections!

So after that the curves are all broken !

And then if you join them again,
in each curve there will be some more vertices
where there were intersections...!

Or is what I'm saying incorrect?