function command with variable length tokens or arguments

function command with variable length tokens or arguments

hoseobshim
Contributor Contributor
648 Views
8 Replies
Message 1 of 9

function command with variable length tokens or arguments

hoseobshim
Contributor
Contributor

Autocad command "ucs" has various options available.
How can I enable users to set the UCS using various options and return to my subsequent lines of code?
;...
(setq worlducs_old (getvar "worlducs"))
(command "ucs") ;
(how-do-I-know-the-ucs-done ?) ; waiting until the user completes the ucs command
(setq worlducs_new (getvar "worlducs"))
;...

0 Likes
Accepted solutions (3)
649 Views
8 Replies
Replies (8)
Message 2 of 9

komondormrex
Mentor
Mentor
Accepted solution

using acet.

...
(setq done 7)
(while (/= 6 done)
	(command-s "_ucs" pause)
	(setq done (acet-ui-message "Are you done?" "UCS change" 4))
)
...
Message 3 of 9

Kent1Cooper
Consultant
Consultant
Accepted solution

@hoseobshim wrote:

....How can I enable users to set the UCS using various options and return to my subsequent lines of code?
....


....

(command "_.ucs"); leaves you in the command

(while (> (getvar 'cmdactive) 0) (command pause)); keeps pausing for user input until command is completed

(setq worlducs .... ; then go on

 

Or in new-enough versions, simply:

(command-s "_.ucs"); waits for user input until done

Kent Cooper, AIA
Message 4 of 9

Sea-Haven
Mentor
Mentor
Accepted solution

You could incorporate also something like this for saved UCS's the code reads the current ucs's names.

 

SeaHaven_0-1683418835609.png

; Thanks to Gile for the read UCS
; Multi radio by AlanH

(setq named-UCS '("World"))
(vlax-for ucs (vla-get-UserCoordinateSystems
(vla-get-Activedocument
(vlax-get-acad-object)
)
)
(setq named-UCS (cons (vla-get-Name ucs) named-UCS))
)

(setq named-UCS (reverse named-ucs))
(setq named-UCS (cons "Please choose " named-UCS ))

(if (not AH:Butts)(load "Multi radio buttons.lsp"))
(setq ans (ah:butts 1 "V"   named-UCS))
(if (= ans "World")
(command "UCS" ans)
(command "UCS" "R" ans)
)

 

Message 5 of 9

hoseobshim
Contributor
Contributor

Thank you komondormrex, and apologies for my late response.
I've just learned an acet function and have already started using it.

0 Likes
Message 6 of 9

hoseobshim
Contributor
Contributor

Thank you Kent Cooper, and apologies for my late response.
You have greatly helped me to complete my code.

0 Likes
Message 7 of 9

hoseobshim
Contributor
Contributor

Thank you Sea-Haven, and apologies for my late response.
It appears your code gives me more info than I need, the variable number of tiles in dcl ! I've just discovered what my next lisp will be.

0 Likes
Message 8 of 9

komondormrex
Mentor
Mentor

most generous op. 👍

0 Likes
Message 9 of 9

Sea-Haven
Mentor
Mentor

Multi radio buttons

Multi radio buttons 2 col

Multi radio buttons 2 col

on to do as many radio but  columns in one code.

Multi getvals

Multi toggles

 

Just pm with an email and can send the others.

 

0 Likes