Jump to content

"_.-ScaleListEdit" - Error - numberp


abra-CAD-abra

Recommended Posts

I am going insane trying to get this working.

 

Can somebody put me out of my misery?

 

(defun c:demo (/ xprt lst)
;Add Annotation Scales - Metres 
(setq xprt (getvar 'Expert)) (setvar 'Expert 5)
(setq lst '("2000" "2500" "200" "250" "500" "5000"))
 (foreach annoscale lst
   (command "_.-ScaleListEdit" "Add" (strcat "1:" annoscale "m") (strcat "1:" (rtos (/ annoscale 1000.00) 2 2)) 
"Exit")
 )
(Setvar 'Expert xprt)


(princ))

 

 

Cheers,

Link to comment
Share on other sites

Hi Tharwat,

 

The 'Read' function didn't resolve the issue, so I tried 'atof' which also didn't work. it fell over at the prompt for the scale ratio. So, with a fresh mind, I opted for a different approach, which appears to function as expected.

 

(defun C:Demo (/ xprt lst)
(setq xprt (getvar 'expert)) (setvar 'expert 5)
(setq lst (list   
  '("1:1000m" "1:1.0")
  '("1:2000m" "1:2.0")
  '("1:2500m" "1:2.50")
  '("1:200m" "1:0.20")
  '("1:250m" "1:0.25")
  '("1:500m" "1:0.50")
  '("1:5000m" "1:5.0")))
 (foreach annoscale lst
   (command "_.-ScaleListEdit" "_A" (car annoscale) (cadr annoscale) "_E")
 )
(Setvar 'expert xprt)
(princ)
)

 

 

I would still like to get the first code working. I am trying to make it as concise as possible, not that it necessarily needs to be, it's just a learning curve.

 

Cheers :thumbsup:

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