Jump to content

bad argument type: numberp:


clint0577

Recommended Posts

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)

)

Link to comment
Share on other sites

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)
)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...