Jump to content

Understanding Variables with a simple routine


rcb007

Recommended Posts

I am trying to understand how to write this routine instead of creating several small basic routines.

 

For an example, I want to be able to ask the user what scale would you like, then it would adjust the cannoscale variable and then the zoom scale variable.

 

Currently, I use a lot of DCLs with Buttons that the users select what scale they want and then it would run that specific routine for that scale.

 

 

(defun C:Demo_Set_Scale_Annotation ()
  (command "_layout" "set" "")
  (comamnd "mspace")
  (command "_.cannoscale" "1\" = 50'")
  (command "_.zoom" "scale" "1/50xp")
  (command "pspace")
  (command "_.zoom" "extents")
(princ)
)

 

Thank you for any help and advise. 

 

Link to comment
Share on other sites

A couple of simple changes.

 

(setq val (getint "\nNew scale - Enter = 50 "))
(if (= val nil) (setq val 50))
(command "_.cannoscale" (strcat "1\" =" (rtos val 2 0) "'"))

(command "_.zoom" "scale" (strcat "1/" (rtos val 2 0) "xp"))

version 2 this will pop a dcl without you doing any code.

 

(if (not AH:Butts)(load "Multi Radio buttons.lsp"))

(setq ans (atoi (ah:butts 3 "V" '("Choose a scale" "10" "20" "50" "100" "200" "250" "500" )))) ; ans holds the button picked as an integer value

Multi radio buttons.lsp

Edited by BIGAL
  • Like 2
Link to comment
Share on other sites

Have to multiply val by 12 to get the correct scale factor of 1/600xp = 1:50'

 

(command "_.zoom" "scale" (strcat "1/" (rtos (* val 12.0) 2 0) "xp"))
Edited by mhupp
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...