Guest Posted October 13, 2022 Posted October 13, 2022 (edited) Hi i use this code to export note notifications from some close polylines. Tis code show me the results in commad line. From eatch option the code seatch if the area is between some limits and then export as results few notifications and 3 calculations. Is easier for me to read them in notepad and not in command line. Is it possible to write the result in temp txt and open the notepad ? *** The text in code is random because is a lot of staff to translate in English (defun c:testL (/ _option1 _option2 _option3 _option4 area dxf ent sdarea skarea sd sk) (defun _option1 () (cond ((< area 200) (setq sdarea area skarea (* area 0.7) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? µ 2000 ?atasdas (F?? 181/?/1985)" "\n" "\n a) ???s?p? 12µ / ? = sµ?? ß?s? F?? / ?p? 3-5-1985 µ 4-11-2011" "\n ß) ???s?p? 10µ / ?<= 500 t.µ / µet? 4-11-2011" "\n ?) ?? eµßad?? ?a? ?? d?astase?? p?? e??a? t?? 3-5-1985" "\n ?p?st?se?? ap? ta ???a ? >= 2.50 µ (?p?? de? ef?pteta? t?? )" "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((<= area 500) (setq sdarea 240 skarea (* area 0.6) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? µ 2000 ?atasdas (F?? 181/?/1985)" "\n" "\n G?a peda " (rtos area 2 2) " t.µ < 700 t.µ " "\n a) ???s?p? 12µ / ? = sµ?? ß?s? F?? / ?p? 3-5-1985 µ 4-11-2011" "\n ß) ???s?p? 10µ / ?<=500 t.µ / µet? 4-11-2011" "\n ?) ?? eµßad?? ?a? ?? d?astase?? p?? e??a? t?? 3-5-1985" "\n ?p?st?se?? ap? ta ???a ? >= 2.50 µ (?p?? de? ef?pteta? t?? )" "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((and (> area 500) (< area 700)) (setq sdarea 240 skarea (* area 0.6) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? µ 2000 ?atasdas (F?? 181/?/1985)" "\n" "\n G?a peda 500 t.µ < " (rtos area 2 2) " t.µ < 700 t.µ " "\n a) ???s?p? 12µ / ? = sµ?? ß?s? F?? / ?p? 3-5-1985 µ 4-11-2011" "\n ß) ???s?p? 15µ / ?>500 t.µ / µet? 4-11-2011" "\n ?) ?? eµßad?? ?a? ?? d?astase?? p?? e??a? t?? 3-5-1985" "\n ?p?st?se?? ap? ta ???a ? >= 2.50 µ (?p?? de? ef?pteta? t?? )" "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((>= area 700) (setq sdarea 400 skarea (* area 0.6) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? µ 2000 ?atasdas (F?? 181/?/1985)" "\n" "\n G?a peda " (rtos area 2 2) " t.µ >= 700 t.µ " "\n a) ???s?p? 12µ / ? = sµ?? ß?s? F?? / ?p? 3-5-1985 µ 4-11-2011" "\n ß) ???s?p? 15µ / ?>500 t.µ / µet? 4-11-2011" "\n ?) ?? eµßad?? ?a? ?? d?astase?? p?? e??a? t?? 3-5-1985" "\n ?p?st?se?? ap? ta ???a ? >= 2.50 µ (?p?? de? ef?pteta? t?? )" "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ) (princ (strcat "\n Area = " (rtos area 2 2) " t.µ" "\n Calc1 = " (rtos sdarea 2 2) " t.µ" "\n Calc2 = " (rtos skarea 2 2) " t.µ" ) ) ) (defun _option2 () (cond ((<= area 100) (setq sdarea (* area 1.60) skarea (* area 0.80) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? p???f?st?µe t?? 1923 ( F?? 138/?/1981 )" "\n" "\n ?aasdass? " "\n G?a peda " (rtos area 2 2) " t.µ <= 300 t.µ " "\n 1. ?a ?f?st?µe?a t?? 13 - 3 - 1981 e st? eµßad?? 300 t.µ." "\n 2. ?a ?f?st?µe?a t?? 25 - 7 - 1979 e st? eµßad?? 150 t.µ." "\n 3. ?a ?f?st?µe?a t?? 2 - 7 - 1968 µe ?p??e? d?ast?se?? ?a? eµßad?? e??a?." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " "\n Se a?t? t?? pe??pt?s? ? asdas e??a? 80% ?a? ? S? 1.60\n " ) ) ) ((and (> area 100) (<= area 200)) (setq sdarea (* area 1.20) skarea (* area (/ (* area 2) 160)) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? p???f?st?µe t?? 1923 ( F?? 138/?/1981 )" "\n" "\n ?aasdass? " "\n G?a peda " (rtos area 2 2) " t.µ <= 300 t.µ " "\n 1. ?a ?f?st?µe?a t?? 13 - 3 - 1981 e st? eµßad?? 300 t.µ." "\n 2. ?a ?f?st?µe?a t?? 25 - 7 - 1979 e st? eµßad?? 150 t.µ." "\n 3. ?a ?f?st?µe?a t?? 2 - 7 - 1968 µe ?p??e? d?ast?se?? ?a? eµßad?? e??a?." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " "\n Se a?t? t?? pe??pt?s? ? S? e??a? 160/2? ?a? ? S? 1.20 ?a? e st? ??µ?s? 160 t.µ \n " ) ) ) ((and (> area 200) (<= area 300)) (setq sdarea (* area 1) skarea (* area 0.60) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? p???f?st?µe t?? 1923 ( F?? 138/?/1981 )" "\n" "\n ?aasdass? " "\n G?a peda " (rtos area 2 2) " t.µ <= 300 t.µ " "\n 1. ?a ?f?st?µe?a t?? 13 - 3 - 1981 e st? eµßad?? 300 t.µ." "\n 2. ?a ?f?st?µe?a t?? 25 - 7 - 1979 e st? eµßad?? 150 t.µ." "\n 3. ?a ?f?st?µe?a t?? 2 - 7 - 1968 µe ?p??e? d?ast?se?? ?a? eµßad?? e??a?." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " "\n Se a?t? t?? pe??pt?s? ? ??µ?s? de? µp??e? ?a e??a? µ te?? t?? 240 t.µ\n " ) ) ) ((and (> area 300) (<= area 2000)) (setq sdarea 400 skarea (* area 0.6) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? p???f?st?µe t?? 1923 ( F?? 138/?/1981 )" "\n" "\n G?a peda " (rtos area 2 2) " t.µ <= 2000 t.µ " "\n" "\n a) ?a???a?: " "\n ???s?p? : Ep? ?f?st?µe??? asdas??st?? (F?? 138/?/1981) / ?= 2000t.µ" "\n ß) ?aasdass? " "\n 1. ?a ?f?st?µe?a t?? 13 - 3 - 1981 e st? eµßad?? 300 t.µ." "\n 2. ?a ?f?st?µe?a t?? 25 - 7 - 1979 e st? eµßad?? 150 t.µ." "\n 3. ?a ?f?st?µe?a t?? 2 - 7 - 1968 µe ?p??e? d?ast?se?? ?a? eµßad?? e??a?." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((> area 2000) (setq sdarea (+ 400 ( * 0.05 (- area 2000))) skarea (* area 0.6) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? p???f?st?µe t?? 1923 ( F?? 138/?/1981 )" "\n" "\n G?a peda " (rtos area 2 2) " t.µ > 2000 t.µ " "\n ?a???a?: " "\n ???s?p? ep? ?f?st?µe??? asdas??st?? (F?? 138/?/1981) / ?= 2000t.µ" "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ) (princ (strcat "\n Area = " (rtos area 2 2) " t.µ" "\n Calc1 = " (rtos sdarea 2 2) " t.µ" "\n Calc2 = " (rtos skarea 2 2) " t.µ" ) ) ) (defun _option3 () (cond ((< area 750) (setq sdarea 0 skarea 0 ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? (F?? 270/?/1985 )" "\n" "\n G?a peda " (rtos area 2 2) " t.µ < 750 t.µ " "\n st? ??µ?s? - asdas." "\n --------------------------\n " "\n *** ?? ??t?? ?a? µ? µ?s?µ?\n" ) ) ) ((= area 750) (setq sdarea (+ 100 (/ (- area 750) 9)) skarea (* area 0.1) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? (F?? 270/?/1985 )" "\n" "\n G?a p??s?p? se ??e??e??, asdas? ?pa???a???, ??µ?t ?a? t " "\n ?d??? ?? ?a? se e??ate?e?µ??a tµ?µat? t??? ?a? se s?d???d??µ ??aµµ??" "\n" "\n G?a peda = 750 t.µ " "\n ?aasdass? " "\n ???s?p? 10µ / 15µ / ?= 750 t.µ ??? 12-11-1962" "\n" "\n ** ?p?st?se?? (F?? 270?’/1985 ) a???1.pa?.5 ?a? a???.6 pa?.2" "\n--------------------------------------------------------------" "\n ?p?st?se?? ap? ???a 2.5 µ tasdasst?? (2.5µ ef?s?? t? p??s?p? <20µ) " "\n ?p?st?se?? ap? ?pa???t???s? ?S? 15µ." "\n ?p?st?se?? ap? ??µµat?? 10µ tasdasst??." "\n ?p?st?se?? ap? ?as??? ??tas? 10µ tasdasst??." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((and (> area 750) (< area 1200)) (setq sdarea (+ 100 (/ (- area 750) 9)) skarea (* area 0.1) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? (F?? 270/?/1985 )" "\n" "\n G?a p??s?p? se ??e??e??, asdas? ?pa???a???, ??µ?t ?a? t " "\n ?d??? ?? ?a? se e??ate?e?µ??a tµ?µat? t??? ?a? se s?d???d??µ ??aµµ??" "\n" "\n G?a peda 750 t.µ < " (rtos area 2 2) " t.µ < 1200 t.µ " "\n ?aasdass? " "\n ???s?p? 10µ / 15µ / ?= 750 t.µ ??? 12-11-1962" "\n" "\n ** ?p?st?se?? (F?? 270/?/1985 ) a???1.pa?.5 ?a? a???.6 pa?.2" "\n--------------------------------------------------------------" "\n ?p?st?se?? ap? ???a 2.5 µ tasdasst?? (2.5µ ef?s?? t? p??s?p? <20µ) " "\n ?p?st?se?? ap? ?pa???t???s? ?S? 15µ." "\n ?p?st?se?? ap? ??µµat?? 10µ tasdasst??." "\n ?p?st?se?? ap? ?as??? ??tas? 10µ tasdasst??." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((= area 1200) (setq sdarea (+ 100 (/ (- area 750) 9)) skarea (* area 0.1) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? (F?? 270/?/1985 )" "\n" "\n G?a p??s?p? se ??e??e??, asdas? ?pa???a???, ??µ?t ?a? t " "\n ?d??? ?? ?a? se e??ate?e?µ??a tµ?µat? t??? ?a? se s?d???d??µ ??aµµ??" "\n" "\n G?a peda = 1200 t.µ " "\n ?aasdass? " "\n ???s?p? 20µ / 35µ / ?= 1200 t.µ ??? 12-11-1964" "\n" "\n ** ?p?st?se?? (F?? 270/?/1985 ) a???1.pa?.5 ?a? a???.6 pa?.2" "\n--------------------------------------------------------------" "\n ?p?st?se?? ap? ???a 5 µ tasdasst?? (2.5µ ef?s?? t? p??s?p? < 45µ)" "\n ?p?st?se?? ap? ?pa???t???s? ?S? 15µ." "\n ?p?st?se?? ap? ??µµat?? 10µ tasdasst??." "\n ?p?st?se?? ap? ?as??? ??tas? 10µ tasdasst??." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((and (> area 1200) (< area 2000)) (setq sdarea (+ 150 (/ (- area 1200) 16)) skarea (* area 0.1) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? (F?? 270/?/1985 )" "\n" "\n G?a p??s?p? se ??e??e??, asdas? ?pa???a???, ??µ?t ?a? t " "\n ?d??? ?? ?a? se e??ate?e?µ??a tµ?µat? t??? ?a? se s?d???d??µ ??aµµ??" "\n" "\n G?a peda 1200 t.µ < " (rtos area 2 2) " t.µ < 2000 t.µ " "\n ?aasdass? " "\n ???s?p? 20µ / 35µ / ?= 1200 t.µ ??? 12-11-1964" "\n" "\n ** ?p?st?se?? (F?? 270/?/1985 ) a???1.pa?.5 ?a? a???.6 pa?.2" "\n--------------------------------------------------------------" "\n ?p?st?se?? ap? ???a 5 µ tasdasst?? (2.5µ ef?s?? t? p??s?p? <45µ)" "\n ?p?st?se?? ap? ?pa???t???s? ?S? 15µ." "\n ?p?st?se?? ap? ??µµat?? 10µ tasdasst??." "\n ?p?st?se?? ap? ??µµat?? 10µ tasdasst??." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((= area 2000) (setq sdarea (+ 150 (/ (- area 1200) 16)) skarea (* area 0.1) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? (F?? 270/?/1985 )" "\n" "\n G?a p??s?p? se ??e??e??, asdas? ?pa???a???, ??µ?t ?a? t " "\n ?d??? ?? ?a? se e??ate?e?µ??a tµ?µat? t??? ?a? se s?d???d??µ ??aµµ??" "\n" "\n G?a peda = 2000 t.µ " "\n ?aasdass? " "\n ???s?p? 25µ / 40µ / ?= 2000 t.µ ??? 17-10-1978 " "\n ? ??t?? p??e?? ??µ?? ?a? sµ?? a? e??a? t?? ? 2000t.µ t?? 24-4-1977 ?.?.5.4.97 F?? 133/?" "\n" "\n ** ?p?st?se?? (F?? 270?’/1985 ) a???1.pa?.5 ?a? a???.6 pa?.2" "\n--------------------------------------------------------------" "\n ?p?st?se?? ap? ???a 5 µ tasdasst?? (2.5µ ef?s?? t? p??s?p? <45µ ??? 17-10-1978) " "\n ?p?st?se?? ap? ?pa???t???s? ?S? 15µ." "\n ?p?st?se?? ap? ??µµat?? 10µ tasdasst??." "\n ?p?st?se?? ap? ?as??? ??tas? 10µ tasdasst??." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((and (> area 2000) (< area 4000)) (setq sdarea 0 skarea 0 sd (+ 150 (/ (- area 1200) 16)) sk (* area 0.1) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? (F?? 270/?/1985 )" "\n" "\n G?a p??s?p? se ??e??e??, asdas? ?pa???a???, ??µ?t ?a? t " "\n ?d??? ?? ?a? se e??ate?e?µ??a tµ?µat? t??? ?a? se s?d???d??µ ??aµµ??" "\n" "\n G?a peda 2000 t.µ < " (rtos area 2 2) " t.µ < 4000 t.µ " "\n ?aasdass? " "\n ???s?p? 25µ / 40µ / ?= 2000 t.µ ??? 17-10-1978" "\n ? ??t?? p??e?? ??µ?? ?a? sµ?? a? e??a? t?? ? 2000t.µ" "\n t?? 24-4-1977 ?.?.5.4.97 F?? 133/?" "\n" "\n ** ?p?st?se?? (F?? 270/?/1985 ) a???1.pa?.5 ?a? a???.6 pa?.2" "\n--------------------------------------------------------------" "\n ?p?st?se?? ap? ???a 5 µ tasdasst?? (2.5µ ef?s?? t? p??s?p? <45µ ??? 17-10-1978)" "\n ?p?st?se?? ap? ?pa???t???s? ?S? 15µ." "\n ?p?st?se?? ap? ??µµat?? 10µ tasdasst??." "\n ?p?st?se?? ap? ?as??? ??tas? 10µ tasdasst??." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas.(?at? ?aasdass?)" "\n --------------------------\n " "\n ?p?t?ep?µe?? ??µ?s? = " (rtos sd 2 2) " t.µ" "\n ?p?t?ep?µe?? asdas = " (rtos sk 2 2) " t.µ" "\n" "\n st? ??µ?s? - asdas.(?at? ?a???a)" "\n --------------------------\n" "\n *** ?? ??t?? ?a? µ? µ?s?µ?\n" ) ) ) ((= area 4000) (setq sdarea 186 skarea (* area 0.1) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? (F?? 270/?/1985 )" "\n" "\n G?a peda = 4000 t.µ " "\n G?a p??s?p? se asdas??st? d??µ? " "\n" "\n ?a???a?" "\n ???s?p? 25µ / - / ?= 4000 t.µ 31-12-2003" "\n" "\n G?a p??s?p? se ??e??e??, asdas? ?pa???a???, ??µ?t ?a? t " "\n ?d??? ?? ?a? se e??ate?e?µ??a tµ?µat? t??? ?a? se s?d???d??µ ??aµµ??" "\n" "\n ?a???a?" "\n ???s?p? 45µ / 50µ / ?= 4000 t.µ 31-12-2003" "\n" "\n G?a ?d???t?s?e? ???s?p? se d??µ?" "\n" "\n ?aasdass? " "\n ???s?p? / ?= 4000 t.µ ??? 31-12-2003" "\n ? ??t?? p??e?? ??µ?? ?a? sµ?? a? e??a? t?? ? 2000t.µ" "\n t?? 24-4-1977 ?.?.5.4.97 F?? 133/?" "\n" "\n ** ?p?st?se?? (F?? 270/?/1985 ) a???1.pa?.5 ?a? a???.6 pa?.2" "\n--------------------------------------------------------------" "\n ?p?st?se?? ap? ???a 15 µ ? (7.5 µe µ???st? p??t?? ?t 10µ. ??? 15-4-1981)" "\n ?p?st?se?? ap? ?pa???t???s? ?S? 15µ." "\n ?p?st?se?? ap? ??µµat?? 10µ tasdasst??." "\n ?p?st?se?? ap? ?as??? ??tas? 10µ tasdasst??." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((and (> area 4000) (<= area 8000)) (setq sdarea (+ 186 (* 0.018 (- area 4000))) skarea (* area 0.1) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? (F?? 270/?/1985 )" "\n" "\n G?a peda 4000 t.µ < " (rtos area 2 2) " t.µ <= 8000 t.µ " "\n G?a p??s?p? se asdas??st? d??µ? " "\n" "\n ?a???a?" "\n ???s?p? 25µ / - / ?= 4000 t.µ 31-12-2003" "\n" "\n G?a p??s?p? se ??e??e??, asdas? ?pa???a???, ??µ?t ?a? t " "\n ?d??? ?? ?a? se e??ate?e?µ??a tµ?µat? t??? ?a? se s?d???d??µ ??aµµ??" "\n" "\n ?a???a?" "\n ???s?p? 45µ / 50µ / ?= 4000 t.µ 31-12-2003" "\n" "\n G?a ?d???t?s?e? ???s?p? se d??µ?" "\n" "\n ?aasdass? " "\n ???s?p? / ?= 4000 t.µ ??? 31-12-2003" "\n ? ??t?? p??e?? ??µ?? ?a? sµ?? a? e??a? t?? ? 2000t.µ" "\n t?? 24-4-1977 ?.?.5.4.97 F?? 133/?" "\n" "\n ** ?p?st?se?? (F?? 270/?/1985 ) a???1.pa?.5 ?a? a???.6 pa?.2" "\n--------------------------------------------------------------" "\n ?p?st?se?? ap? ???a 15 µ ? (7.5 µe µ???st? p??t?? ?t 10µ. ??? 15-4-1981)" "\n ?p?st?se?? ap? ?pa???t???s? ?S? 15µ." "\n ?p?st?se?? ap? ??µµat?? 10µ tasdasst??." "\n ?p?st?se?? ap? ?as??? ??tas? 10µ tasdasst??." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ((> area 8000) (setq sdarea (+ 258 (* 0.009 (- area 8000))) skarea (* area 0.1) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? (F?? 270/?/1985 )" "\n" "\n G?a peda " (rtos area 2 2) " t.µ > 8000 t.µ " "\n G?a p??s?p? se asdas??st? d??µ? " "\n" "\n ?a???a?" "\n ???s?p? 25µ / - / ?= 4000 t.µ 31-12-2003" "\n" "\n G?a p??s?p? se ??e??e??, asdas? ?pa???a???, ??µ?t ?a? t " "\n ?d??? ?? ?a? se e??ate?e?µ??a tµ?µat? t??? ?a? se s?d???d??µ ??aµµ??" "\n" "\n ?a???a?" "\n ???s?p? 45µ / 50µ / ?= 4000 t.µ 31-12-2003" "\n" "\n G?a ?d???t?s?e? ???s?p? se d??µ?" "\n" "\n ?aasdass? " "\n ???s?p? / ?= 4000 t.µ ??? 31-12-2003" "\n ? ??t?? p??e?? ??µ?? ?a? sµ?? a? e??a? t?? ? 2000t.µ" "\n t?? 24-4-1977 ?.?.5.4.97 F?? 133/?" "\n" "\n ** ?p?st?se?? (F?? 270/?/1985 ) a???1.pa?.5 ?a? a???.6 pa?.2" "\n--------------------------------------------------------------" "\n ?p?st?se?? ap? ???a 15 µ ? (7.5 µe µ???st? p??t?? ?t 10µ. ??? 15-4-1981)" "\n ?p?st?se?? ap? ?pa???t???s? ?S? 15µ." "\n ?p?st?se?? ap? ??µµat?? 10µ tasdasst??." "\n ?p?st?se?? ap? ?as??? ??tas? 10µ tasdasst??." "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ) (princ (strcat "\n Area = " (rtos area 2 2) " t.µ" "\n Calc1 = " (rtos sdarea 2 2) " t.µ" "\n Calc2 = " (rtos skarea 2 2) " t.µ" ) ) ) (defun _option4 () (initget 7) (setq sdarea (* area (getreal "\n??ste t?? S.? : : "))) (initget 7) (setq skarea (* area (getreal "\n??ste t?? S.? : "))) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? ??t?? S?ed??? ???e??" "\n" "\n *** ???S??? st??? ??µ?s?? ?a? ??t??t?ta? t?? peasdas !!!!" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) (princ (strcat "\n Area = " (rtos area 2 2) " t.µ" "\n Calc1 = " (rtos sdarea 2 2) " t.µ" "\n Calc2 = " (rtos skarea 2 2) " t.µ" ) ) ) ;; Main ----- (if (and (setq ent (car (entsel "\nselect close polyline : "))) (wcmatch (cdr (assoc 0 (setq dxf (entget ent)))) "*POLYLINE") (member (cdr (assoc 70 dxf)) '(1 129)) ) (progn (initget 7) (TEXTPAGE) (PROMPT "\n select option :\n1. option1 \n2. option2 \n3.option3\n 4.option4 " ) (setq area (vlax-curve-getarea ent) option (getint "Select an option 1 to 4 : ") ) (cond ((= option 1) (_Option1)) ((= option 2) (_Option2)) ((= option 3) (_Option3)) ((= option 4) (_Option4)) (t (alert "if Select > 4 --> Default selection 4. ") (_Option4)) ) ) (princ "\nNo correct polyline ...") ) (princ) ) Thanks Edited October 13, 2022 by prodromosm Quote
Steven P Posted October 13, 2022 Posted October 13, 2022 (edited) try this: (defun txttonotepad ( txtlist / txtfile LFDES ) ;;creates list of LISPs to notepad (if (strcat (getvar "TEMPPREFIX") "txtlist.txt")(vl-file-delete (strcat (getvar "TEMPPREFIX") "txtlist.txt"))) ;;delete existing file (setq txtfile (strcat (getvar "TEMPPREFIX") "txtlist.txt")) ;;create new temp file (setq LFDES (open txtfile "w")) (foreach x txtlist (write-line x LFDES) ) (setq LFDES (close LFDES)) (if (findfile txtfile) (startapp "notepad" txtfile)) (if (not (findfile txtfile)) (princ "\nError writing file")) (princ) ) and the text sent to this is a list, each list item is a new line: For example: (txttonotepad (list "Item 1" "Item 2" "Item 3")) If you an modifiy your code to create a list from what is displayed in the command line it should work Edited October 13, 2022 by Steven P Quote
Guest Posted October 13, 2022 Posted October 13, 2022 Hi Steven P . Thanks for the replay for example i have this part of the code ((> area 2000) (setq sdarea (+ 400 ( * 0.05 (- area 2000))) skarea (* area 0.6) ) (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? p???f?st?µe t?? 1923 ( F?? 138/?/1981 )" "\n" "\n G?a peda " (rtos area 2 2) " t.µ > 2000 t.µ " "\n ?a???a?: " "\n ???s?p? ep? ?f?st?µe??? asdas??st?? (F?? 138/?/1981) / ?= 2000t.µ" "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) ) ) (princ (strcat "\n Area = " (rtos area 2 2) " t.µ" "\n Calc1 = " (rtos sdarea 2 2) " t.µ" "\n Calc2 = " (rtos skarea 2 2) " t.µ" ) ) ) how to change it? I write this for example ??????? ((> area 2000) (setq sdarea (+ 400 ( * 0.05 (- area 2000))) skarea (* area 0.6) ) (txttonotepad (list (princ (STRCAT "\n ?a?at???se??:" "\n -------------\n " "\n ??µ?s? se sµ??? p???f?st?µe t?? 1923 ( F?? 138/?/1981 )" "\n" "\n G?a peda " (rtos area 2 2) " t.µ > 2000 t.µ " "\n ?a???a?: " "\n ???s?p? ep? ?f?st?µe??? asdas??st?? (F?? 138/?/1981) / ?= 2000t.µ" "\n *** ???S??? st? d?µasdasa? p?d?? Sasdas??" "\n" "\n st? ??µ?s? - asdas." "\n --------------------------\n " ) ) (princ (strcat "\n Area = " (rtos area 2 2) " t.µ" "\n Calc1 = " (rtos sdarea 2 2) " t.µ" "\n Calc2 = " (rtos skarea 2 2) " t.µ" ) ) ) ; end list ) ; end txttonotepad Quote
mhupp Posted October 13, 2022 Posted October 13, 2022 (edited) Give this a try (setq F (open (setq txt (strcat (getenv "userprofile") "\\Documents\\TEXTFILE.TXT") "w"))) ;create a file and open it in write mode I think this will overide exisitng files of the same name (write-line "LINE YOU WANT TO OUTPUT1" F) ;OUTPUT TO TEXT FILE NO NEED FOR \n ... (write-line " " F) ;USE FOR BLANK LINES/SPACERS BETWEEN OUTPUT ... (write-line "LINE YOU WANT TO OUTPUT100" F) (close F) ;RELEASES FILE FROM AUTOCAD OR YOU CANT EDI/MOVE/DELETE THE FILE UNTIL AUTOCAD IS CLOSED (prompt (STRCAT "\N" F " HAS BEEN CREATED.")) ;PROMPT TO COMMANDLINE ABOUT FILE (startapp "NOTEPAD" txt) ;OPENS NEWLY CREATED FILE I suggest you write up the txt file how you want it outputted then copy that into the lisp and edit with the variables and such. Edited October 13, 2022 by mhupp Quote
Guest Posted October 13, 2022 Posted October 13, 2022 Hi mhupp. Thanks for the replay. I try to do the changes but i dont know how to write this part of the code. I am not sure if this the correct way !!!! (prompt (STRCAT "\n Area = " (rtos area 2 2) " sq.m" "\n Calc1 = " (rtos sdarea 2 2) " sq.m" "\n Calc1 = " (rtos skarea 2 2) " sq.m" F) ) I write a part of the code with 2 options only to show me the mistakes (defun c:test () (setq F (open (strcat (getenv "userprofile") "\\Documents\\TEXTFILE.TXT") "w")) (defun _option1 () (cond ( (< area 200) (setq sdarea area skarea (* area 0.7) ) (write-line ""\n -------------------------------------------\n "" F) ;OUTPUT TO TEXT FILE NO NEED FOR \n (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (close F);RELEASES FILE FROM AUTOCAD OR YOU CANT EDI/MOVE/DELETE THE FILE UNTIL AUTOCAD IS CLOSED ) ( (<= area 500) (setq sdarea 240 skarea (* area 0.6) ) (write-line ""\n -------------------------------------------\n "" F) ;OUTPUT TO TEXT FILE NO NEED FOR \n (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (close F);RELEASES FILE FROM AUTOCAD OR YOU CANT EDI/MOVE/DELETE THE FILE UNTIL AUTOCAD IS CLOSED ) ( (and (> area 500) (< area 700)) (setq sdarea 240 skarea (* area 0.6) ) (write-line ""\n -------------------------------------------\n "" F) ;OUTPUT TO TEXT FILE NO NEED FOR \n (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (close F);RELEASES FILE FROM AUTOCAD OR YOU CANT EDI/MOVE/DELETE THE FILE UNTIL AUTOCAD IS CLOSED ) ( (>= area 700) (setq sdarea 240 skarea (* area 0.6) ) (write-line ""\n -------------------------------------------\n "" F) ;OUTPUT TO TEXT FILE NO NEED FOR \n (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (close F);RELEASES FILE FROM AUTOCAD OR YOU CANT EDI/MOVE/DELETE THE FILE UNTIL AUTOCAD IS CLOSED ) (prompt (STRCAT "\n Area = " (rtos area 2 2) " sq.m" "\n Calc1 = " (rtos sdarea 2 2) " sq.m" "\n Calc1 = " (rtos skarea 2 2) " sq.m" F) ) (startapp "NOTEPAD" F) ;OPENS NEWLY CREATED FILE ) ); end defun option1 (defun _option2 () (cond ( (<= area 100) (setq sdarea (* area 1.60) skarea (* area 0.8) ) (write-line ""\n -------------------------------------------\n "" F) ;OUTPUT TO TEXT FILE NO NEED FOR \n (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (close F);RELEASES FILE FROM AUTOCAD OR YOU CANT EDI/MOVE/DELETE THE FILE UNTIL AUTOCAD IS CLOSED ) ( (and (> area 100) (<= area 200)) (setq sdarea (* area 1.20) skarea (* area (/ (* area 2) 160)) ) (write-line ""\n -------------------------------------------\n "" F) ;OUTPUT TO TEXT FILE NO NEED FOR \n (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (close F);RELEASES FILE FROM AUTOCAD OR YOU CANT EDI/MOVE/DELETE THE FILE UNTIL AUTOCAD IS CLOSED ) ( (and (> area 200) (<= area 300)) (setq sdarea (* area 1) ; dont change because the parametr 1 will be change skarea (* area 0.60) ) (write-line ""\n -------------------------------------------\n "" F) ;OUTPUT TO TEXT FILE NO NEED FOR \n (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (close F);RELEASES FILE FROM AUTOCAD OR YOU CANT EDI/MOVE/DELETE THE FILE UNTIL AUTOCAD IS CLOSED ) ( (and (> area 300) (<= area 2000)) (setq sdarea 400 skarea (* area 0.60) ) (write-line ""\n -------------------------------------------\n "" F) ;OUTPUT TO TEXT FILE NO NEED FOR \n (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (write-line ""\n -------------------------------------------\n "" F) (close F);RELEASES FILE FROM AUTOCAD OR YOU CANT EDI/MOVE/DELETE THE FILE UNTIL AUTOCAD IS CLOSED ) (prompt (STRCAT "\n Area = " (rtos area 2 2) " sq.m" "\n Calc1 = " (rtos sdarea 2 2) " sq.m" "\n Calc1 = " (rtos skarea 2 2) " sq.m" F) ) (startapp "NOTEPAD" F) ;OPENS NEWLY CREATED FILE ) ); end defun option2 ;; Main ----- (if (and (setq ent (car (entsel "\nselect close polyline : "))) (wcmatch (cdr (assoc 0 (setq dxf (entget ent)))) "*POLYLINE") (member (cdr (assoc 70 dxf)) '(1 129)) ) (progn (initget 7) (TEXTPAGE) (PROMPT "\n select option :\n1. option1 \n2. option2" ) (setq area (vlax-curve-getarea ent) option (getint "Select an option 1 to 2 : ") ) (cond ((= option 1) (_Option1)) ((= option 2) (_Option2)) ) ) (princ "\nNo correct polyline ...") ) (princ) ); end defun Thanks Quote
mhupp Posted October 13, 2022 Posted October 13, 2022 (edited) Two things Good use of cond but it will only run code that it matches with inside the cond statements. (cond ((cond #1) ;if above matches only run this code and exit cond ;if above matches only run this code and exit cond ) ((cond #2) ;if above matches only run this code and exit cond ;if above matches only run this code and exit cond ) (t ;noting matches only run this code and exit cond ;noting matches only run this code and exit cond ) ) 2nd don't close the txt file until your done writing to it. you have the close F in the cond but then try to write three more lines into a closed file. --edit here s a re-write of option 1. messed up the open notepad so that will work now too. When you run this lisp again the file will be over written with the new information. Also kinda off topic if you want your text files to always open in the same area look at this little addon developed by windows that allows "fancy zones" https://learn.microsoft.com/en-us/windows/powertoys/ Quote FancyZones is a window manager utility for arranging and snapping windows into efficient layouts to improve the speed of your workflow and restore layouts quickly. FancyZones allows you to define a set of zone locations to be used as targets for windows on your desktop. When you drag a window into a zone, or enter the associated keyboard shortcut, the window is resized and repositioned to fill that zone. (defun c:test (/ F txt) (setq F (open (setq txt (strcat (getenv "userprofile") "\\Documents\\TEXTFILE.TXT")) "w")) ;need to store path to txt file (defun _option1 () (cond ((< area 200) (setq sdarea area skarea (* area 0.7) ) (write-line "-------------------------------------------" F) (write-line "------------------AREA < 200---------------" F) (write-line "-------------------------------------------" F) (write-line "-------------------------------------------" F) ) ((<= area 500) (setq sdarea 240 skarea (* area 0.6) ) (write-line "-------------------------------------------" F) (write-line "-----------------AREA <= 500---------------" F) (write-line "-------------------------------------------" F) (write-line "-------------------------------------------" F) ) ((and (> area 500) (< area 700)) (setq sdarea 240 skarea (* area 0.6) ) (write-line "-------------------------------------------" F) (write-line "------------500 > AREA < 700---------------" F) (write-line "-------------------------------------------" F) (write-line "-------------------------------------------" F) ) ((>= area 700) (setq sdarea 240 skarea (* area 0.6) ) (write-line "-------------------------------------------" F) (write-line "------------------AREA >=700---------------" F) (write-line "-------------------------------------------" F) (write-line "-------------------------------------------" F) ) ) (write-line (strcat "Area = " (rtos area 2 2) " sq.m") F) (write-line (strcat "Calc1 = " (rtos sdarea 2 2) " sq.m") F) (write-line (strcat "Calc1 = " (rtos skarea 2 2) " sq.m") F) (close F) ;RELEASES FILE FROM AUTOCAD OR YOU CANT EDI/MOVE/DELETE THE FILE UNTIL AUTOCAD IS CLOSED (startapp "NOTEPAD" txt) ;OPENS NEWLY CREATED FILE ) ; end defun option1 ;; Main ----- (if (and (setq ent (car (entsel "\nselect close polyline : "))) (wcmatch (cdr (assoc 0 (setq dxf (entget ent)))) "*POLYLINE") (member (cdr (assoc 70 dxf)) '(1 129)) ) (progn (initget 7) (setq area (vlax-curve-getarea ent)) (initget "1 2") (setq opt (cond ((getkword "\nOption [1] or 2: ")) ("1") ;defult answer allows you to right click/enter ) ) (cond ((= opt "1") (_Option1)) ((= opt "2") (_Option2)) ) ) (princ "\nNo correct polyline ...") ) (princ) ) Edited October 13, 2022 by mhupp Quote
Guest Posted October 13, 2022 Posted October 13, 2022 Thanks mhupp . I will try to write the full code with the 4 options. Thanks Quote
Guest Posted October 13, 2022 Posted October 13, 2022 Hi mhupp. I am trying to change the path from documends to temp, and i have a little problem. Can you help ? Thanks ; (setq F (open (setq txt (strcat (getenv "userprofile") "\\Documents\\TEXTFILE.TXT")) "w")) ;need to store path to txt file (if (strcat (getvar "TEMPPREFIX") "TEXTFILE.TXT")(vl-file-delete (strcat (getvar "TEMPPREFIX") "TEXTFILE.TXT"))) ;;delete existing file (setq F (strcat (getvar "TEMPPREFIX") "TEXTFILE.TXT")) (setq txt (open txtfile "w")) Quote
mhupp Posted October 13, 2022 Posted October 13, 2022 http://docs.autodesk.com/ACDMAC/2014/ENU/index.html?url=files/GUID-089A323F-21FF-4337-99A9-375758E23BA4.htm,topicNumber=d30e367016 The "w" mode in open function overwrites whats ever in the text file so you don't need to check/delete the file if its there already. (setq F (open (setq txt (strcat (getvar "TEMPPREFIX") "TEXTFILE.TXT") "w")) "F" is needed for passing the write-line to and looks something like this #<file "c:/path/textfile.txt"> this wont work with the startapp function so "txt" is just the path of the file itself witch does work. "c:/path/textfile.txt" As long as the folders themselves exist you can hard code the path you want to use (setq F (open (setq txt "c:/path/textfile.txt") "w")) Quote
Steven P Posted October 14, 2022 Posted October 14, 2022 8 hours ago, mhupp said: The "w" mode in open function overwrites whats ever in the text file so you don't need to check/delete the file if its there already. I had a problem with one of my LISPs that was freezing, one of the things I did was delete the temp file (it made DCL box), and solved it, so I tend to do this by default now. My thinking at the time was that the text file wasn't properly closed - so deleting it did that for me (my thinking was probably wrong of course) - even though there should be no need to delete the file normally 1 Quote
mhupp Posted October 14, 2022 Posted October 14, 2022 One of my bosses lisp keeps making a temp dcl file every time you use the command but doesn't delete it. So in my temp folder I got 1000's of 3kb dcl file. If you don't want to keep the txt file just put the delete command at the end of the lisp or after the open command. So its only there while the lisp is running. then you don't have to check for it when you run the lisp again. 1 Quote
Guest Posted October 14, 2022 Posted October 14, 2022 I delete very often all the temp files using %TEMP% command Quote
Steven P Posted October 14, 2022 Posted October 14, 2022 6 minutes ago, mhupp said: One of my bosses lisp keeps making a temp dcl file every time you use the command but doesn't delete it. So in my temp folder I got 1000's of 3kb dcl file. If you don't want to keep the txt file just put the delete command at the end of the lisp or after the open command. So its only there while the lisp is running. then you don't have to check for it when you run the lisp again. In my case I think the problem was caused by escaping out of the LISP command (it doesn't have error checking). I'd be tempted to sneak into your bosses LISP and changing it about a bit! 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.