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

0 Members and 1 Guest are viewing this topic.

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
==={Challenge}===Find the ridge lines of sloped roof
« on: May 27, 2012, 09:53:28 PM »
Given a closed polyline, To find the ridge lines of sloped roof, suppose if  every side  has the same slope.

 
I am a bilingualist,Chinese and Chinglish.

Serge J. Gianolla

  • Guest

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #2 on: May 28, 2012, 06:42:50 AM »
I have a LISP solution which I believe yields the correct straight skeleton result for 90% of cases, but have not released it as freeware:



Some more examples:

« Last Edit: May 28, 2012, 02:01:57 PM by Lee Mac »

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #3 on: May 28, 2012, 07:00:48 AM »
I have a LISP solution which I believe yields the correct straight skeleton result for 90% of cases, but have not released it as freeware:
..
You are great! I wish it won't undercut your business! :lmao:
I am a bilingualist,Chinese and Chinglish.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #4 on: May 28, 2012, 07:41:47 AM »
Not to be a party pooper.  But I only about the 15% buildings I do have a consistant pitch thus having the ridge line at the same height. 

My architects like to have a roof have the following artistic charater and charming features:
  • change the pitch
  • have differnt heights for the ridge
  • have different heights for the eaves
  • have wierd things happen at the interesction of rakes and eaves.
  • all of the @#$%!  *&^%!  %^&$$#^ above.

:pissed:
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #5 on: May 28, 2012, 09:00:44 AM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #6 on: May 28, 2012, 09:15:14 AM »
Current project. Roof ridge is not correct but close.
It is a remodel so I don't need it to be correct.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #7 on: May 28, 2012, 09:39:10 AM »
Current project. Roof ridge is not correct but close.
It is a remodel so I don't need it to be correct.
:-o Holly Batman and I thought I had it bad!  We do a lot of wood framed apartment buildings so little more consistency before a change in a roof plane.  I forgot about McMansions.

Do you usually the document the plate height on the roof plan?  I kind a like that.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #8 on: May 28, 2012, 10:38:28 AM »
Plate height usually appear on the framing plan in the form of different hatches on the walls (plan view).
If it gets too complicated I provide a separate sheet just for plate heights.
The roof plan as you see above usual ends up as a 1/8 scale on the framing plan if there is room.
So at 1/8 scale it might be tough to see the text but I like that idea.  8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #9 on: May 31, 2012, 12:04:22 PM »
Here is mine version (nobody posted code :( ) and as I am not real programmer as Lee, it's quite risky to be used... With some complex plines it can make quite mess, but on the other hand maybe someone can use it as it makes construction of roof solution... I just don't know how to make it better and as Lee won't post his solution at least I tried...

Code - Auto/Visual Lisp: [Select]
  1. (defun pll (pl / K MSP PLA PLAO PLO PLOPTLST PLPTLST PTT PTTLST PTTLSTN DST VAR) (vl-load-com)
  2.   (setq pla (vlax-ename->vla-object pl))
  3.   (if (vl-catch-all-error-p (setq var (vl-catch-all-apply 'vla-offset (list pla -1e-3)))) (setq plao nil) (setq plao (car (vlax-safearray->list (vlax-variant-value var)))))
  4.   (if plao (setq plo (vlax-vla-object->ename plao)))
  5.   (if (> (cdr (assoc 90 (entget pl))) 2)
  6.     (progn
  7.       (mapcar '(lambda (x) (if (eq (car x) 10) (setq plptlst (cons (cdr x) plptlst)))) (entget pl))
  8.       (setq plptlst (reverse plptlst))
  9.     )
  10.   )
  11.   (if plo
  12.     (progn
  13.       (mapcar '(lambda (x) (if (eq (car x) 10) (setq ploptlst (cons (cdr x) ploptlst)))) (entget plo))
  14.       (setq ploptlst (reverse ploptlst))
  15.       (entdel plo)
  16.     )
  17.   )
  18.   (setq k -1)
  19.   (if ploptlst
  20.     (progn
  21.       (repeat (length plptlst)
  22.         (setq k (1+ k))
  23.         (if (eq k (- (length plptlst) 1))
  24.           (setq ptt (inters (nth k plptlst) (nth k ploptlst) (nth 0 plptlst) (nth 0 ploptlst) nil))
  25.           (setq ptt (inters (nth k plptlst) (nth k ploptlst) (nth (+ k 1) plptlst) (nth (+ k 1) ploptlst) nil))
  26.         )
  27.         (if (and ptt (eq k (- (length plptlst) 1))) (setq pttlst (cons (distance (nth 0 plptlst) ptt) pttlst)))
  28.         (if (and ptt (not (eq k (- (length plptlst) 1)))) (setq pttlst (cons (distance (nth k plptlst) ptt) pttlst)))
  29.         (if (and ptt (< k (- (length plptlst) 1))) (setq pttlst (cons (distance (nth (+ k 1) plptlst) ptt) pttlst)))
  30.       )
  31.       (setq pttlstn (vl-sort pttlst '(lambda (a b) (< a b))))
  32.       (setq dst (car pttlstn))
  33.       (setq k -1)
  34.       (repeat (length plptlst)
  35.         (setq k (1+ k))
  36.         (if (eq k (- (length plptlst) 1))
  37.           (setq ptt (inters (nth k plptlst) (nth k ploptlst) (nth 0 plptlst) (nth 0 ploptlst) nil))
  38.           (setq ptt (inters (nth k plptlst) (nth k ploptlst) (nth (+ k 1) plptlst) (nth (+ k 1) ploptlst) nil))
  39.         )
  40.         (if (and ptt (not (eq k (- (length plptlst) 1))) (or (eq (distance (nth k plptlst) ptt) dst) (eq (distance (nth (+ k 1) plptlst) ptt) dst)))
  41.           (progn
  42.             (setq p ptt)
  43.             (vla-addline msp (vlax-3d-point (nth k plptlst)) (vlax-3d-point ptt))
  44.             (vla-addline msp (vlax-3d-point (nth (+ k 1) plptlst)) (vlax-3d-point ptt))
  45.           )
  46.           (if (and ptt (eq k (- (length plptlst) 1)) (or (eq (distance (nth k plptlst) ptt) dst) (eq (distance (nth 0 plptlst) ptt) dst)))
  47.             (progn        
  48.               (setq p ptt)
  49.               (vla-addline msp (vlax-3d-point (nth k plptlst)) (vlax-3d-point ptt))
  50.               (vla-addline msp (vlax-3d-point (nth 0 plptlst)) (vlax-3d-point ptt))
  51.             )
  52.           )
  53.         )
  54.       )
  55.     )
  56.   )
  57. )
  58.  
  59. (defun kr (plin / pold plinn pldxf plinptlst)
  60.   (setq pold p)
  61.   (vl-cmdf "_.offset" "t" plin p "")
  62.   (setq plin (entlast))
  63.   (setq pldxf (entget plin))
  64.   (mapcar '(lambda (x) (if (eq (car x) 10) (setq plinptlst (cons (cdr x) plinptlst)))) pldxf)
  65.   (setq plinptlst (reverse plinptlst))
  66.   (setq plinptlst (acet-list-remove-duplicates plinptlst 1e-6))
  67.   (entdel plin)
  68.   (setq plinn (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline")
  69.                                       (cons 90 (length plinptlst))
  70.                                      '(70 . 1)
  71.                                 )
  72.                                 (mapcar '(lambda ( x ) (cons 10 x)) plinptlst)
  73.                                 (list '(210 0.0 0.0 1.0))
  74.                         )
  75.               )
  76.   )
  77.   (pll plinn)
  78.   (if (not (equal pold p 1e-8)) (kr plinn))
  79. )
  80.  
  81. (defun c:kr (/ pl)
  82.   (setq pl (car (entsel "\nPick 2d polyline")))
  83.   (pll pl)
  84.   (kr pl)
  85.   (princ)
  86. )
  87.  

Regards, M.R.
« Last Edit: June 02, 2012, 06:57:24 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #10 on: June 02, 2012, 08:21:12 AM »
As this is complicated to program, I watched this video and suddenly everything revealed to be simply built-in AutoCAD...  :lmao:

This example will surely undercut Lee's business with the code selling... Maybe Lee would change his mind and post the code for learning purposes of us that don't know how to create *.lsp routine for this...

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

:)

M.R. on Youtube

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #11 on: June 02, 2012, 09:40:52 AM »
This example will surely undercut Lee's business with the code selling... Maybe Lee would change his mind and post the code for learning purposes of us that don't know how to create *.lsp routine for this...

ribarm,excellent,I will take some time to study your code!
I am a bilingualist,Chinese and Chinglish.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #12 on: June 02, 2012, 11:31:44 AM »
LeeMac has invested considerable time and effort in learning to code well. I think he has every right
to recoup something for his investment.  He has shared his talent freely in many threads so I feel
he has given plenty to our community.

My 2cents  8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

chlh_jd

  • Guest
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #13 on: June 03, 2012, 06:34:02 AM »
LeeMac has invested considerable time and effort in learning to code well. I think he has every right
to recoup something for his investment.  He has shared his talent freely in many threads so I feel
he has given plenty to our community.
Me too . :-)

RGUS

  • Newt
  • Posts: 106
Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #14 on: June 03, 2012, 04:59:32 PM »
I have a LISP solution which I believe yields the correct straight skeleton result for 90% of cases, but have not released it as freeware:



Some more examples:



Awesome Lee... so where does one purchase such a cool bit of code?