Author Topic: Divide the closed area into the same area of the same width  (Read 1907 times)

0 Members and 1 Guest are viewing this topic.

ssdd

  • Newt
  • Posts: 35
Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt( /)
  2. (if (and (setq ss (ssget (list (cons 0 "LWPOLYLINE")(cons 8 "test"))))
  3.          (setq mfk 3000)
  4.          (setq lst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
  5.          )
  6.   (progn
  7.     (setq  pts(mapcar 'Get-PlineVer lst)
  8.            p1 (apply 'mapcar (cons 'min (apply 'append pts)))
  9.            p9 (apply 'mapcar (cons 'max (apply 'append pts)))
  10.            p3 (list (car p9)(cadr p1))
  11.            n  (fix (/ (- (cadr p9)(cadr p1)) mfk))
  12.            i 1
  13.            l1 nil
  14.     )
  15.     (repeat n
  16.       (setq b1 (list (car p1) (+ (cadr p1) (* i mfk)))
  17.             b3 (list (car p9) (+ (cadr p1) (* i mfk)))
  18.             l1 (cons (list b1 b3) l1))
  19.       (entmakex (list (cons 0 "LWPOLYLINE")
  20.                 (cons 100 "AcDbEntity")
  21.                 (cons 100 "AcDbPolyline")
  22.                 (cons 90 2 )
  23.                 (cons 10 b1)
  24.                 (cons 10 b3)
  25.                 (cons 8 "test")
  26.      ))(setq i (1+ i))
  27.       )
  28.    
  29.     ))

ribarm

  • Gator
  • Posts: 3259
  • Marko Ribar, architect
Re: Divide the closed area into the same area of the same width
« Reply #1 on: June 07, 2018, 09:08:50 AM »
It is possible, but my routine works correct only with convex or similar shaped lwpolylines... Sorry I can't post the code... :(
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ssdd

  • Newt
  • Posts: 35
Re: Divide the closed area into the same area of the same width
« Reply #2 on: June 09, 2018, 09:38:57 AM »
Thank ribarm!

ribarm

  • Gator
  • Posts: 3259
  • Marko Ribar, architect
Re: Divide the closed area into the same area of the same width
« Reply #3 on: June 09, 2018, 06:04:09 PM »
I improved my routine a little...
Regards, M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ssdd

  • Newt
  • Posts: 35
Re: Divide the closed area into the same area of the same width
« Reply #4 on: June 09, 2018, 09:17:18 PM »
Thank ribarm!Progress in learning.

dussla

  • Bull Frog
  • Posts: 291
Re: Divide the closed area into the same area of the same width
« Reply #5 on: June 10, 2018, 02:36:21 AM »
http://www.kimprojects.com/product/divide-area-autocad/

i bought them ~ that is good ~

I attach the information so that you may want this.

dussla

  • Bull Frog
  • Posts: 291
Re: Divide the closed area into the same area of the same width
« Reply #6 on: June 10, 2018, 03:45:25 AM »
It is possible, but my routine works correct only with convex or similar shaped lwpolylines... Sorry I can't post the code... :(

thank you for good info ~~
https://www.semanticscholar.org/paper/Testing-block-subdivision-algorithms-on-block-Wiseman-Patterson/3fe399077c6235235631e96408b15c77879be76e/figure/0


https://www.sciencedirect.com/science/article/pii/S1364815211001447



Is it difficult to make code like this possible?

ribarm

  • Gator
  • Posts: 3259
  • Marko Ribar, architect
Re: Divide the closed area into the same area of the same width
« Reply #7 on: June 10, 2018, 08:22:46 AM »
@dussla

I haven't done anything yet with AI (artificial intelligence) for CAD, but I think that your examples are too complex for PC... Some sort of manual drawing is necessary... All you could do is to try to divide area by some kind of grid - I used simple orthogonal scheme and still there may occur some errors... Still if I haven't already showed gif, I'll attach it here just for an info presentation...

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

:)

M.R. on Youtube