clint0577 Posted December 12, 2012 Posted December 12, 2012 Why is this not working? I tried serching for the answer online but I didn't find anything that helped. When I run the lisp routine, it gives me this "bad argument type: numberp: "30"" the 30 is the user entered Original Scale. ; CORRECT SCALE OF OBJECT (DEFUN C:FXS () (setq DS (getvar 'dimscale)) (setq OS (getstring "\nOriginal Scale: ")) (PROMPT "\nPick object to SCALE : ") (setq A (ssget)) (setq DST (rtos DS 2 4)) (setq OST (rtos OS 2 4)) (SETQ SF (/ DST OST)) (COMMAND "scale" A "" PAUSE SF) (princ) ) Quote
Lee Mac Posted December 12, 2012 Posted December 12, 2012 Consider the data types of your variables: ; CORRECT SCALE OF OBJECT (DEFUN C:FXS () [color=red];; DS is a REAL[/color] (setq DS (getvar 'dimscale)) [color=red];; OS is a STRing[/color] (setq OS (getstring "\nOriginal Scale: ")) (PROMPT "\nPick object to SCALE : ") [color=red];; A is a PICKSET (or nil)[/color] (setq A (ssget)) [color=red];; DST is a STRing[/color] (setq DST (rtos DS 2 4)) [color=red];; Error since OS is a STRing (not a REAL)[/color] (setq OST (rtos OS 2 4)) [color=red];; Attempting to divide two STRings[/color] (SETQ SF (/ DST OST)) (COMMAND "scale" A "" PAUSE SF) (princ) ) Quote
David Bethel Posted December 12, 2012 Posted December 12, 2012 I would advise to look into the variations of (get...) calls along wih ( initget ) . It makes life so much easier. -David 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.