Author Topic: myDefun self store the last value of result?  (Read 983 times)

0 Members and 1 Guest are viewing this topic.

d2010

  • Bull Frog
  • Posts: 326
myDefun self store the last value of result?
« on: September 04, 2021, 02:22:16 AM »
Hi , I need how to store the last value of last result?
Eg.1 the "Y" is last-value of previous-call
Eg.2. IF
    I call  (dfn_getx_readkey "[YNA]"  "Continue to Process (y;n)(a.abort)" )
  I select "A"  abort at readkey.
THEN
the function keep inside (list of dfn_getx_readkey), he keep "A".
He replace  the "Y" with the "A".(He=dfn_getx_readkey)
He or other replace inside the body. he replace the "Y" with the "A".(He=dfn_getx_readkey)
ENDIF Thank  you.


Code - Auto/Visual Lisp: [Select]
  1. #region
  2. pp_hatcharea
  3.  
  4. (defun pp_hatcharea(fmtstr / sos sumarea areaedit idx hostpoint lodctr nop ent eon lpt color msgwap sizeh umax.txt chk paintext bbroken ask)
  5. /*c2s:
  6.       vl_load_com();
  7.       readme.txt="01.First Scan all Hatch/s and remove all brokenHatch(s)",
  8.       sos=ssget(fmtstr),
  9.       sos=(sos==nil)?ssget("X",fmtstr):sos,
  10.       sumarea=0.0,
  11.       areaedit=0.0,
  12.       bbroken=ssadd(),
  13.       terpri();
  14.       umax.txt=sslength(sos);
  15.       alert(strcat(readme.txt,
  16.                   "\n02.Draw Table of Area(s)",
  17.                   "\n03.I have lisp to to label the hatch area for one hatch  at insertion point",
  18.                   "\n04.Can anyone help me to modify the lisp to make it sum more than one hatch and"));
  19.       for(idx=0;idx<sslength(sos);idx=idx+1)
  20.            ent=ssname(sos,idx),
  21.            eon=vlax.ename->vla_object(ent),
  22.            chk=(vl.catch_all_error_p(setq(areaedit,vl.catch_all_apply(read("vlax-get"),list(eon,quote(Area))))))?nil:T,
  23.            nop=php_echo(list("\rArea=[",itoa(idx),"/",itoa(sslength(sos)),"]:=")),
  24.            bbroken=(chk==nil)?ssadd(ent,bbroken):bbroken,
  25.            nop=(chk==nil)?ssdel(ent,sos):nil,
  26.            sumarea=(chk&&numberp(areaedit))?(sumarea+areaedit):sumarea;
  27.  
  28.      hostpoint=getpoint(strcat("\nSumArea=",rtos(sumarea,2,6),"<->OutSide Point:")),
  29.      hostpoint=(hostpoint==nil)?getvar("VIEWCTR"):hostpoint,
  30.      idx=(idx<2)?2:idx,
  31.      readme.txt="Calculate average of square->sizeh",
  32.      sizeh=sqrt(abs(sumarea))/idx,
  33.      ask=umax.txt-sslength(sos),
  34.      readme.txt=php_echo(list("\nCount BrokenHatch(s)=",ask,"=")),
  35.      color=1;
  36.      ask=(ask>0)?dfn_getx_readkey("[AB]","Which type/s of Hatch/s ?(B-broken.hatch)(A.all-okai):"):"A",
  37.      sos=(ask=="B")?bbroken:sos;
  38.      for(idx=0;idx<sslength(sos);idx=idx+1)
  39.            ent=ssname(sos,idx),
  40.            eon=vla_getboundingbox(ent),
  41.            loadctr=dfn_point_midi(car(eon),cadr(eon),nil),
  42.            nop=dfn_enamk_line(loadctr,hostpoint,"",color,nil),
  43.            areaedit=(ask=="A")?vlax.get(last(eon),read("Area")):nil,
  44.            lpt=entget(ent),
  45.            msgwap=(ask=="A")?strcat("Sqmeter=",rtos(areaedit,2,2),"m²,",
  46.                          "SquareFoot=",rtos(10.7639*areaedit,2,3),"ft²,",
  47.                          "Acre=",rtos(0.000247105*areaedit,2,3),"ac²,",
  48.                          "SqYard=",rtos(1.19599*areaedit,2,3),"yard²;"):
  49.                 strcat(cdr(assoc(000,lpt)),"=8.",
  50.                        cdr(assoc(008,lpt)),"+",
  51.                        cdr(assoc(100,lpt)),"*",
  52.                        cdr(assoc(005,lpt)),"+",
  53.                        cdr(assoc(410,lpt)),"-",
  54.                        cdr(assoc(002,lpt))),
  55.            nop=dfn_enamk_text(hostpoint,sizeh,msgwap,nil,nil,nil,color,""),
  56.            color=color+1,
  57.            color=(color>191)?1:color,
  58.            hostpoint=dfn_point_midi(hostpoint,list(0,sizeh*1.9780209,0),1.0);
  59.  
  60.     areaedit=sumarea,
  61.     msgwap=strcat("Sqmeter=",rtos(areaedit,2,2),"m²,",
  62.                   "SquareFoot=",rtos(10.7639*areaedit,2,3),"ft²,",
  63.                   "Acre=",rtos(0.000247105*areaedit,2,3),"ac²,",
  64.                   "SqYard=",rtos(1.19599*areaedit,2,3),"yard²;");
  65.         alert(msgwap);
  66. */
  67. msgwap)
  68.  
« Last Edit: October 14, 2021, 03:31:46 PM by d2010 »