Lisp error in (expt 10 2)

Why Lisp command: (expt 10 2) gives 99 instead 100 ????

Comments

  • works fine on V8.2.6 -english

  • I Download BricscadPro-V8.2.6-1-en_US.exe/24.03.2008

  • Draw a line say 300 long.(itoa (getdist {endp}{endp})) = "299"(rtos (getdist {endp}{endp})) = "300"Maybe this is an incorrect use of itoa?I needed the distance as a string.Haven't noticed any other functions which seem to be inaccurate, and it always seems to be incorrect by -1

  • Hello, All,I also just tried (expt 10 2) on V8.2.6-1 English, as available for download - and I get exactly 100.Tihomir, can you still reproduce the issue ?-----For the (itoa) problem :Using a line of 300 units, I tried(setq p1 (getpoint "\n* P1 : "))(setq p2 (getpoint "\n* P2 : "))(itoa (distance p1 p2))using endpoint snap, and I correctly get "300" ... I also tried (itoa (getdist {endp} {endp} )), and still get "300".The only reason I see for 299 is, that there are very small rounding errors, which causes the value to be somewhat smaller than 300.0 - where (rtos) uses rounding to specified precision, (itoa) simply truncates ...Comparing with original AutoLisp :(itoa 2.9) gives an error, as (itoa) requires an integer, and does not allow a floating number .. LispEx accepts this, but this is not correct, strictly spoken.So correct syntax is : (itoa (fix 2.9)) which gives "2", by truncation.I will adjust LispEx to exactly match AutoLisp behaviour ... so using (rtos 2 0) is the correct way.Many greetings to all

  • It's not consistent. The lines are always drawn 300 (or whatever) long and Distance command {endp}{endp} or Dimension always gives 300.0000. So does (rtos).(itoa) will give 300 in some instances 299 in others, sometimes on the same line.In this instance I am not expecting a decimal - I use it for noting the diameter of air conditioning spigots which are always multiples of 50mm. The same happens measuring between points on a block drawn and inserted to be a correct non-decimal unit.(Sorry I never can remember which is a real or integer, or what atoi, itof etc, do)

  • I get 99 on V8.2.6

  • Today 31.03.2008.againeI get (expt 10 2) = 99but(expt 10 2.0) = 100.0

  • Hello, Tihomir,many thanks for your last note ... I will immediately check this issue - and will fix it.

  • Regarding the (itoa) problem :------------------------------Dear Mr. Gaunt,now I can explain what happens here :-)I repeated the tests with your sample drawing, but using correct Lisp syntax :(itoa (fix (getdist ...)))or similar(itoa (fix (distance p1 p2))), where p1 and p2 are the endpoints, retrieved with object snap ...This is, as the next Bricscad build will not allow (itoa ) any longer, to provide strict AutoLISp compatibility.In generally, the problem is not the (itoa) function - the problem is introduced with explicite or implicite truncation from real value to integer value.To simplify the testcode, you can also use this Lisp code :(fix (distance p1 p2)), where p1 and p2 are the endpointsBefore explaining the real problem, let me noe 2 details :1. I can reproduce the problem with 300 vs. 2992. the same problem also arises in original AutoCAD/AutoLisp ... Now for the problem itself :----------------------------------there is a generic precision problem - the SR shows, that a horizontal lineof length 300, after rotation by 45 degrees still has a length of 300, asreported by _dist or _list commands;when using Lisp (getdist {endpoint1} {endpoint2} ) with such rotated line,a distance of 300 is also reported ... but using (fix (getdist {endpoint1} {endpoint2} ))) returned 299;using the same code with the same, horizontal line correctly returns 300.The problem is, that the length of rotated line as returned by sds_getdist()is around 1E-14 less than 300.0 - even CRT output with %.16g shows 13 digitswith 0.In opposite, all other measurement functions usually return %g values resp.formatted strings incl. rounding, due to LUPREC settings.Therefore, the (fix) function returned 299, caused by truncation of that < 300.0value for the rotated line.The same behaviour can be verified with AutoCAD/AutoLisp as well, so it is ageneric problem of numerical precision here ... not a problem of LispEx itself. This workaround scales the double value by 1.000000000000001 before truncationto integer, which safely solves the issue ...This fix will be included in next public Bricscad build ...But here are 2 safe workarounds for your Lisp code :-------------------------------------------------------------------1. rounding the values before (itoa) if you are sure, that you want to have integer values, you can use rounding : (itoa (fix (+ (getdist p1 p2) 0.5))) this will round the double value to nearest integer BUT : (fix) does not nessecarly return an integer value !! due to AutoLISP documentation, it returns an integer, if the provided value does fit into a 16 bit integer; if the value is < -2147483647.0, it will still return a double value > 2147483647.0, it will also return a double value so next method is much safer ...2. using (rtos) when using (rtos 2 0) you will always get the correct "integer" value as a string, even for big values example : (rtos (getdist p1 p2) 2 0)

  • Hello, Tihomir,Hello, Daniel,I just tried this :: (expt 10 2) 100: (expt 10 2.0) 100.0also using V8.2.6 EnglishAt least, the different result types are easy to explain :- if both arguments are integer, the result is integer- if at least 1 argument is a float/double value, then the result is a doubleBut for sure, you should never get 99, in neither case !Just a question :which kind of processors do you use ??

  • Thank you Torsten for your extensive investigation. I had suspected later rtos was more appropriate than itoa for what I want and the apparent error not strictly an error, but it seemed that my error was similar to that found using expt. Now it doesn't seem so likely.

  • Torsten, I have an AMD Athlon XP1900+

  • Hello, Daniel,thanks for your feedback ...Currently, I can not reproduce the problem with (expt 10 2) = 99 on my machines ...Also, I can not see in LispEx code, why this could fail, as it seems on particular machines.My machines all have Intel processors ... and just to let you know, we currently build Bricscad using SSE (not SSE2 !) optimisation option of VC 8 compiler ... as all AMD+Intel processors since Pentium I support SSE.So I see 2 potential reasons for (expt 10 2) = 99 issue :1. a problem with SSE implementation in several processors2. a problem in CRT runtime librariesI will investigate, which MS DLL provide the CRT/Math (expt) function ... maybe there are different versions for Win2000/XP/Vista ?You might also try this :- verify (expt 10 2) on other Windows versions (2000/XP/Vista)- verify (expt 10 2) on macines with other processorsI know, not very elegant :-(But probably, the only solution ar the moment, until I will be able to reproduce the 99 result ... then, I have good chances :-)Many greetingsTorsten

  • Torsten, I have an AMD Sempron (tm) 2500+

  • Hello, Tihomir,thanks for your input too !!I have a developer friend who uses AMD processors only ... :-)So quickly, I will do some remote sessions with him, to test with his machines for the (expt 10 2) = 99 problem ...However, update follows soon ...

  • Hi Torsten,Just out of curiosity, I ran a few tests, I’m getting 100 with AutoCAD 2002 -> 2008 and with a couple of other Icads including V7. I also tried a few variations in C (math.h) and it works fine. I didn’t hand code any SSE instructions using the xmm registers, as you all are doing, but I might try once I have more free timeHope this help you

  • I have installed same version (V8.2.6-1 English Trial) on both of my computer, in my office and on my personal computer at my home. I get error only on computer at my home, it is AMD Sempron 2500+, OS WinXP Pro w. SP2. However, on computer in my office, AMD Athlon64 3200+ OS WinXP Pro w. SP2 result is OK (Expt 10 2) = 100.

  • TihomirAs a quick fix you can do something like

    (DEFUN _EXPT (B E)(IF (= (TYPE B) 'INT)(FIX (EXPT (+ B 0.0) E))(EXPT B E)));;;(_EXPT 10 2)
  • Hello, All,I guess I just figured out wht happened :-)It is the same problem as it was with (itoa) - please see long explanations above; just in short :When using (expt 10 2), all arguments are INT, so result should be in INT - due to AutoLisp documentations ... at least, as long as the result fits into 16-bit integer, otherwise a real value is returned - also, if one or both arguments are real, then the result is always real ...So far so good ...Now, it hapens on some machines (for whatever reasons !), that in C/C++ the result of 10.0 power 2.0 is around 1.0E-14 (or even lesser) smaller than exactly 100.0 ... assume, 99.9999999999999 etc.Now, when the double value is truncated to int, it results in 99 :-)Thats all the mystery ...I included some workarounds for (itoa) and now also for (expt) and also for all remaining code where double is truncated to int.This fix will be included in next public Bricscad build then ... and should hopefully solve the dilemma.BUT:If anyone still encounters the same problem then, please give me a note here ... I will then have to implement a correct "rounding of double to int", which reduces performance a bit, but seems nessecary then.Unfortunately, there is no "round()" function in C runtime ... and I never found a good implementation of "round" for C/C++ :-(Many greetings to allTorsten

  • Daniel,I recognize an problem with (expt 10 2) while I was using program wich I wrote for AutoCAD in Briscad.For my needs, I fixed this problem, earlier, as you told me how to do.I wanted to introduce other users of Lisp in Briscad with this problem, and creators of Briscad in future time to fix this error.For me, this was not an problem, it was information for other users.My problems are much bigger, in area of using DCL where a sintax for AutoCAD and Briscad is very differnet.For examples:- fixed_width_font=true in tile list_box does not respond- width=5 or width= 3 in tile button allways gives the same button widthetc...I'm a user of Lisp in AutoCAD more than ten years and for short time of Briscad. My desire is to program for Briscad useres and I would be grateful if I can get some more detailed direction about DCL for Briscad.Sorry for my bad english, I speak serbian.Many greetings to all.

  • When stumbling on different behavior between our brandnew DCL interpreter and Autocad's, please don't hesitate to document the problem and file a support request: we will gladly solve the issue and add a test to our automated test suite to make sure the problem will be flagged if ever reintroduced.Kind regards.

  • Dear Hans De BackerWhen entering data from tile edit_box to next edit_box, I want to be able to do that with Enter button.Maybe it would be more usefull to create an invisable button ( in my code button "W"). That would be possible if we could go first to invisable button, after leaving edit_box, and from that point to the wanted location in dialog box. This is my example that describe my proble with fixed_width_font=true and ENTER button. It would be good to look how it could work in AutoCAD.Sorry for my bad englishMy example LISP code;********************************************************************(defun C:TIKA( / i L DCLFAJ SEL IMEu SirVis Kn WIzl WTil PorF FajYXZ FajDET GWo GWi) (setq ZAPDET (list "$oA ******* 360 **** 21.03.2004 ***** i= 1.560 .0000000" "@oB 12.2526 0.000 0.0000 0.000" "@oC 147.3635 0.000 0.0000 0.000" " 1 12.3344 14.560- 0.0000 0.000" " 2 56.2600 25.480/ 98.2600 1.600" " 3 44.5000 65.230/ 88.5700 1.600" " 4 89.5600 44.560/ 92.4700 1.600" " 5 54.5548 56.780/ 91.5814 1.600" "$oB ******* 360 **** 21.03.2004 ***** i= 1.780 .0000000" "@oA 78.5600 0.000 0.0000 0.000" " 6 145.5600 86.230- 0.0000 0.000" " 7 100.5800 55.560- 0.0000 0.000" " 8 258.4747 55.890- 0.0000 0.000" " 9 312.5438 42.560- 0.0000 0.000" "$oC ******* 360 **** 21.03.2004 ***** i= 1.570 .0000000" "@oB 41.2500 0.000 0.0000 0.000" " 10 245.2632 14.250- 95.2547 1.800" " 11 147.4512 55.770- 91.5525 1.800" " 12 47.3626 65.250/ 87.4545 1.800" " 13 55.4600 55.560/ 88.4444 1.800" " 14 79.4714 14.260- 0.0000 0.000" " 15 145.2800 47.580- 0.0000 0.000" ) ) (setq Mdet (length ZAPDET)) (setq KYXZ "YZX: 7565656.56 50333222.11 100.77") (setq DCLFAJ (load_dialog (findfile "TIKA.DCL"))) (if (not (new_dialog "LISTBOXDET" DCLFAJ "" P00))(exit)) (if (= Mdet 0) (progn (setq TAC "" Hug "" Duz "" Vug "" Lsg "" Index -1) (mode_tile "TAC" 2)(mode_tile "TAC" 3) ) (progn (setq TAC "" Hug "" Duz "" Vug "" Lsg "") (if (= Index nil)(setq Index 0)) (setq $value (itoa Index)) (start_list "LISTA")(mapcar 'add_list ZAPDET)(end_list) (mode_tile "LISTA" 3) ) ) (set_tile "ZAGLAV" "Tihomir Bojanic") (set_tile "PORUKF" (strcat "File (Zapisnik): " "C:\Serbia\NoviSad\Geosystem\Dat\Example.det")) (POLISTI) (action_tile "AUT0" "(set_tile \"AUT0\" ST)") (action_tile "AUT1" "(set_tile \"AUT1\" ST)") (action_tile "DUZ0" "(set_tile \"DUZ0\" ST)") (action_tile "DUZ1" "(set_tile \"DUZ1\" ST)") (action_tile "DUZ2" "(set_tile \"DUZ2\" ST)") (action_tile "TIP0" "(set_tile \"TIP0\" ST)") (action_tile "TIP1" "(set_tile \"TIP1\" ST)") (action_tile "TIP2" "(set_tile \"TIP2\" ST)") (action_tile "LISTA" "(setq WTil 0)(POLISTI)") (action_tile "TAC" "(setq WTil 1)") (action_tile "HUG" "(setq WTil 2)") (action_tile "DUZ" "(setq WTil 3)") (action_tile "VUG" "(setq WTil 4)") (action_tile "LSG" "(setq WTil 5)") (action_tile "W" "(ENTER)") (action_tile "Delet" "(alert \"Delete SLOG\")(POLISTI)") (action_tile "InserT" "(alert \"Insert Station SLOG\")(POLISTI)") (action_tile "InserS" "(alert \"Insert Point SLOG\")(POLISTI)") (action_tile "Unos" "(alert \"Add new SLOG\")(POLISTI)") (action_tile "Snimi" "(alert \"Asve As all SLOG-s\")(POLISTI)") (action_tile "UCYXZ" "(alert \"Insert koordinate point\")(POLISTI)") (action_tile "NAZAD" "(alert \"Intersection 3 or more point\")(POLISTI)") (action_tile "Stamp" "(alert \"Print (Exit in Excel)\")(POLISTI)") (action_tile "Esc" "(setq GWo nil)(alert \"Exit\")(done_dialog)") (action_tile "OK" "(setq GWo T)(alert \"Accept and Exit\")(done_dialog)") (start_dialog) ;******************************** (unload_dialog DCLFAJ) (if (= GWo T)(alert "Weit Working")) );******************************************************************** (defun POLISTI( / RED p k) (setq Index (atoi $value) Wtip 2 Wduz 0) (setq RED (nth Index ZAPDET) p (substr RED 1 1) k (substr RED 30 1)) (cond ((= p "$")(setq WTip 0)) ((= p "@)(setq WTip 1)) ((= p ")(setq WTip 2)) ) (cond ((= k "/")(setq Wduz 0)) ((= k "-")(setq Wduz 1)) ((= k " ")(setq Wduz 2)) ) (PARSRED Index) (SETUCTILE) (set_tile (strcat "TIP" (itoa Wtip)) "1") (set_tile (strcat "DUZ" (itoa Wduz)) "1") (set_tile "YXZ:" KYXZ) (set_tile "LISTA" $value) );********************************************************************(defun STRCDEL(STR i / ) (strcat (substr STR 1 (- i 1)) (substr STR (+ i 1))) );********************************************************************(defun PARSRED(i / RED SP SL) (setq RED (nth i ZAPDET) p (substr RED 1 1) SP (PARSLOG (strcdel (substr RED 2) 29))) (if (/= (instr (nth 1 SP) "*") nil) (setq TAC (nth 0 SP) HUG (nth 2 SP) DUZ (nth 4 SP) LSG (nth 7 SP)) (setq TAC (nth 0 SP) HUG (nth 1 SP) DUZ (nth 2 SP) VUG (nth 3 SP) LSG (nth 4 SP)) ) );********************************************************************(defun PARSLOG(SLOG / A AA i SLG LST LPARS) (setq SLG (strcat SLOG " ") AA "" i 0 LST '() LPARS (list " " "\t" ",")) (WHILE (< i (strlen SLG)) (setq i (1+ i) A (substr SLG i 1)) (if (= (member A LPARS) nil) (setq AA (strcat AA A)) (if (/= AA "")(setq LST (cons AA LST) AA "")) ) ) (reverse LST) ) ;********************************************************************(defun SETUCTILE( / ) (set_tile "TAC" TAC) (set_tile "HUG" Hug) (set_tile "DUZ" Duz) (set_tile "VUG" Vug) (set_tile "LSG" Lsg) ) ;******************************************************************** (defun ENTER( / ) (cond ((= WTil 0) (POLISTI) ) ((= WTil 1) (mode_tile "HUG" 2)(mode_tile "HUG" 3) ) ((= WTil 2) (mode_tile "DUZ" 2)(mode_tile "DUZ" 3) ) ((= WTil 3) (mode_tile "VUG" 2)(mode_tile "VUG" 3) ) ((= WTil 4) (mode_tile "LSG" 2)(mode_tile "LSG" 3) ) ((= WTil 5) (alert "Construct SLOG and add in LIST") (mode_tile "TAC" 2)(mode_tile "TAC" 3) ) ) )My example DCL code//*******************************************************************LISTBOXDET: dialog {key="ZAGLAV";initial_focus="LISTA"; :text {key="PORUKF";} :row {width=60; :column {fixed_height=true;alignment = top;fixed_width_font=true; :list_box { label=" Tacka H-ugao Duzina V-ugao L-signala"; //tabs = "12 22 32 42"; key="LISTA"; allow_accept=false; fixed_width=true; width=50; height=28; fixed_width_font=true; } :row {alignment = left;alignment = top; :edit_box {key="TAC";edit_width=10;edit_limit=10;allow_accept=true;fixed_width=true;} :edit_box {key="HUG";edit_width=10;edit_limit=10;allow_accept=true;fixed_width=true;} :edit_box {key="DUZ";edit_width=10;edit_limit=10;allow_accept=true;fixed_width=true;} :edit_box {key="VUG";edit_width=10;edit_limit=10;allow_accept=true;fixed_width=true;} :edit_box {key="LSG";edit_width= 8;edit_limit= 8;allow_accept=true;fixed_width=true;} :text {label=" ";} } :row { :text {label= "";key="YXZ:";fixed_width_font = true;alignment = left;} :button {label = " ";key="W";fixed_width=true;width=0;is_default=true;} // invisable ENTER button (now visable) } :text {label= "U liniji za editovanje: Napred> =Enter,Tab <Nazad=Shift+Tab";fixed_width=false;fixed_width_font=false;alignment=left;} } :column {width=4;fixed_height=true;alignment=top;fixed_width=true; :row { :button {label="Y&XZ";key="UCYXZ";width=3;} :button {label="Na&z";key="NAZAD";width=3;} } :radio_column {width=3; label = "Broj tacke:"; :radio_button {label="&Automatski" ;key="AUT0";} :radio_button {label="&Manuelno" ;key="AUT1";} } :radio_column {width=3; label = "Duzina:"; :radio_button {label="&Kosa" ;key="DUZ0";} :radio_button {label="&Horizont." ;key="DUZ1";} :radio_button {label="&Bez kota" ;key="DUZ2";} } :radio_column {width=3; label = "Tip tacke:"; :radio_button {label="&Stanica" ;key="TIP0";} :radio_button {label="&Vizura" ;key="TIP1";} :radio_button {label="De&taljna" ;key="TIP2";} } :button {label="&Unos DET";key="Unos" ;width=3;} :row { :button {label="&InST";key="InserS";width=1;} :button {label="I&nDT";key="InserT";width=1;} } :button {label="&Delete" ;key="Delet" ;width=3;} :button {label="&Snimi" ;key="Snimi" ;width=3;} :button {label="Stam&paj";key="Stamp" ;width=3;} :row { :button {label="&Esc";key="Esc";is_cancel=true;width=3;} :button {label="&OK" ;key="OK" ;width=3;} } } } }

  • Dear Hans De Backer

    My example LISP code;********************************************************************(defun C:TIKA( / i L DCLFAJ SEL IMEu SirVis Kn WIzl WTil PorF FajYXZ FajDET GWo GWi) (setq ZAPDET (list "$oA ******* 360 **** 21.03.2004 ***** i= 1.560 .0000000" "@oB 12.2526 0.000 0.0000 0.000" "@oC 147.3635 0.000 0.0000 0.000" " 1 12.3344 14.560- 0.0000 0.000" " 2 56.2600 25.480/ 98.2600 1.600" " 3 44.5000 65.230/ 88.5700 1.600" " 4 89.5600 44.560/ 92.4700 1.600" " 5 54.5548 56.780/ 91.5814 1.600" "$oB ******* 360 **** 21.03.2004 ***** i= 1.780 .0000000" "@oA 78.5600 0.000 0.0000 0.000" " 6 145.5600 86.230- 0.0000 0.000" " 7 100.5800 55.560- 0.0000 0.000" " 8 258.4747 55.890- 0.0000 0.000" " 9 312.5438 42.560- 0.0000 0.000" "$oC ******* 360 **** 21.03.2004 ***** i= 1.570 .0000000" "@oB 41.2500 0.000 0.0000 0.000" " 10 245.2632 14.250- 95.2547 1.800" " 11 147.4512 55.770- 91.5525 1.800" " 12 47.3626 65.250/ 87.4545 1.800" " 13 55.4600 55.560/ 88.4444 1.800" " 14 79.4714 14.260- 0.0000 0.000" " 15 145.2800 47.580- 0.0000 0.000" ) ) (setq Mdet (length ZAPDET)) (setq KYXZ "YZX: 7565656.56 50333222.11 100.77") (setq DCLFAJ (load_dialog (findfile "TIKA.DCL"))) (if (not (new_dialog "LISTBOXDET" DCLFAJ "" P00))(exit)) (if (= Mdet 0) (progn (setq TAC "" Hug "" Duz "" Vug "" Lsg "" Index -1) (mode_tile "TAC" 2)(mode_tile "TAC" 3) ) (progn (setq TAC "" Hug "" Duz "" Vug "" Lsg "") (if (= Index nil)(setq Index 0)) (setq $value (itoa Index)) (start_list "LISTA")(mapcar 'add_list ZAPDET)(end_list) (mode_tile "LISTA" 3) ) ) (set_tile "ZAGLAV" "Tihomir Bojanic") (set_tile "PORUKF" (strcat "File (Zapisnik): " "C:\\Serbia\\NoviSad\\Geosystem\\Dat\\Example.det")) (POLISTI) (action_tile "AUT0" "(set_tile \"AUT0\" ST)") (action_tile "AUT1" "(set_tile \"AUT1\" ST)") (action_tile "DUZ0" "(set_tile \"DUZ0\" ST)") (action_tile "DUZ1" "(set_tile \"DUZ1\" ST)") (action_tile "DUZ2" "(set_tile \"DUZ2\" ST)") (action_tile "TIP0" "(set_tile \"TIP0\" ST)") (action_tile "TIP1" "(set_tile \"TIP1\" ST)") (action_tile "TIP2" "(set_tile \"TIP2\" ST)") (action_tile "LISTA" "(setq WTil 0)(POLISTI)") (action_tile "TAC" "(setq WTil 1)") (action_tile "HUG" "(setq WTil 2)") (action_tile "DUZ" "(setq WTil 3)") (action_tile "VUG" "(setq WTil 4)") (action_tile "LSG" "(setq WTil 5)") (action_tile "W" "(ENTER)") (action_tile "Delet" "(alert \"Delete SLOG\")(POLISTI)") (action_tile "InserT" "(alert \"Insert Station SLOG\")(POLISTI)") (action_tile "InserS" "(alert \"Insert Point SLOG\")(POLISTI)") (action_tile "Unos" "(alert \"Add new SLOG\")(POLISTI)") (action_tile "Snimi" "(alert \"Asve As all SLOG-s\")(POLISTI)") (action_tile "UCYXZ" "(alert \"Insert koordinate point\")(POLISTI)") (action_tile "NAZAD" "(alert \"Intersection 3 or more point\")(POLISTI)") (action_tile "Stamp" "(alert \"Print (Exit in Excel)\")(POLISTI)") (action_tile "Esc" "(setq GWo nil)(alert \"Exit\")(done_dialog)") (action_tile "OK" "(setq GWo T)(alert \"Accept and Exit\")(done_dialog)") (start_dialog) ;******************************** (unload_dialog DCLFAJ) (if (= GWo T)(alert "Weit Working")) );******************************************************************** (defun POLISTI( / RED p k) (setq Index (atoi $value) Wtip 2 Wduz 0) (setq RED (nth Index ZAPDET) p (substr RED 1 1) k (substr RED 30 1)) (cond ((= p "$")(setq WTip 0)) ((= p "@")(setq WTip 1)) ((= p " ")(setq WTip 2)) ) (cond ((= k "/")(setq Wduz 0)) ((= k "-")(setq Wduz 1)) ((= k " ")(setq Wduz 2)) ) (PARSRED Index) (SETUCTILE) (set_tile (strcat "TIP" (itoa Wtip)) "1") (set_tile (strcat "DUZ" (itoa Wduz)) "1") (set_tile "YXZ:" KYXZ) (set_tile "LISTA" $value) );********************************************************************(defun STRCDEL(STR i / ) (strcat (substr STR 1 (- i 1)) (substr STR (+ i 1))) );********************************************************************(defun PARSRED(i / RED SP SL) (setq RED (nth i ZAPDET) p (substr RED 1 1) SP (PARSLOG (strcdel (substr RED 2) 29))) (if (/= (instr (nth 1 SP) "*") nil) (setq TAC (nth 0 SP) HUG (nth 2 SP) DUZ (nth 4 SP) LSG (nth 7 SP)) (setq TAC (nth 0 SP) HUG (nth 1 SP) DUZ (nth 2 SP) VUG (nth 3 SP) LSG (nth 4 SP)) ) );********************************************************************(defun PARSLOG(SLOG / A AA i SLG LST LPARS) (setq SLG (strcat SLOG " ") AA "" i 0 LST '() LPARS (list " " "\t" ",")) (WHILE (< i (strlen SLG)) (setq i (1+ i) A (substr SLG i 1)) (if (= (member A LPARS) nil) (setq AA (strcat AA A)) (if (/= AA "")(setq LST (cons AA LST) AA "")) ) ) (reverse LST) ) ;********************************************************************(defun SETUCTILE( / ) (set_tile "TAC" TAC) (set_tile "HUG" Hug) (set_tile "DUZ" Duz) (set_tile "VUG" Vug) (set_tile "LSG" Lsg) ) ;******************************************************************** (defun ENTER( / ) (cond ((= WTil 0) (POLISTI) ) ((= WTil 1) (mode_tile "HUG" 2)(mode_tile "HUG" 3) ) ((= WTil 2) (mode_tile "DUZ" 2)(mode_tile "DUZ" 3) ) ((= WTil 3) (mode_tile "VUG" 2)(mode_tile "VUG" 3) ) ((= WTil 4) (mode_tile "LSG" 2)(mode_tile "LSG" 3) ) ((= WTil 5) (alert "Construct SLOG and add in LIST") (mode_tile "TAC" 2)(mode_tile "TAC" 3) ) ) )My example DCL code//*******************************************************************LISTBOXDET: dialog {key="ZAGLAV";initial_focus="LISTA"; :text {key="PORUKF";} :row {width=60; :column {fixed_height=true;alignment = top;fixed_width_font=true; :list_box { label=" Tacka H-ugao Duzina V-ugao L-signala"; //tabs = "12 22 32 42"; key="LISTA"; allow_accept=false; fixed_width=true; width=50; height=28; fixed_width_font=true; } :row {alignment = left;alignment = top; :edit_box {key="TAC";edit_width=10;edit_limit=10;allow_accept=true;fixed_width=true;} :edit_box {key="HUG";edit_width=10;edit_limit=10;allow_accept=true;fixed_width=true;} :edit_box {key="DUZ";edit_width=10;edit_limit=10;allow_accept=true;fixed_width=true;} :edit_box {key="VUG";edit_width=10;edit_limit=10;allow_accept=true;fixed_width=true;} :edit_box {key="LSG";edit_width= 8;edit_limit= 8;allow_accept=true;fixed_width=true;} :text {label=" ";} } :row { :text {label= "";key="YXZ:";fixed_width_font = true;alignment = left;} :button {label = " ";key="W";fixed_width=true;width=0;is_default=true;} // invisable ENTER button (now visable) } :text {label= "U liniji za editovanje: Napred> =Enter,Tab
  • Sorry HansIn my Lisp code the elements of list ZAPDET are formated slogs, thats why the Lisp code is not correct. In what way can I send my formated Lisp code?My e-mail is: tikab@nadlanu.com

  • Dear Tihomir,as mentioned above, filing a support request is the proper way to go, it allows to assign problems to the most suitable developer and to keep track of the history of the issue when multiple developers are working on it. Please have a look at http://www.bricsys.com/en_INTL/support/support.jspTo a support request you can attach one or more files (when attaching multiple files it is convenient to put them into a single zip file)Kind regards,Hans

This discussion has been closed.