Hi All,
I like that Autodesk now allows us to just pick a command's option from the command line instead of typing a letter in the option. For example, when drawing a rectangle we're prompted to "Specify first corner point or [Chamfer Elecation Fillet Thickness Width]" and if we wanted to draw fillets on the rectangle we can simply PICK that option from the prompt in the command line OR enter an "F" and return.
Is there a way we can use this functionality in our custom programs?
TIA,
Sal
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
Yes, if you format your prompts in the following way:
[Option1/Option2/Option3] <Option1>
They should appear in the same way as standard AutoCAD prompts.
Hi Lee_Mac,
Thanks for your VERY quick response.
You are correct that formatting the prompt that way they will "appear" the same as the standard AutoCAD prompts but I want them to ACT like the standard AutoCAD prompts in that I will be able to PICK them from the command line instead of entering their key letter(s). In other words, using the example in the OP, if while at the rectangle command prompt, I can move the cursor over the "Fillet" option and pick. Real nice. How can I get this in my custom code?
Sal
Hi sbrusco,
something like this perhaps
(setvar "errno" 0) (initget "Chamfer Elecation Fillet Thickness Width") (setq ans (getpoint "\n Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]: ")) (cond ((= 'list (type ans)) (getcorner ans "\n Specify other corner: ") ) ((= "Chamfer" ans) (princ "\nDo the Chamfer stuff!") ) ((= "Elevation" ans) (princ "\nDo the Elevation stuff!") ) ((= "Fillet" ans) (princ "\nDo the Fillet!") ) ((= "Thickness" ans) (princ "\nDo the Thickness stuff!") ) ((= "Width" ans) (princ "\nDo the Width stuff!") ) )
HTH
Henrique
@sbrusco wrote:You are correct that formatting the prompt that way they will "appear" the same as the standard AutoCAD prompts but I want them to ACT like the standard AutoCAD prompts in that I will be able to PICK them from the command line instead of entering their key letter(s).
If you have formatted the prompts as I have described, then they should act the same - at least, they do for me.
Here is a quick example for you to test:
(defun c:test ( ) (initget "Alpha Beta Gamma") (getkword "\nChoose an option [Alpha/Beta/Gamma] <Alpha>: ") )
Here's confirmation for what lee and hmsilva posted ...in autocad 2012 at least
Displays the floating menu next to the cursor and the initget arguments are mouse clickable.
In Lee's example, I could click on alpha beta and/or gamma just as though I had typed in the uppercase letter.
Hi,
You are all correct and thanks for the input. Almost all my code does work as you indicate and as i expected except for this section which i'm sure is becuse it is a GETKWORD function. Just the same, how can i get these options to be "pickable" on the command line and even appear in the pop up menu by the cursor...
Yeah, i know, i want it all. But i know you guys can help me get it all. You're the best.
Sal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(INITGET
(+ 2 4) ; no zeros or neg numbers
"ACCESSORY,A EXTRUSION,E FASTENER,F FLASHING,FL PANEL,P SEALANT,S"
)
(SETQ newLay (GETKWORD
(STRCAT
"\nMove object to layer:"
" (Access/Extru/Fast/FLash/Panel/Sealant <Flash>)"
)
)
)
;; set user entry default
(IF (NOT newLay)
(SETQ newLay "FLASHING")
)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@sbrusco wrote:
Hi,
You are all correct and thanks for the input. Almost all my code does work as you indicate and as i expected except for this section which i'm sure is becuse it is a GETKWORD function. Just the same, how can i get these options to be "pickable" on the command line and even appear in the pop up menu by the cursor...
Not sure if it an be done with cad versions lower than 2012 or is it 2013?
One thing though
" [Access/Extru/Fast/FLash/Panel/Sealant] <Flash>)"
Use "[...]" symbol instead of "(..)"
All i'm saying is , if your cad version is capable of that features then it will be "pickable" as long as you sue the right syntax
Hi pbejse,
You are correct. As always, it helps to use the correct syntax. duh!
Anyway, that was the problem. Now it works as i want.
THANKS,
Sal