Author Topic: Dimension cross section and long section- Help with a lisp  (Read 1662 times)

0 Members and 1 Guest are viewing this topic.

PM

  • Guest
Dimension cross section and long section- Help with a lisp
« on: March 27, 2020, 09:45:40 AM »
Hi am using this two codes to dimesion long sections and cross sections. It the same code wit few differences (like text heiht and an elevetion scale for the longsections) . I put them in the same lisp  file  but when i run the they confused and when i run vd runs vv because they are same less or more. Can any one help me to put them in one file and work properly?

Thanks

Code - Auto/Visual Lisp: [Select]
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;                                                            ;
  3. ;                   for cross sections             ;
  4. ;                                                           ;
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6.  
  7.  
  8. (defun ERR (S)
  9.   (if (= S "Function cancelled")
  10.     (princ "\nVERTEXT - cancelled: ")
  11.     (progn (princ "\nVERTEXT - Error: ") (princ S) (terpri))
  12.   )
  13.   (RESETTING)
  14.   (princ "SYSTEM VARIABLES have been reset\n")
  15.   (princ)
  16. )
  17. (defun SETV (SYSTVAR NEWVAL)
  18.   (setq X (read (strcat SYSTVAR "1")))
  19.   (set X (getvar SYSTVAR))
  20.   (setvar SYSTVAR NEWVAL)
  21. )
  22. (defun SETTING ()
  23.   (setq OERR *ERROR*)
  24.   (setq *ERROR* ERR)
  25.   (SETV "CMDECHO" 0)
  26.   (SETV "BLIPMODE" 0)
  27. )
  28. (defun RSETV (SYSTVAR)
  29.   (setq X (read (strcat SYSTVAR "1")))
  30.   (setvar SYSTVAR (eval X))
  31. )
  32.  
  33. (defun RESETTING ()
  34.   (RSETV "CMDECHO")
  35.   (RSETV "BLIPMODE")
  36.   (setq *ERROR* OERR)
  37. )
  38.  
  39.  
  40. (defun DXF (CODE ENAME) (cdr (assoc CODE (entget ENAME)))) ; dxf
  41.  
  42. (defun VERTEXT (/ EN VLIST)
  43.   (setq EN (GET-EN))
  44.   (if (= (DXF 0 EN) "LWPOLYLINE")
  45.     (setq VLIST (GET-LWVLIST EN))
  46.     (setq VLIST (GET-PLVLIST EN))
  47.   )
  48.   (WRITE-IT VLIST EN)
  49. )
  50.  
  51. (defun GET-EN (/ NO-ENT EN MSG1 MSG2)
  52.   (setq NO-ENT 1
  53.         EN     NIL
  54.         MSG1   "\nselect a polyline: "
  55.         MSG2   "\nTry again !!!."
  56.   )                                     ; setq
  57.   (while NO-ENT
  58.     (setq EN (car (entsel MSG1)))
  59.     (if (and EN
  60.              (or (= (DXF 0 EN) "LWPOLYLINE") (= (DXF 0 EN) "POLYLINE"))
  61.                                         ; or
  62.         )                               ; and
  63.       (progn (setq NO-ENT NIL))         ; progn
  64.       (prompt MSG2)
  65.     )                                   ; if
  66.   )                                     ; while
  67.   EN
  68. )                                       ; get-en
  69.  
  70. (defun GET-LWVLIST (EN / ELIST NUM-VERT VLIST)
  71.   (setq ELIST    (entget EN)
  72.         NUM-VERT (cdr (assoc 90 ELIST))
  73.         ELIST    (member (assoc 10 ELIST) ELIST)
  74.         VLIST    NIL
  75.   )                                     ; setq
  76.   (repeat NUM-VERT
  77.     (setq VLIST (append VLIST (list (cdr (assoc 10 ELIST)))) ; append
  78.     )                                   ; setq
  79.     (setq ELIST (cdr ELIST)
  80.           ELIST (member (assoc 10 ELIST) ELIST)
  81.     )                                   ; setq
  82.   )                                     ; repeat
  83.   VLIST
  84. )                                       ; get-lwvlist
  85.  
  86. (defun GET-PLVLIST (EN / VLIST)
  87.   (setq VLIST NIL
  88.         EN    (entnext EN)
  89.   )                                     ; setq
  90.   (while (/= "SEQEND" (DXF 0 EN))
  91.     (setq VLIST (append VLIST (list (DXF 10 EN))))
  92.     (setq EN (entnext EN))
  93.   )                                     ; while
  94.   VLIST
  95. )                                       ; get-plvlist
  96.  
  97. (defun WRITE-IT (VLST EN / NEWVLIST MSG3 FNAME)
  98.   (setq NEWVLIST (mapcar '(lambda (X) (trans X EN 0)) ;_ lambda
  99.                          VLST
  100.                  ) ;_ mapcar
  101.         MSG3     "Polyline vertex file"
  102.                                         ;FNAME    (getfiled MSG3 "" "txt" 1)
  103.         F1       (open "FNAME" "w")
  104.   )                                     ; setq
  105.   (WRITE-HEADER)
  106.   (WRITE-VERTICES NEWVLIST)
  107.   (setq F1 (close F1))
  108. ) ;_ write-it
  109.  
  110. (defun WRITE-HEADER (/ STR)
  111.   (setq STR "        POLYLINE VERTEX POINTS")
  112.   (write-line STR F1)
  113.   (setq STR (strcat "  X            " "  Y            " "  Z") ;_ strcat
  114.   ) ;_ setq
  115.   (write-line STR F1)
  116. ) ;_ write-header
  117.  
  118.  
  119. (defun WRITE-VERTICES (NEWVLIST / XSTR YSTR ZSTR STR l)
  120.    (setvar 'OSMODE  0)
  121.            (initget "1 2")
  122.            (setq
  123.              l
  124.               (cond
  125.                 ((getkword
  126.                    "\nfro ground1 (1)/ for ground2 (2) < 1 > :"
  127.                  )
  128.                 )
  129.                 ("1")
  130.               )
  131.            )
  132.        
  133. (if (eq l "1")
  134.         (COMMAND "_layer" "_m" "ground1" "_c" "94" "" "")
  135.        )
  136.        (if (eq l "2")
  137.         (COMMAND "_layer" "_m" "ground2" "_c" "10" "" "")
  138.            )
  139. )
  140.   (setq httt "0.36")
  141.   (setq gptx (getpoint "\npoint to insert lenghts: "))
  142.   (setq gpty (getpoint "\npoint to insert elevetion: "))
  143.   (foreach ITEM NEWVLIST
  144.     (setq XSTR (rtos (nth 0 ITEM) 2 2)
  145.           YSTR (rtos (nth 1 ITEM) 2 2)
  146.           ZSTR (rtos (nth 2 ITEM) 2 2)
  147.           STR  (strcat XSTR (SPACES XSTR) YSTR (SPACES YSTR) ZSTR) ;_ strcat
  148.     )                                   ; setq
  149.                                         ;      (write-line STR F1)
  150.  
  151.  
  152.  (command "style" "PMSF-TEXT 2" "Arial" "" "" "" "" "")
  153.     (command "text" "_mc"
  154.              (list (+ (atof xstr) (/ (atof httt) 2.0)) (cadr gptx))
  155.              httt
  156.              "0"
  157.              (strcat xstr)
  158.     )
  159.     (command "text" "_mc"
  160.              (list (+ (atof xstr) (/ (atof httt) 2.0)) (cadr gpty))
  161.              httt
  162.              "0"
  163.              (strcat ystr)
  164.     )
  165.  
  166.   )                                     ; foreach
  167.  
  168. )                                       ; write-vertices
  169.  
  170.  
  171. (defun SPACES (STR / FIELD NUM CHAR SPACE)
  172.   (setq FIELD 15
  173.         NUM   (- FIELD (strlen STR))
  174.         CHAR  " "
  175.         SPACE ""
  176.   ) ;_ setq
  177.   (repeat NUM (setq SPACE (strcat SPACE CHAR))) ;_ repeat
  178. ) ;_ spaces
  179.  
  180. (defun C:vd () (SETTING) (VERTEXT) (RESETTING) (princ)) ; c:nsl
  181.  
  182.  
  183.  
  184. (prompt "\nEnter VD to start")
  185.  
  186. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  187. ;                                                ;
  188. ;                 for ling sections             ;
  189. ;                                                ;
  190. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  191.  
  192.  
  193. (defun ERR (S)
  194.   (if (= S "Function cancelled")
  195.     (princ "\nVERTEXT - cancelled: ")
  196.     (progn (princ "\nVERTEXT - Error: ") (princ S) (terpri))
  197.   )
  198.   (RESETTING)
  199.   (princ "SYSTEM VARIABLES have been reset\n")
  200.   (princ)
  201. )
  202. (defun SETV (SYSTVAR NEWVAL)
  203.   (setq X (read (strcat SYSTVAR "1")))
  204.   (set X (getvar SYSTVAR))
  205.   (setvar SYSTVAR NEWVAL)
  206. )
  207. (defun SETTING ()
  208.   (setq OERR *ERROR*)
  209.   (setq *ERROR* ERR)
  210.   (SETV "CMDECHO" 0)
  211.   (SETV "BLIPMODE" 0)
  212. )
  213. (defun RSETV (SYSTVAR)
  214.   (setq X (read (strcat SYSTVAR "1")))
  215.   (setvar SYSTVAR (eval X))
  216. )
  217.  
  218. (defun RESETTING ()
  219.   (RSETV "CMDECHO")
  220.   (RSETV "BLIPMODE")
  221.   (setq *ERROR* OERR)
  222. )
  223.  
  224.  
  225. (defun DXF (CODE ENAME) (cdr (assoc CODE (entget ENAME)))) ; dxf
  226.  
  227. (defun VERTEXT (/ EN VLIST)
  228.   (setq EN (GET-EN))
  229.   (if (= (DXF 0 EN) "LWPOLYLINE")
  230.     (setq VLIST (GET-LWVLIST EN))
  231.     (setq VLIST (GET-PLVLIST EN))
  232.   )
  233.   (WRITE-IT VLIST EN)
  234. )
  235.  
  236. (defun GET-EN (/ NO-ENT EN MSG1 MSG2)
  237.   (setq NO-ENT 1
  238.         EN     NIL
  239.         MSG1   "\nselect a polyline: "
  240.         MSG2   "\ntry again !!!!!"
  241.   )                                     ; setq
  242.   (while NO-ENT
  243.     (setq EN (car (entsel MSG1)))
  244.     (if (and EN
  245.              (or (= (DXF 0 EN) "LWPOLYLINE") (= (DXF 0 EN) "POLYLINE"))
  246.                                         ; or
  247.         )                               ; and
  248.       (progn (setq NO-ENT NIL))         ; progn
  249.       (prompt MSG2)
  250.     )                                   ; if
  251.   )                                     ; while
  252.   EN
  253. )                                       ; get-en
  254.  
  255. (defun GET-LWVLIST (EN / ELIST NUM-VERT VLIST)
  256.   (setq ELIST    (entget EN)
  257.         NUM-VERT (cdr (assoc 90 ELIST))
  258.         ELIST    (member (assoc 10 ELIST) ELIST)
  259.         VLIST    NIL
  260.   )                                     ; setq
  261.   (repeat NUM-VERT
  262.     (setq VLIST (append VLIST (list (cdr (assoc 10 ELIST)))) ; append
  263.     )                                   ; setq
  264.     (setq ELIST (cdr ELIST)
  265.           ELIST (member (assoc 10 ELIST) ELIST)
  266.     )                                   ; setq
  267.   )                                     ; repeat
  268.   VLIST
  269. )                                       ; get-lwvlist
  270.  
  271. (defun GET-PLVLIST (EN / VLIST)
  272.   (setq VLIST NIL
  273.         EN    (entnext EN)
  274.   )                                     ; setq
  275.   (while (/= "SEQEND" (DXF 0 EN))
  276.     (setq VLIST (append VLIST (list (DXF 10 EN))))
  277.     (setq EN (entnext EN))
  278.   )                                     ; while
  279.   VLIST
  280. )                                       ; get-plvlist
  281.  
  282. (defun WRITE-IT (VLST EN / NEWVLIST MSG3 FNAME)
  283.   (setq NEWVLIST (mapcar '(lambda (X) (trans X EN 0)) ;_ lambda
  284.                          VLST
  285.                  ) ;_ mapcar
  286.         MSG3     "Polyline vertex file"
  287.                                         ;FNAME    (getfiled MSG3 "" "txt" 1)
  288.         F1       (open "FNAME" "w")
  289.   )                                     ; setq
  290.   (WRITE-HEADER)
  291.   (WRITE-VERTICES NEWVLIST)
  292.   (setq F1 (close F1))
  293. ) ;_ write-it
  294.  
  295. (defun WRITE-HEADER (/ STR)
  296.   (setq STR "        POLYLINE VERTEX POINTS")
  297.   (write-line STR F1)
  298.   (setq STR (strcat "  X            " "  Y            " "  Z") ;_ strcat
  299.   ) ;_ setq
  300.   (write-line STR F1)
  301. ) ;_ write-header
  302.  
  303.  
  304. (defun WRITE-VERTICES (NEWVLIST / XSTR YSTR ZSTR STR)
  305.    (setvar 'OSMODE 0)
  306.            (initget "1 2")
  307.            (setq
  308.              l
  309.               (cond
  310.                 ((getkword
  311.                    "\ngor ground (1)/ for ground (2) < 1 > :"
  312.                  )
  313.                 )
  314.                 ("1")
  315.               )
  316.            )
  317.        
  318. (if (eq l "1")
  319.         (COMMAND "_layer" "_m" "ground1" "_c" "94" "" "")
  320.        )
  321.        (if (eq l "2")
  322.         (COMMAND "_layer" "_m" "ground2" "_c" "10" "" "")
  323.            )
  324. )
  325.   (setq httt "1.80")
  326.   (setq gptx (getpoint "\n point for dimensions for the begining ...: "))
  327.   (setq gpty (getpoint "\n point for elevetions ... "))
  328.  
  329.   (foreach ITEM NEWVLIST
  330.     (setq XSTR (rtos (nth 0 ITEM) 2 2)
  331.           YSTR (rtos (/ (nth 1 ITEM) 10) 2 2) ; &#948;&#953;&#945;&#953;&#961;&#969; &#948;&#953;&#945; 10
  332.           ZSTR (rtos (nth 2 ITEM) 2 2)
  333.           STR  (strcat XSTR (SPACES XSTR) YSTR (SPACES YSTR) ZSTR) ;_ strcat
  334.     )                                   ; setq
  335.                                         ;      (write-line STR F1)
  336.  
  337.  (command "style" "PMSF-TEXT 2" "Arial" "" "" "" "" "")
  338.     (command "text" "_mc"
  339.              (list (+ (atof xstr) (/ (atof httt) 2.0)) (cadr gptx))
  340.              httt
  341.              "0"
  342.              (strcat xstr)
  343.     )
  344.     (command "text" "_mc"
  345.              (list (+ (atof xstr) (/ (atof httt) 2.0)) (cadr gpty))
  346.              httt
  347.              "0"
  348.              (strcat ystr)
  349.     )
  350.  
  351.   )                                     ; foreach
  352.  
  353. )                                       ; write-vertices
  354.  
  355.  
  356. (defun SPACES (STR / FIELD NUM CHAR SPACE)
  357.   (setq FIELD 15
  358.         NUM   (- FIELD (strlen STR))
  359.         CHAR  " "
  360.         SPACE ""
  361.   ) ;_ setq
  362.   (repeat NUM (setq SPACE (strcat SPACE CHAR))) ;_ repeat
  363. ) ;_ spaces
  364.  
  365. (defun C:vv () (SETTING) (VERTEXT) (RESETTING) (princ)) ; c:nsl
  366.  
  367.  
  368. (prompt "\nEnter VV to start")
  369.  
  370.  

kpblc

  • Bull Frog
  • Posts: 396
Re: Dimension cross section and long section- Help with a lisp
« Reply #1 on: March 27, 2020, 10:19:51 AM »
Use unique function names. Another way is to use call parameters. As example:
Code - Auto/Visual Lisp: [Select]
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2.           ;                                                            ;
  3.           ;                   for cross sections             ;
  4.           ;                                                           ;
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6.  
  7.  
  8. (defun err (s)
  9.   (if (= s "Function cancelled")
  10.     (princ "\nVERTEXT - cancelled: ")
  11.     (progn (princ "\nVERTEXT - Error: ") (princ s) (terpri))
  12.     ) ;_ end of if
  13.   (resetting)
  14.   (princ "SYSTEM VARIABLES have been reset\n")
  15.   (princ)
  16.   ) ;_ end of defun
  17. (defun setv (systvar newval)
  18.   (setq x (read (strcat systvar "1")))
  19.   (set x (getvar systvar))
  20.   (setvar systvar newval)
  21.   ) ;_ end of defun
  22. (defun setting () (setq oerr *error*) (setq *error* err) (setv "CMDECHO" 0) (setv "BLIPMODE" 0))
  23. (defun rsetv (systvar) (setq x (read (strcat systvar "1"))) (setvar systvar (eval x)))
  24.  
  25. (defun resetting () (rsetv "CMDECHO") (rsetv "BLIPMODE") (setq *error* oerr))
  26.  
  27.  
  28. (defun dxf (code ename) (cdr (assoc code (entget ename)))) ; dxf
  29.  
  30. (defun vertext (mode / en vlist)
  31.   (setq en (get-en))
  32.   (if (= (dxf 0 en) "LWPOLYLINE")
  33.     (setq vlist (get-lwvlist en))
  34.     (setq vlist (get-plvlist en))
  35.     ) ;_ end of if
  36.   (write-it vlist en mode)
  37.   ) ;_ end of defun
  38.  
  39. (defun get-en (/ no-ent en msg1 msg2)
  40.   (setq no-ent 1
  41.         en     nil
  42.         msg1   "\nselect a polyline: "
  43.         msg2   "\nTry again !!!."
  44.         ) ; setq
  45.   (while no-ent
  46.     (setq en (car (entsel msg1)))
  47.     (if (and en
  48.              (or (= (dxf 0 en) "LWPOLYLINE") (= (dxf 0 en) "POLYLINE")) ; or
  49.              ) ; and
  50.       (progn (setq no-ent nil)) ; progn
  51.       (prompt msg2)
  52.       )   ; if
  53.     )     ; while
  54.   en
  55.   )       ; get-en
  56.  
  57. (defun get-lwvlist (en / elist num-vert vlist)
  58.   (setq elist    (entget en)
  59.         num-vert (cdr (assoc 90 elist))
  60.         elist    (member (assoc 10 elist) elist)
  61.         vlist    nil
  62.         ) ; setq
  63.   (repeat num-vert
  64.     (setq vlist (append vlist (list (cdr (assoc 10 elist)))) ; append
  65.           ) ; setq
  66.     (setq elist (cdr elist)
  67.           elist (member (assoc 10 elist) elist)
  68.           ) ; setq
  69.     )     ; repeat
  70.   vlist
  71.   )       ; get-lwvlist
  72.  
  73. (defun get-plvlist (en / vlist)
  74.   (setq vlist nil
  75.         en    (entnext en)
  76.         ) ; setq
  77.   (while (/= "SEQEND" (dxf 0 en))
  78.     (setq vlist (append vlist (list (dxf 10 en))))
  79.     (setq en (entnext en))
  80.     )     ; while
  81.   vlist
  82.   )       ; get-plvlist
  83.  
  84. (defun write-it (vlst en mode / newvlist msg3 fname)
  85.   (setq newvlist (mapcar '(lambda (x) (trans x en 0)) ;_ lambda
  86.                          vlst
  87.                          ) ;_ mapcar
  88.         msg3     "Polyline vertex file" ;FNAME    (getfiled MSG3 "" "txt" 1)
  89.         f1       (open "FNAME" "w")
  90.         ) ; setq
  91.   (write-header)
  92.   (write-vertices newvlist mode)
  93.   (setq f1 (close f1))
  94.   ) ;_ write-it
  95.  
  96. (defun write-header (/ str)
  97.   (setq str "        POLYLINE VERTEX POINTS")
  98.   (write-line str f1)
  99.   (setq str (strcat "  X            " "  Y            " "  Z") ;_ strcat
  100.         ) ;_ setq
  101.   (write-line str f1)
  102.   ) ;_ write-header
  103.  
  104.  
  105. (defun write-vertices (newvlist mode / xstr ystr zstr str l)
  106.   (setvar 'osmode 0)
  107.   (progn (initget "1 2")
  108.          (setq l (cond ((getkword "\nfro ground1 (1)/ for ground2 (2) < 1 > :"))
  109.                        ("1")
  110.                        ) ;_ end of cond
  111.                ) ;_ end of setq
  112.          (if (eq l "1")
  113.            (command "_layer" "_m" "ground1" "_c" "94" "" "")
  114.            ) ;_ end of if
  115.          (if (eq l "2")
  116.            (command "_layer" "_m" "ground2" "_c" "10" "" "")
  117.            ) ;_ end of if
  118.          ) ;_ end of progn
  119.   (setq httt (if mode
  120.                "0.36"
  121.                "1.80"
  122.                ) ;_ end of if
  123.         ) ;_ end of setq
  124.   (setq gptx (getpoint "\npoint to insert lenghts: "))
  125.   (setq gpty (getpoint "\npoint to insert elevetion: "))
  126.   (foreach item newvlist
  127.     (setq xstr (rtos (nth 0 item) 2 2)
  128.           ystr (rtos (nth 1 item) 2 2)
  129.           zstr (rtos (nth 2 item) 2 2)
  130.           str  (strcat xstr (spaces xstr) ystr (spaces ystr) zstr) ;_ strcat
  131.           ) ; setq
  132.           ;      (write-line STR F1)
  133.     (command "style" "PMSF-TEXT 2" "Arial" "" "" "" "" "")
  134.     (command "text" "_mc" (list (+ (atof xstr) (/ (atof httt) 2.0)) (cadr gptx)) httt "0" (strcat xstr))
  135.     (command "text" "_mc" (list (+ (atof xstr) (/ (atof httt) 2.0)) (cadr gpty)) httt "0" (strcat ystr))
  136.     )     ; foreach
  137.   )       ; write-vertices
  138.  
  139.  
  140. (defun spaces (str / field num char space)
  141.   (setq field 15
  142.         num   (- field (strlen str))
  143.         char  " "
  144.         space ""
  145.         ) ;_ setq
  146.   (repeat num (setq space (strcat space char))) ;_ repeat
  147.   ) ;_ spaces
  148.  
  149. (defun c:vd () (setting) (vertext t) (resetting) (princ)) ; c:nsl
  150. (defun c:vv () (setting) (vertext nil) (resetting) (princ))
  151.  
  152.  
  153. (prompt ""\nEnter VV or VD to start")
I didn't check how it works. It's only sample.
Sorry for my English.

PM

  • Guest
Re: Dimension cross section and long section- Help with a lisp
« Reply #2 on: March 27, 2020, 12:06:25 PM »
Thank you kpblc but in long sectrions divide Y by 10. Can you add this change ?
Thanks

Code - Auto/Visual Lisp: [Select]
  1.  (setq XSTR (rtos (nth 0 ITEM) 2 2)
  2.           YSTR (rtos (/ (nth 1 ITEM) 10) 2 2)
  3.  

PM

  • Guest
Re: Dimension cross section and long section- Help with a lisp
« Reply #3 on: March 27, 2020, 01:21:09 PM »
any other options?

kpblc

  • Bull Frog
  • Posts: 396
Re: Dimension cross section and long section- Help with a lisp
« Reply #4 on: March 27, 2020, 01:36:34 PM »
Thank you kpblc but in long sectrions divide Y by 10. Can you add this change ?
Thanks

Code - Auto/Visual Lisp: [Select]
  1.  (setq XSTR (rtos (nth 0 ITEM) 2 2)
  2.           YSTR (rtos (/ (nth 1 ITEM) 10) 2 2)
  3.  
At what function? In case I've got some time and power I'd rewrite all this code. And I think you can do it by yourself :)
Sorry for my English.

PM

  • Guest
Re: Dimension cross section and long section- Help with a lisp
« Reply #5 on: March 27, 2020, 03:06:52 PM »
Hi  kpblc. Thank you for the replay.I dont know how to do it. Can you fix it?. Thanks

T.Willey

  • Needs a day job
  • Posts: 5251
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

PM

  • Guest
Re: Dimension cross section and long section- Help with a lisp
« Reply #7 on: March 28, 2020, 03:57:24 AM »
Hi T.Willey . Thank you for the replay. I realy have problem and i dont know how to fix it. I want in the same code to join two lisp codes with the diferent

1) in text height (that is fixed in the treviow post) by kpblc
2) the scale  by 10 in y axis because we have a long section with 2 scales

Code - Auto/Visual Lisp: [Select]
  1.  
  2. ; cross sectins
  3.  
  4.  (setq xstr (rtos (nth 0 item) 2 2)
  5.           ystr (rtos (nth 1 item) 2 2)
  6.           zstr (rtos (nth 2 item) 2 2)
  7.           str  (strcat xstr (spaces xstr) ystr (spaces ystr) zstr) ;_ strcat
  8.           ) ; setq
  9.  
  10. ; long sectins
  11.  
  12.  (setq xstr (rtos (nth 0 item) 2 2)
  13.          ystr (rtos (/ (nth 1 item) 10) 2 2)
  14.           zstr (rtos (nth 2 item) 2 2)
  15.           str  (strcat xstr (spaces xstr) ystr (spaces ystr) zstr) ;_ strcat
  16.           ) ; setq
  17.  
  18.  


Thanks

PM

  • Guest
Re: Dimension cross section and long section- Help with a lisp
« Reply #8 on: March 28, 2020, 05:39:20 AM »
ok i fix it

Code - Auto/Visual Lisp: [Select]
  1.         (setq xstr (rtos (nth 0 item) 2 2)
  2.               ystr (rtos (/ (nth 1 item) scf) 2 2)
  3.               zstr (rtos (nth 2 item) 2 2)
  4.               str  (strcat xstr (spaces xstr) ystr (spaces ystr) zstr) ;_ strcat
  5.               ) ; setq
  6.  

Code - Auto/Visual Lisp: [Select]
  1. (defun c:vd ()
  2.   (setq scf 1)
  3.   (setting)
  4.   (vertext t)
  5.   (resetting)
  6.   (princ)
  7. )                                       ; c:nsl
  8. (defun c:vv ()
  9.   (setq scf 10)
  10.   (setting)
  11.   (vertext nil)
  12.   (resetting)
  13.   (princ)
  14. )
  15.  


Thanks