Author Topic: ==={Challenge}===Find the ridge lines of sloped roof  (Read 20297 times)

0 Members and 1 Guest are viewing this topic.

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #135 on: August 07, 2014, 06:04:19 am »
Nice work Ribar  :-)
Thank you for keep the head .

Is there problem in my last post version ?

Check my codes and compare with your - sr.lsp

2droof3d.lsp is updated... Noticed that when points are near to each other and roof is large, routine must zoom to vertices sequences and then zoom previous to view before routine started to operate... It's strongly suggested that complete roof should be on visible screen so that (command "_.zoom" "_w" vert1 vert2) could operate correctly... Someone downloaded version where I forgot to include every vertices sequence - zooming was put inside if condition... I apologize for this it was late yesterday and my concentration was bad... Now fixed...

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

:)

M.R. on Youtube

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #136 on: August 10, 2014, 10:49:02 am »
2droof-final.lsp and sr.lsp have been changed... Now should work better and almost every time should output result weather it's good or bad... Only thing is that with complex roofs you should wait for a while... But I did what I could to make it fast enough...

Hope you'll like it...

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

:)

M.R. on Youtube

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #137 on: July 29, 2017, 04:15:17 am »
So it's been 3 years I haven't revised this interesting challenge... But I've found some time to revive good old memories... Basically I've written shortened versions, but it still has some issues - 3d solid - surfsculpting is relatively good, but I am though interested if someone can give boost in version with 3d lines... So here are my latest short attempts :

For SURFSCULPT into 3D SOLID ROOF :
Code - Auto/Visual Lisp: [Select]
  1. (defun c:roof-mr ( / *error* unit v^v clockwise-lw gravityceter3d adoc s slope lw a vl tl ucsf regs tll ls lsl ip ipl 3df c p1 p2 p3 p4 scf ss )
  2.  
  3.  
  4.  (defun *error* ( m )
  5.    (if ucsf
  6.      (vl-cmdf "_.UCS" "_P")
  7.    )
  8.    (if adoc
  9.      (vla-endundomark adoc)
  10.    )
  11.    (if m
  12.      (prompt m)
  13.    )
  14.    (princ)
  15.  )
  16.  
  17.  (defun unit ( v )
  18.    (if (not (equal v '(0.0 0.0 0.0) 1e-8))
  19.      (mapcar (function (lambda ( x ) (/ x (distance '(0.0 0.0 0.0) v)))) v)
  20.    )
  21.  )
  22.  
  23.  (defun v^v ( u v )
  24.    (list
  25.      (- (* (cadr u) (caddr v)) (* (caddr u) (cadr v)))
  26.      (- (* (caddr u) (car v)) (* (car u) (caddr v)))
  27.      (- (* (car u) (cadr v)) (* (cadr u) (car v)))
  28.    )
  29.  )
  30.  
  31.  (defun clockwise-lw ( lw / minpt maxpt p1 p2 p3 p4 pmax )
  32.    (vla-getboundingbox (vlax-ename->vla-object lw) 'minpt 'maxpt)
  33.    (mapcar (function set) '(minpt maxpt) (mapcar (function safearray-value) (list minpt maxpt)))
  34.    (setq p1 minpt p2 (list (car maxpt) (cadr minpt)) p3 maxpt p4 (list (car minpt) (cadr maxpt)))
  35.    (setq pmax (max p1 p2 p3 p4))
  36.    (cond
  37.      ( (and (= pmax p1) (> p2 p4))
  38.        t
  39.      )
  40.      ( (and (= pmax p2) (> p3 p1))
  41.        t
  42.      )
  43.      ( (and (= pmax p3) (> p4 p2))
  44.        t
  45.      )
  46.      ( (and (= pmax p4) (> p1 p3))
  47.        t
  48.      )
  49.      ( t nil )
  50.    )
  51.  )
  52.  
  53.  (defun gravitycenter3d ( p1 p2 p3 / mid p12 p23 p31 c )
  54.  
  55.    (defun mid ( p1 p2 )
  56.      (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) p1 p2)
  57.    )
  58.  
  59.    (setq p12 (mid p1 p2))
  60.    (setq p23 (mid p2 p3))
  61.    (setq p31 (mid p3 p1))
  62.    (setq c (inters p12 p3 p1 p23))
  63.  
  64.    c
  65.  
  66.  )
  67.  
  68.  (prompt "\nPick closed LWPOLYLINE POLYGON...")
  69.  (setq s (ssget "_+.:E:S" '((0 . "LWPOLYLINE") (-4 . "<or") (70 . 1) (70 . 129) (-4 . "or>") (-4 . "<not") (-4 . "<>") (42 . 0.0) (-4 . "not>"))))
  70.  (while (not s)
  71.    (prompt "\nMissed or picked wrong entity type...")
  72.    (setq s (ssget "_+.:E:S" '((0 . "LWPOLYLINE") (-4 . "<or") (70 . 1) (70 . 129) (-4 . "or>") (-4 . "<not") (-4 . "<>") (42 . 0.0) (-4 . "not>"))))
  73.  )
  74.  (initget 7)
  75.  (setq slope (getreal "\nSpecify slope angle in decimal degrees : "))
  76.  (setq lw (ssname s 0))
  77.  (setq vl (mapcar (function (lambda ( x ) (trans (list (car x) (cadr x) (cdr (assoc 38 (entget lw)))) lw 0))) (mapcar (function cdr) (vl-remove-if (function (lambda ( x ) (/= (car x) 10))) (entget lw)))))
  78.  (setq tl (mapcar (function (lambda ( a b ) (list a b))) vl (cdr (reverse (cons (car vl) (reverse vl))))))
  79.  (if (clockwise-lw lw)
  80.    (progn
  81.      (setq vl (reverse vl))
  82.      (setq tl (mapcar (function (lambda ( a b ) (list a b))) vl (cdr (reverse (cons (car vl) (reverse vl))))))
  83.    )
  84.  )
  85.  (vla-copy (vlax-ename->vla-object lw))
  86.  (vl-cmdf "_.REGION" (entlast))
  87.  (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
  88.  (setq regs (cons (entlast) regs))
  89.  (vl-cmdf "_.PEDIT" lw "_W" 0.1)
  90.  (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
  91.  (vl-cmdf "_.CONVTOSURFACE" lw "")
  92.  (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
  93.  (setq regs (cons (entlast) regs))
  94.  (if (= (getvar 'worlducs) 0)
  95.    (progn
  96.      (vl-cmdf "_.UCS" "_W")
  97.      (setq ucsf t)
  98.    )
  99.  )
  100.  (foreach tt tl
  101.    (vl-cmdf "_.UCS" "_3P" "_non" (car tt) "_non" (cadr tt) "")
  102.    (vl-cmdf "_.UCS" "_X" slope)
  103.    (setq tll (cons (list tt (trans '(0.0 0.0 1.0) 1 0 t)) tll))
  104.    (vl-cmdf "_.UCS" "_P")
  105.    (vl-cmdf "_.UCS" "_P")
  106.  )
  107.  (foreach ttt tll
  108.    (foreach tttt (vl-remove ttt tll)
  109.      (if (equal (- (caddr (trans (caar tttt) 0 (cadr tttt))) (caddr (trans (caar ttt) 0 (cadr tttt)))) 0.0 1e-6)
  110.        (setq ls (list (caar ttt) (unit (v^v (cadr ttt) (cadr tttt)))) lsl (cons ls lsl))
  111.      )
  112.    )
  113.  )
  114.  (foreach ls lsl
  115.    (foreach lss (vl-remove ls lsl)
  116.      (if (setq ip (inters (car ls) (mapcar (function +) (car ls) (cadr ls)) (car lss) (mapcar (function +) (car lss) (cadr lss)) nil))
  117.        (if (not (vl-member-if (function (lambda ( x ) (equal ip x 1e-6))) ipl))
  118.          (progn
  119.            (setq ipl (cons ip ipl))
  120.            (setq 3df (entmakex (list '(0 . "3DFACE") (cons 10 ip) (cons 11 (car ls)) (cons 12 (car lss)) (cons 13 ip))))
  121.            (setq p1 ip)
  122.            (setq p2 (car ls))
  123.            (setq p3 (car lss))
  124.            (setq p4 ip)
  125.            (cond
  126.              ( (equal p1 p2 1e-8)
  127.                (setq p1 p2 p2 p3 p3 p4)
  128.              )
  129.              ( (equal p2 p3 1e-8)
  130.                (setq p1 p1 p2 p2 p3 p4)
  131.              )
  132.              ( (equal p3 p4 1e-8)
  133.                (setq p1 p1 p2 p2 p3 p3)
  134.              )
  135.              ( (equal p4 p1 1e-8)
  136.                (setq p1 p1 p2 p2 p3 p3)
  137.              )
  138.            )
  139.            (setq c (gravitycenter3d p1 p2 p3))
  140.            (vl-cmdf "_.SCALE" 3df "" "_non" c 1.01)
  141.            (vl-cmdf "_.REGION" 3df)
  142.            (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
  143.            (setq scf (/ a (vla-get-area (vlax-ename->vla-object (entlast)))))
  144.            (if (< scf 1.0)
  145.              (setq scf 2.0)
  146.            )
  147.            (vl-cmdf "_.SCALE" (entlast) "" "_non" ip scf)
  148.            (setq regs (cons (entlast) regs))
  149.          )
  150.        )
  151.      )
  152.    )
  153.  )
  154.  (setq ss (ssadd))
  155.  (foreach reg regs
  156.    (ssadd reg ss)
  157.  )
  158.  (vl-cmdf "_.SURFSCULPT" ss "")
  159.  (*error* nil)
  160. )
  161.  

And for 3D LINEs - I want to share this as it isn't so reliable and maybe, and I said just maybe someone who wants to play with it could improve it further more - I tried several times, but unsuccessful... The problem is that when you manually solve roofs you start from all around pline vertices and solve till first touch is detected and then you continue also from all around all until last segment is connected in roof apex point... Computer can't imitate this human action and it starts from one side and continue all up to the end last side - and if result is good then it's pure luck...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:roof-mr ( / *error* unique unit v^v clockwise-lw adoc s slope lw vl tl tll ls lls lss lsl lslx lsll ip ipl lil tst ipx k kk n ucsf )
  2.  
  3.  
  4.  (defun *error* ( m )
  5.    (if ucsf
  6.      (vl-cmdf "_.UCS" "_P")
  7.    )
  8.    (if adoc
  9.      (vla-endundomark adoc)
  10.    )
  11.    (if m
  12.      (prompt m)
  13.    )
  14.    (princ)
  15.  )
  16.  
  17.  (defun unique ( l )
  18.    (if l
  19.      (cons (car l) (unique (vl-remove-if (function (lambda ( x ) (equal (car l) x 1e-6))) l)))
  20.    )
  21.  )
  22.  
  23.  (defun unit ( v )
  24.    (if (not (equal v '(0.0 0.0 0.0) 1e-8))
  25.      (mapcar (function (lambda ( x ) (/ x (distance '(0.0 0.0 0.0) v)))) v)
  26.    )
  27.  )
  28.  
  29.  (defun v^v ( u v )
  30.    (list
  31.      (- (* (cadr u) (caddr v)) (* (caddr u) (cadr v)))
  32.      (- (* (caddr u) (car v)) (* (car u) (caddr v)))
  33.      (- (* (car u) (cadr v)) (* (cadr u) (car v)))
  34.    )
  35.  )
  36.  
  37.  (defun clockwise-lw ( lw / minpt maxpt p1 p2 p3 p4 pmax )
  38.    (vla-getboundingbox (vlax-ename->vla-object lw) 'minpt 'maxpt)
  39.    (mapcar (function set) '(minpt maxpt) (mapcar (function safearray-value) (list minpt maxpt)))
  40.    (setq p1 minpt p2 (list (car maxpt) (cadr minpt)) p3 maxpt p4 (list (car minpt) (cadr maxpt)))
  41.    (setq pmax (max p1 p2 p3 p4))
  42.    (cond
  43.      ( (and (= pmax p1) (> p2 p4))
  44.        t
  45.      )
  46.      ( (and (= pmax p2) (> p3 p1))
  47.        t
  48.      )
  49.      ( (and (= pmax p3) (> p4 p2))
  50.        t
  51.      )
  52.      ( (and (= pmax p4) (> p1 p3))
  53.        t
  54.      )
  55.      ( t nil )
  56.    )
  57.  )
  58.  
  59.  (prompt "\nPick closed LWPOLYLINE POLYGON...")
  60.  (setq s (ssget "_+.:E:S" '((0 . "LWPOLYLINE") (-4 . "<or") (70 . 1) (70 . 129) (-4 . "or>") (-4 . "<not") (-4 . "<>") (42 . 0.0) (-4 . "not>"))))
  61.  (while (not s)
  62.    (prompt "\nMissed or picked wrong entity type...")
  63.    (setq s (ssget "_+.:E:S" '((0 . "LWPOLYLINE") (-4 . "<or") (70 . 1) (70 . 129) (-4 . "or>") (-4 . "<not") (-4 . "<>") (42 . 0.0) (-4 . "not>"))))
  64.  )
  65.  (initget 7)
  66.  (setq slope (getreal "\nSpecify slope angle in decimal degrees : "))
  67.  (setq lw (ssname s 0))
  68.  (setq vl (mapcar (function (lambda ( x ) (trans (list (car x) (cadr x) (cdr (assoc 38 (entget lw)))) lw 0))) (mapcar (function cdr) (vl-remove-if (function (lambda ( x ) (/= (car x) 10))) (entget lw)))))
  69.  (setq tl (mapcar (function (lambda ( a b ) (list a b))) vl (cdr (reverse (cons (car vl) (reverse vl))))))
  70.  (if (clockwise-lw lw)
  71.    (progn
  72.      (setq vl (reverse vl))
  73.      (setq tl (mapcar (function (lambda ( a b ) (list a b))) vl (cdr (reverse (cons (car vl) (reverse vl))))))
  74.    )
  75.  )
  76.  (if (= (getvar 'worlducs) 0)
  77.    (progn
  78.      (vl-cmdf "_.UCS" "_W")
  79.      (setq ucsf t)
  80.    )
  81.  )
  82.  (foreach tt tl
  83.    (vl-cmdf "_.UCS" "_3P" "_non" (car tt) "_non" (cadr tt) "")
  84.    (vl-cmdf "_.UCS" "_X" slope)
  85.    (setq tll (cons (list tt (trans '(0.0 0.0 1.0) 1 0 t)) tll))
  86.    (vl-cmdf "_.UCS" "_P")
  87.    (vl-cmdf "_.UCS" "_P")
  88.  )
  89.  (foreach ttt tll
  90.    (foreach tttt (vl-remove ttt tll)
  91.      (if (equal (- (caddr (trans (caar tttt) 0 (cadr tttt))) (caddr (trans (caar ttt) 0 (cadr tttt)))) 0.0 1e-6)
  92.        (setq ls (list (caar ttt) (unit (v^v (cadr ttt) (cadr tttt)))) lsl (cons ls lsl))
  93.      )
  94.    )
  95.  )
  96.  (foreach ls lsl
  97.    (foreach lss (vl-remove ls lsl)
  98.      (if (setq ip (inters (car ls) (mapcar (function +) (car ls) (cadr ls)) (car lss) (mapcar (function +) (car lss) (cadr lss)) nil))
  99.        (setq ipl (cons ip ipl))
  100.      )
  101.    )
  102.  )
  103.  (while (and lsl (not (equal lsl lsll 1e-6)))
  104.    (setq lsll lsl k -1)
  105.    (while (and (setq k (1+ k)) (< k (length lsl)))
  106.      (setq ls (nth k lsl) kk -1)
  107.      (while (and (setq kk (1+ kk)) (< kk (1- (length lsl))))
  108.        (setq lss (nth kk (vl-remove ls lsl)))
  109.        (if (setq ip (inters (car ls) (mapcar (function +) (car ls) (cadr ls)) (car lss) (mapcar (function +) (car lss) (cadr lss)) nil))
  110.          (if (and (> (caddr ip) 0.0) (not (vl-some (function (lambda ( x ) (or (equal (distance (car ls) ip) (+ (distance (car ls) x) (distance x ip)) 1e-6) (equal (distance (car lss) ip) (+ (distance (car lss) x) (distance x ip)) 1e-6)))) (vl-remove-if (function (lambda ( x ) (or (equal x ip 1e-6) (equal x (car ls) 1e-6) (equal x (car lss) 1e-6)))) ipl))))
  111.            (progn
  112.              (setq tst nil)
  113.              (foreach lsx lsl
  114.                (foreach lssx (vl-remove lsx lsl)
  115.                  (if (setq ipx (inters (car lsx) (mapcar (function +) (car lsx) (cadr lsx)) (car lssx) (mapcar (function +) (car lssx) (cadr lssx)) nil))
  116.                    (if (and (> (caddr ipx) 0.0) (not (equal ipx ip 1e-6)) (or (equal (distance (car lsx) ip) (+ (distance (car lsx) ipx) (distance ipx ip)) 1e-6) (equal (distance (car lssx) ip) (+ (distance (car lssx) ipx) (distance ipx ip)) 1e-6)))
  117.                      (setq tst t)
  118.                    )
  119.                  )
  120.                )
  121.              )
  122.              (if (null tst)
  123.                (progn
  124.                  (if (and (not (equal (car ls) ip 1e-6)) (not (or (vl-member-if (function (lambda ( x ) (equal x (list (car ls) ip) 1e-6))) lil) (vl-member-if (function (lambda ( x ) (equal x (list ip (car ls)) 1e-6))) lil))))
  125.                    (progn
  126.                      (setq lil (cons (list (car ls) ip) lil))
  127.                      (entmake (list '(0 . "LINE") (cons 10 (car ls)) (cons 11 ip)))
  128.                    )
  129.                  )
  130.                  (if (and (not (equal (car lss) ip 1e-6)) (not (or (vl-member-if (function (lambda ( x ) (equal x (list (car lss) ip) 1e-6))) lil) (vl-member-if (function (lambda ( x ) (equal x (list ip (car lss)) 1e-6))) lil))))
  131.                    (progn
  132.                      (setq lil (cons (list (car lss) ip) lil))
  133.                      (entmake (list '(0 . "LINE") (cons 10 (car lss)) (cons 11 ip)))
  134.                    )
  135.                  )
  136.                  (setq lsl (vl-remove ls lsl) lsl (vl-remove lss lsl))
  137.                  (setq lslx nil)
  138.                  (if (setq n (unit (v^v (mapcar (function -) ip (car ls)) (mapcar (function -) ip (car lss)))))
  139.                    (setq tll (vl-remove-if (function (lambda ( x ) (or (equal n (cadr x) 1e-6) (equal (mapcar (function -) n) (cadr x) 1e-6)))) tll))
  140.                  )
  141.                  (foreach ttt tll
  142.                    (foreach tttt (vl-remove ttt tll)
  143.                      (if
  144.                        (and
  145.                          (equal (- (caddr (trans ip 0 (cadr ttt))) (caddr (trans (caar ttt) 0 (cadr ttt)))) 0.0 1e-6)
  146.                          (equal (- (caddr (trans ip 0 (cadr tttt))) (caddr (trans (caar tttt) 0 (cadr tttt)))) 0.0 1e-6)
  147.                        )
  148.                        (setq lls (list ip (unit (v^v (cadr ttt) (cadr tttt)))) lslx (cons lls lslx))
  149.                      )
  150.                    )
  151.                  )
  152.                  ;|
  153.                   (foreach ttt tll
  154.                     (foreach tttt (vl-remove ttt tll)
  155.                       (cond
  156.                         ( (equal (- (caddr (trans ip 0 (cadr ttt))) (caddr (trans (caar ttt) 0 (cadr ttt)))) 0.0 1e-6)
  157.                           (if (equal (- (caddr (trans ip 0 (cadr tttt))) (caddr (trans (caar tttt) 0 (cadr tttt)))) 0.0 1e-6)
  158.                             (setq lls (list ip (unit (v^v (cadr ttt) (cadr tttt)))) lslx (cons lls lslx))
  159.                             (setq lls (list ip (unit (v^v (cadr ttt) n))) lslx (cons lls lslx))
  160.                           )
  161.                         )
  162.                         ( (equal (- (caddr (trans ip 0 (cadr tttt))) (caddr (trans (caar tttt) 0 (cadr tttt)))) 0.0 1e-6)
  163.                           (if (equal (- (caddr (trans ip 0 (cadr ttt))) (caddr (trans (caar ttt) 0 (cadr ttt)))) 0.0 1e-6)
  164.                             (setq lls (list ip (unit (v^v (cadr tttt) (cadr ttt)))) lslx (cons lls lslx))
  165.                             (setq lls (list ip (unit (v^v (cadr tttt) n))) lslx (cons lls lslx))
  166.                           )
  167.                         )
  168.                       )
  169.                     )
  170.                   )
  171.                   |;
  172.                  (setq lslx (unique lslx))
  173.                  (setq lsl (append lslx lsl))
  174.                )
  175.              )
  176.            )
  177.          )
  178.          (if (or (equal (unit (mapcar (function -) (car lss) (car ls))) (cadr ls) 1e-6) (equal (unit (mapcar (function -) (car lss) (car ls))) (mapcar (function -) (cadr ls)) 1e-6))
  179.            (progn
  180.              (if (and (not (equal (car ls) (car lss) 1e-6)) (not (or (vl-member-if (function (lambda ( x ) (equal x (list (car ls) (car lss)) 1e-6))) lil) (vl-member-if (function (lambda ( x ) (equal x (list (car lss) (car ls)) 1e-6))) lil))))
  181.                (progn
  182.                  (setq lil (cons (list (car ls) (car lss)) lil))
  183.                  (entmake (list '(0 . "LINE") (cons 10 (car ls)) (cons 11 (car lss))))
  184.                )
  185.              )
  186.              (setq lsl (vl-remove ls lsl) lsl (vl-remove lss lsl))
  187.            )
  188.          )
  189.        )
  190.      )
  191.    )
  192.  )
  193.  (*error* nil)
  194. )
  195.  

Regards, M.R.
 :-)
« Last Edit: August 06, 2017, 11:15:29 am by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #138 on: July 30, 2017, 08:19:31 am »
Just a little bit improved and little bigger code - this is just for 3D LINEs version as I am interested in that just...

Code: [Select]
Code removed due to the fact that I solved this issue and it's relatively faster then it was and I am satisfied with that now...
« Last Edit: September 04, 2017, 11:48:48 am by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #139 on: August 01, 2017, 04:48:59 pm »
Here is 3dlines version that should do correctly... It's ab 20K and is core routine on which you can build 3dsolid version for which you'll need some additional subs and like I did use (break_with sub from CAB and overkill command - now not sure ab that) and region command and finally SURFSCULPT...

Code: [Select]
Code removed due to the lack of interest... You can PM on ribarm@gmail.com if you are interested...
M.R.
« Last Edit: August 29, 2017, 12:45:08 pm by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #140 on: August 03, 2017, 03:57:26 pm »
There is this game (look into gif)... But it's only for convex polygons, the problem are concave ones... When solution is found correctly with 3D LINES, it's relatively easy to make 3D SOLID from it... For future note, developing general routine that works for both cases with lines in 3D SPACE is IMO the best choice... I tried to add some codes that lead following that path and I wish you success in your study and coding...

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

:)

M.R. on Youtube

HasanCAD

  • Swamp Rat
  • Posts: 1198
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #141 on: August 06, 2017, 04:17:36 am »
WOW

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #142 on: August 08, 2017, 08:40:39 am »
WOW

I've written just another lisp (25KB (3dlines) core + 10KB - 3dsolid version - 39 KB total with islands) for convex+concave polygon 3dsolid roofs... And it uses modelling operations with final SURFSCULPT... I'll post gif showing it in action and DWG with ultimate test for those developers that have some alternative which ch_lhjd's sr.lsp can't handle, and also EXTRUDE Taper => SOLIDEDIT (EXTRUDE or MOVE) top face upwards built in CAD can't handle correctly, but for mine version solved it for ab 875 sec, but still it didn't managed to solve complete roof solution, so I'll post also what it did solve (3dlines)...

Regards, M.R.
« Last Edit: September 05, 2017, 06:10:04 am by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #143 on: August 08, 2017, 11:32:19 am »
I forgot to show that it also works with porches...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #144 on: August 12, 2017, 03:21:34 pm »
I've speed up my routine (version) and I've made the one that works with islands... Just to see that it's very possible, I'll attach gif...

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

:)

M.R. on Youtube

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #145 on: August 14, 2017, 01:40:31 pm »
Another demonstration on my slow PC (using A2014 on Win7)... BTW. A2017 have some sort of bug and can't do it directly - you must save DWG and reopen after cubes are made... IMO it's reasonably fast for this task...

Regards...
« Last Edit: August 16, 2017, 08:43:07 am by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #146 on: August 16, 2017, 08:53:53 am »
I've updated my last posted animated gif... Added lower 3DSOLIDs parts around cubes-objects... I think that it's now prettier and theswamp managed to upload gif in 640x512 resolution so now it little bigger (better)...

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

:)

M.R. on Youtube

ribarm

  • Water Moccasin
  • Posts: 1687
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #147 on: September 05, 2017, 06:19:13 am »
I've changed animated gif from here :
https://www.theswamp.org/index.php?topic=41837.msg580469#msg580469

And attached DWGs with ultimate test on that same post... Also I've removed codes as they were not complete, just working examples...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube