Author Topic: how can i use this lisp through a script file  (Read 1136 times)

0 Members and 1 Guest are viewing this topic.

ah.nabil

  • Guest
how can i use this lisp through a script file
« on: August 05, 2016, 02:53:06 AM »
hey every one this is my first time to post in this forum i couldnt find any answer any where so plz answer if u can

i have a lisp am using to draw column sections with it's rebar arrangement and dimensions now i have a project with 200 columns so i want to use a script file to use the lisp throughout the order of script to draw more than 1 column i wrote what i need in a script file but i got stuck in the middle of the lisp routine it did open the lisp but it didnt finish the work i found that it just did some of the routine not all of it ????????? i cant find a solution anyone can help?
this is the lisp
;; a sample program for drawing reinforcing bars
;;

(defun c:colsec()

(setq g 0)
(while (= g 0)
(princ "\n get origin point please")

(setq n1 (getpoint ))
(setq x0 (car n1))
(setq y0 (cadr n1))

(setq x (getreal" \n width please ?"))
(setq y (getreal" \n height please ?"))
(SETQ X1 ( + X0 X))
(SETQ Y1 ( + Y0 Y))
(SETQ N2 (LIST X1 Y0))
(SETQ N3 (LIST X1 Y1))
(SETQ N4 (LIST X0 Y1))


(COMMAND "TEXT" C1 "" TT "")
(SETVAR "OSMODE" 0)
(COMMAND "PLINE" N1 "w" 0 0 N2 N3 N4 N1 "")

(if (> x 0.0) (progn (setq dx (+ x0 0.025)) (setq fx( - x1 0.025)))
(progn (setq dx (- x0 0.025)) (setq fx( + x1 0.025)))
)

(if (> y 0.0) (progn (setq dy (+ y0 0.025)) (setq fy( - y1 0.025)) )
(progn (setq dy (- y0 0.025)) (setq fy( + y1 0.025)) )
)

(SETQ Nn0 (LIST dx dy))
(SETQ Nn1 (LIST fx dy))
(SETQ Nn2 (LIST fx fy))
(SETQ Nn3 (LIST dx fy))

(COMMAND "PLINE" Nn0 "w" 0 0 Nn1 Nn2 Nn3 Nn0 "")

(princ "\n get horizontal dimension location please")
(setq nx (getpoint ))

(command "dimlinear" n1 n2 nx)


(princ "\n get vertical dimension location please")
(setq ny (getpoint ))

(command "dimlinear" n1 n4 ny)

(setq numx (getint" \n Number of bars top & Bottom"))
(setq numy (getint" \n Number of SIDE bars"))
(setq nusx (getint" \n Number of verticaL BRANCHES"))
(setq nusy (getint" \n Number of horizontAL BRANCHES"))

(setq v 0)
(while (= v 0)
(setq sdx(+ dx 0.0175))
(setq sfx(- fx 0.0175))
(setq sdy(+ dy 0.0175))
(setq sfy(- fy 0.0175))
(SETQ Nb (LIST sdx sdy))
(SETQ Nb1 (LIST sfx sdy))
(SETQ Nb2 (LIST sdx sfy))
(SETQ Nb3 (LIST sfx sfy))
(setq xx (- sfx sdx))
(setq deltax (/ xx (- numx 1) ))

(setq vv 0)
(SETQ I 0)
(while (= vv 0)
(SETQ I ( + I 1))
(IF (= I (- NUMX 1)) (SETQ VV 1))
(setq dx (* deltax i))
(SETQ XX (+ DX SDX))
(SETQ Nxb (LIST XX sdy))
(SETQ Nxb1 (LIST XX sfy))

(command "donut" 0.0 0.035 nXb nXb1 "")

)   
(setq xx (- sfx sdx))
(setq deltax (/ xx (- nusx 1) ))

(setq vv 0)
(SETQ I 0)
(while (= vv 0)
(SETQ I ( + I 1))
(IF (= I (- NUsX 1)) (SETQ VV 1))
(setq dx (* deltax i))
(SETQ XX (+ DX SDX))
(setq xx (+ xx 0.0175))
(SETQ Nxb (LIST XX sdy))
(SETQ Nxb1 (LIST XX sfy))

(command "line" nXb nXb1 "")

)   

(setq yy (- sfy sdy))
(setq deltay (/ yy (- nusy 1) ))

(setq vv 0)
(SETQ I 0)
(while (= vv 0)
(SETQ I ( + I 1))
(IF (= I (- NUsy 1)) (SETQ VV 1))
(setq dy (* deltay i))
(SETQ yy (+ Dy SDy))
(setq yy (+ yy 0.0175))
(SETQ Nxb (LIST sdX yy))
(SETQ Nxb1 (LIST sfX yy))

(command "line" nXb nXb1 "")

)   


(setq yy (- sfy sdy))
(setq deltay (/ yy (+ numy 1) ))

(setq vv 0)
(SETQ I 0)
(while (= vv 0)
(SETQ I ( + I 1))
(IF (= I NUMy) (SETQ VV 1))
(setq dy (* deltay i))
(SETQ yy (+ Dy SDy))
(SETQ Nxb (LIST sdx yy))
(SETQ Nxb1 (LIST sfX yy))

(command "donut" 0.0 0.035 nXb nXb1 "")

)   

(command "donut" 0.0 0.035 nb nb1 nb2 nb3 "")

(setq v 1)
)
)



)
« Last Edit: August 05, 2016, 03:09:07 AM by ah.nabil »

Peter2

  • Swamp Rat
  • Posts: 654
Re: how can i use this lisp through a script file
« Reply #1 on: August 05, 2016, 02:14:43 PM »
The problem seem to be in this code:
Code: [Select]
         (command "_TEXT" C1 "" TT "")C1 and TT are unknown (have no values). The other code seem to work.


PS:
Please try to use some punctuation in your posting. A rather long sentence with no commas, no dots is hard to read and to understand ...
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23