Centripetal
2012-03-24, 02:41 AM
Thank you for showing your interest in helping me with my programming dilemma.
I am trying to write a program that will draw a rectangle, of certain max values, with the capability to rotate the rectangle about its lower left hand corner, and display the area of the rectangle. However, I must have screwed up somewhere, and can't get it to work.
So far, This is what I have.
=================================================================
(defun c:RRECT()
(graphscr)
(setvar "cmdecho" 0)
(command "Osmode" 0)
(prompt "This program will draw a rectangle within the 15*10 limits")
(command "limits" "0,0" "30,23")
(command "zoom" "all")
(setq PT1(getpoint "\n Please enter the lower left hand corner of the rectangle:"))
(setq H1(getdist "\n Please enter the height of the rectangle: {Max value is 15}"))
(setq W1(getdist "\n Please enter the width of the rectangle: {Max value is 10}"))
(setq N1(getint "\n How many rectangles would you like to draw? {Max value is 5}"))
;area time.
(setq T1 (getreal "\n Please enter the angle of rotation:"))
(setq D2(getdist "\n Please enter the angular increment: {Max value is 5}"))
(setq A2(* W1 H1))
(setq txt(rtos A2))
(setq tx1(strcat "Area of Rectangle = "txt))
;loop for rectangle limits.
(IF(and(<= H1 15)( <= W1 10))
(progn
(repeat n
(setq PT2(list (+(car PT1)H1)(cadr PT1)))
(setq PT3(list(car PT2)(+(cadr PT2) W1)))
(setq PT4(list(car PT1)(cadr PT3) ))
(command "pline" PT1 PT2 PT3 PT4 "close")
(command "ROTATE" "LAST" ""PT1 T1)
; rotating the new object around point 1.
(setq T1 (+ T1 D2 ))
);closes the repeat
);closes progn
(prompt "\n The limits entered exceed the allowable limits, please try again!")
);closes IF statement
(command "text" PT1 ".25" T1 tx1)
(command "zoom" "all")
);closes defun
=================================================================
I keep getting a select few errors upon trying to run my program. (ie, below).
; error: bad argument type: fixnump: nil
Much appreciated for your time and help.
I am trying to write a program that will draw a rectangle, of certain max values, with the capability to rotate the rectangle about its lower left hand corner, and display the area of the rectangle. However, I must have screwed up somewhere, and can't get it to work.
So far, This is what I have.
=================================================================
(defun c:RRECT()
(graphscr)
(setvar "cmdecho" 0)
(command "Osmode" 0)
(prompt "This program will draw a rectangle within the 15*10 limits")
(command "limits" "0,0" "30,23")
(command "zoom" "all")
(setq PT1(getpoint "\n Please enter the lower left hand corner of the rectangle:"))
(setq H1(getdist "\n Please enter the height of the rectangle: {Max value is 15}"))
(setq W1(getdist "\n Please enter the width of the rectangle: {Max value is 10}"))
(setq N1(getint "\n How many rectangles would you like to draw? {Max value is 5}"))
;area time.
(setq T1 (getreal "\n Please enter the angle of rotation:"))
(setq D2(getdist "\n Please enter the angular increment: {Max value is 5}"))
(setq A2(* W1 H1))
(setq txt(rtos A2))
(setq tx1(strcat "Area of Rectangle = "txt))
;loop for rectangle limits.
(IF(and(<= H1 15)( <= W1 10))
(progn
(repeat n
(setq PT2(list (+(car PT1)H1)(cadr PT1)))
(setq PT3(list(car PT2)(+(cadr PT2) W1)))
(setq PT4(list(car PT1)(cadr PT3) ))
(command "pline" PT1 PT2 PT3 PT4 "close")
(command "ROTATE" "LAST" ""PT1 T1)
; rotating the new object around point 1.
(setq T1 (+ T1 D2 ))
);closes the repeat
);closes progn
(prompt "\n The limits entered exceed the allowable limits, please try again!")
);closes IF statement
(command "text" PT1 ".25" T1 tx1)
(command "zoom" "all")
);closes defun
=================================================================
I keep getting a select few errors upon trying to run my program. (ie, below).
; error: bad argument type: fixnump: nil
Much appreciated for your time and help.