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

0 Members and 1 Guest are viewing this topic.

#### ribarm

• Water Moccasin
• Posts: 2454
• Marko Ribar, architect
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #195 on: January 14, 2021, 04:14:57 AM »
HA, it was just a moment while working on routine... My latest version is finished... tricky roof-passed test in AutoCAD...
With my latest intervention it is also considered LWPOLYLINE that was made from closed MLINE... Previously it didn't worked with those shapes... So everything is working well... If someone notice something, please inform me...
Regards, M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

#### ribarm

• Water Moccasin
• Posts: 2454
• Marko Ribar, architect
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #196 on: January 14, 2021, 05:06:04 AM »
It's me again... This one it can't do... ch_lhjd's version is relatively good - better than mine, but I won't debug my code further... I am tired, I leave that to someone fresh...
Bye, M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

#### ribarm

• Water Moccasin
• Posts: 2454
• Marko Ribar, architect
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #197 on: January 14, 2021, 02:51:50 PM »
You know what... I'll tell you the secret to gain speed...

Quote
(defun LM:Inside-p (pt ent / unit v^v _GroupByNum fd1 fd2 par lst nrm obj tmp)
(defun unit (v / d)
(if (not (equal (setq d (distance '(0.0 0.0 0.0) v)) 0.0 1e-8))
(mapcar (function (lambda (x) (/ x d))) v)
)
)
(defun v^v (u v)
(list
(- (* (caddr u) (car v)) (* (car u) (caddr v)))
(- (* (car u) (cadr v)) (* (cadr u) (car v)))
)
)
(defun _GroupByNum (l n / r)
(if l
(cons (reverse (repeat n (setq r (cons (car l) r) l (cdr l)) r)) (_GroupByNum l n))
)
)
(if (= (type ent) 'VLA-OBJECT)
(setq obj ent ent (vlax-vla-object->ename ent))
(setq obj (vlax-ename->vla-object ent))
)
(if (vlax-curve-isplanar ent)
(progn
;(setq fd1 (vlax-curve-getfirstderiv ent (setq par (vlax-curve-getstartparam ent))))
;(while (or (equal fd1 (setq fd2 (vlax-curve-getfirstderiv ent (setq par (+ par 0.001)))) 1e-3) (null (setq nrm (unit (v^v fd1 fd2))))))
(setq nrm '(0.0 0.0 1.0)) ;;; mod by M.R. - gaining speed

(setq lst
(_GroupByNum
(vlax-invoke
(setq tmp
(vlax-ename->vla-object
(entmakex
(list
(cons 0 "RAY")
(cons 100 "AcDbEntity")
(cons 100 "AcDbRay")
(cons 10 pt)
(cons 11 (trans '(1.0 0.0 0.0) nrm 0))
)
)
)
)
'IntersectWith obj acextendnone
) 3
)
)
(vla-delete tmp)
;; gile:
(and
lst
(not (vlax-curve-getparamatpoint ent pt))
(= 1 (rem (length (vl-remove-if (function (lambda (p / pa p- p+ p0)
(setq pa (vlax-curve-getparamatpoint ent p))
(and (setq p- (cond ((setq p- (vlax-curve-getPointatParam ent (- pa 1e-8)))
(trans p- 0 nrm)
)
((trans (vlax-curve-getPointatParam ent (- (vlax-curve-getEndParam ent) 1e-8)) 0 nrm)
)
)
)
(setq p+ (cond ((setq p+ (vlax-curve-getPointatParam ent (+ pa 1e-8)))
(trans p+ 0 nrm)
)
((trans (vlax-curve-getPointatParam ent (+ (vlax-curve-getStartParam ent) 1e-8)) 0 nrm)
)
)
)
(setq p0 (trans pt 0 nrm))
(<= 0 (* (sin (angle p0 p-)) (sin (angle p0 p+)))) ;; LM Mod
)
)
) lst
)
) 2
)
)
)
)
)
)
Marko Ribar, d.i.a. (graduated engineer of architecture)

#### d2010

• Newt
• Posts: 125
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #198 on: January 15, 2021, 04:41:27 AM »
Nice Job!
Thank you pacman.z80 , paperboy.z80, or postaman.z80
You code-lisp is fantastic, but is huge./ or too complex , for manage and search bugs.
I  fill the source/rinarm.lsp with "z80Spectrum -games-names"
(defun c:2droof ( / nn_unique nn_mid nn_clockwisep nn_insidep nn_processpla
Code - Auto/Visual Lisp: [Select]
1. /*c2s:
2.          lw=car(entsel("\nPick a closed polygonal LWPOLYLINE..."));
4.          if (lw)
5.            { ti=car(_vl_times());
6.            gc();
7.           n=cdr(assoc(90,entget(lw)));
8.           pl=mapcar(function(cdr),vl.remove_if(function(lambda(xeno_z80(), (car(xeno_z80) != 10))),entget(lw)));
9.           tl=mapcar(function(lambda(arkanoid_z80(bomberman_x80),lISt(arkanoid_z80,bomberman_x80))),pl,append(cdr(pl),lISt(car(pl))));
10.           tlo=tl,
11.           utlo=unioncollinearplaneprints(tlo),
13.           plaa=pla
14.           while(n > 0)
15.             { if (null(ipll)) ipl=unique(processpla(plaa))
16.                  else  ipl=unique(processpla(unique(pla)));
17.
18.            if (equal(ipl,iplo,1e-6)) n=0;
19.          if (fff) { pl=mapcar(function(car),pla);
20.                      foreach(x,pl){lil=cons(lISt(x,ip),lil);}
21.                    n=0;
22.                  };
23.     else
24.            { ipo=ip;
28.              ipldtl=(ipll)?vl.remove_if(function(lambda(xarax_z80(),_vl_position(car(xarax),ipll,1e-6))),ipldtl):ipldtl;
31.              ipldtlo=vl.remove_if(function(lambda(xonix_z80(),_vl_position(car(xonix_z80),ipll,1e-6))),ipldtlo);
32.              ip=car(car(ipldtlo))
33.              while((!process()  && ipldtlo)) {ipldtlo=cdr(ipldtlo);ip=car(car(ipldtlo))};
34.              ipp=nil;
35.              if (ipll) { foreach(y,reverse(pal)){ipp=cons(vl.remove_if_not(function(lambda(xorem_z80(),vl.some(function(lambda(a(),#TrimR() (equal(rem( (a+kpi), (2*kpi)),angle(car(y),xorem_z80),1e-6) ||equal(a,angle(car(y),xorem_z80),1e-6)))),cadr(y)))),mapcar(function(car),vl.remove_if(function(lambda(xorem_z80(),_vl_position(car(xorem_z80),ipll,1e-6))),ipldtl))),ipp);};
36.                  ipp=apply(function(append),ipp);
37.              if (ip  && p1p2) ipp=cons(ip,ipp);
38.              ipp=unique(ipp);
39.              ipp=mapcar(function(lambda(paperboy_z80(),lISt(paperboy_z80,findipinterschilds(paperboy_z80,pla)))),ipp);
44.          }
46.          >fff=t;
47.        process()
48.       itt=vl.some(function(lambda(xenon_z80(), if ((equal(distance(ip,car(car(p1p2))), (distance(ip,car(xenon_z80))+distance(car(xenon_z80),car(car(p1p2)))),1e-6) ||equal(distance(ip,car(cadr(p1p2))), (distance(ip,car(x))+distance(car(xenon_z80),car(cadr(p1p2)))),1e-6)) )
49.              car(xenon_z80),
50.              vl.remove_if(function(lambda(xenon_z80(),equal(ip,car(xenon_z80),1e-6))),ipp)),
51.      if (p1p2  && itt)) { ip=itt;process(); };
52.      if (equal(ipo,ip,1e-6)) n=0;
54.      al=nil,a=nil
55.      if (tt)  && f) tl=vl.remove(tt,tl);
56.      if (f) { t1=vl.some(function(lambda(xadom_z80(),
60.              };
61.     else
62.     t1=nil,
63.     t2=nil;
64.     if (ip ) ipll=cons(ip,ipll);
65.     if (t1  && t2#TrimR() &&ip) )
68.     else
70.          };
71.    if (a) { pla=cons(lISt(ip,a),pla);
73.             if (car(car(p1p2))) lil=cons(lISt(car(car(p1p2)),ip),lil);
75.             pal=cons(lISt(ip,a)),pal)
76.            };
77.            };
78.     else if (ip  && null(fff))
79.            { if (car(car(p1p2)) ) lil=cons(lISt(car(car(p1p2)),ip),lil);
81.              p=vl.some(function(lambda(xanthius_z80(),(vl.position(xanthius_z80,plaa))?xanthius_z80:p1p2);
82.              if (p) { tll=vl.remove_if_not(function(lambda(xarq_z80(),vl.some(function(lambda(y(),_vl_position(p,y,1e-6))),xarq_z80))),tlo);
84.                       tl=vl.remove(tll,tl);
85.                     };
86.              tll=vl.remove_if_not(function(lambda(xcel_z80(),equal(d,distp2t(ip,xcel_z80),1e-6))),tl);
87.              txtipl=processtxtipl(tll);
88.              txtipl=vl.remove_if(function(lambda(xarax_x80(),_vl_position(xarax_x80,pl,1e-6))),txtipl);
89.              al=mapcar(function(lambda(pacman_z80(),((listp(pacman_z80))?angle(pacman_z80,ip):pacman_z80))),txtipl);
91.              al=unique(al)
92.              if (al)
93.                    { pla=append(mapcar(function(lambda(astroball_z80(),lISt(ip,astroball_z80))),al),pla);
94.                       pal=cons(lISt(ip,al),pal);
95.                     };
97.           };
98.   };
99.  iplo=ipl;
100.   };
102.    lil=unique(lil);
103.    lil=vl.remove_if(function(lambda(xmaze_z80(),vl.some(function(lambda(y(),null(y))),xmaze_z80))),lil);
104.    lipl=apply(function(append),lil);
105.    lipl=unique(vl.remove_if(function(lambda(xmas_lud_z80(),#TrimR() ( (length(vl.remove(xmas_lud_z80,lipl)) == (length(lipl)-1)) ||  (length(vl.remove(xmas_lud_z80,lipl)) == (length(lipl)-3))) )),lipl));
107.    lil= (lipl )? cons(lISt(car(lipl),cadr(lipl)),lil):lil;
108.    lil=vl.remove_if(function(lambda(xavior_z80(),#TrimR() (null(car(xavior_z80)) ||null(cadr(xavior_z80))) )),lil);
110.   };
111.   gc();
112.   prompt("\nElapsed time : ");
113.   princ(rtos( (car(_vl_times())-ti),2,20));
114.   prompt(" milliseconds...");
115.  };
116. */
117.

%include=arkanods_z80
%include=arkanoid_z80
%include=astroball_z80
%include=mid
%include=pacman_z80
%include=paperboy_z80
%include=postman_z80
%include=pulsoid_z80
%include=xanthius_z80
%include=xarax_x80
%include=xarax_z80
%include=xarq_z80
%include=xavior_z80
%include=xcel_z80
%include=xecutor_z80
%include=xen_z80
%include=xeno
%include=xeno_z80
%include=xenoii_z80
%include=xenon_z80
%include=xenophob_z80
%include=xevious_z80
%include=xmas_lud_z80
%include=xmaze_z80
%include=xonix_z80
%include=xorem_z80
%include=xtro_z80
%include=xtrzth_z80
%include=yankee1_z80
%include=yeti_z80
%include=yocan_z80
%include=yogibear_z80
%include=yomp_z80

Do you like this myLock of your-lisp?
https://youtu.be/i_FlinBI6ck?t=1435

« Last Edit: January 15, 2021, 09:46:45 AM by d2010 »

#### ribarm

• Water Moccasin
• Posts: 2454
• Marko Ribar, architect
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #199 on: January 15, 2021, 05:26:16 AM »
You quoted text that I haven't wrote... You spelled my name wrongly... You are posting gibberish code examples... If you say that my code is not good and helpful, then show us your version in ALISP format - real *.lsp... I am not saying that my version is the best, I showed examples where it won't give results, but I also showed solution for ultimate roof and solution based on my algorithm that differs from built-in offset algorithm... So if you have something useful, we'll be grateful to see it, otherwise I must say that you are spamming this topic that is IMHO very profound and well composed...
Marko Ribar, d.i.a. (graduated engineer of architecture)

#### Coder

• Swamp Rat
• Posts: 804
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #200 on: January 15, 2021, 06:58:51 AM »
You are posting gibberish code examples...
.... I must say that you are spamming this topic that is IMHO very profound and well composed...

I am completely agree with you and all of his posts are real rubbish and has nothing to do with any thread he contributed with since his first post then that leads me to say that he is really a spammer definitely.

Great work by the way Marko.

#### d2010

• Newt
• Posts: 125
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #201 on: January 15, 2021, 08:20:44 AM »
AProgramul tau Lisp este de bun, dar daca tu cresti complexitatea ribarm2droof.lsp, atunci,  in viitor, programul tau nu va avea viitor, deoarece devine
imposibil de corectat/debug-insideo-on-Real-Time.
Tu gandeste-te daca (sizeof "* ribarm2droof.lsp") dimensiunea lui creste cu m*1ko, atunci tu sa corectezi  real-debug-in dificultatea lui/creste exponential la +65535...

« Last Edit: January 15, 2021, 10:27:35 AM by d2010 »

#### ribarm

• Water Moccasin
• Posts: 2454
• Marko Ribar, architect
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #202 on: January 19, 2021, 05:21:32 AM »
My latest revision that handles lastly posted DWG is posted here :
http://www.theswamp.org/index.php?topic=41837.msg603111#msg603111

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

#### BIGAL

• Swamp Rat
• Posts: 581
• 30 + years of using Autocad
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #203 on: January 19, 2021, 07:23:50 PM »
Agree also where is the Administrators ?
A man who never made a mistake never made anything

#### wizman

• Bull Frog
• Posts: 273
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #204 on: January 19, 2021, 11:07:49 PM »
Agree also where is the Administrators ?

Agree too.  His posts are incomprehensible.
« Last Edit: January 19, 2021, 11:11:19 PM by wizman »

#### ronjonp

• Needs a day job
• Posts: 7216
##### Re: ==={Challenge}===Find the ridge lines of sloped roof
« Reply #205 on: January 19, 2021, 11:35:14 PM »
AProgramul tau Lisp este de bun, dar daca tu cresti complexitatea ribarm2droof.lsp, atunci,  in viitor, programul tau nu va avea viitor, deoarece devine
imposibil de corectat/debug-insideo-on-Real-Time.
Tu gandeste-te daca (sizeof "* ribarm2droof.lsp") dimensiunea lui creste cu m*1ko, atunci tu sa corectezi  real-debug-in dificultatea lui/creste exponential la +65535...

I agree your posts are hard to follow ... here's a translation to English for those following.
Quote
Your Lisp program is good, but if you increase the complexity of ribarm2droof.lsp, then in the future your program will have no future because it becomes
impossible to correct / debug-insideo-on-Real-Time.
You think if (sizeof "* ribarm2droof.lsp") its size increases by m * 1ko, then you correct real-debug-in its difficulty / increase exponentially to +65535 ...

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC