acad1985 Posted September 17, 2018 Posted September 17, 2018 Hello Everyone. Actually i have lisp file with 5 commands (Command name :1,2,3,4,5) Please help me to crate lisp for below. I want call the command by user input. If i enter 1, command 1should be executed...if i click 2 then command 2 should be executed. We can directly exeute the commands but I'm trying to call these commands with one macro button. Please help me anyone. Quote
BIGAL Posted September 18, 2018 Posted September 18, 2018 Dont see much speed improvement over having a routine maybe a DCL with buttons over press 1 <Enter> we use menus and tool bars easy to have a tool bar with 1 2 3 4 5 etc. You will need to make the icons here is the tool bar code. Its a MNU file use menuload. It should work without the icons. ***MENUGROUP=NUMBSTOOLBAR ***TOOLBARS **NumberTOOLS ID_ALAN_1 [_Toolbar("Alans2", _LEFT, _Show, 50,50, 1)] 1 [_Button("1","1.bmp,"1.bmp")]^c^c^c(command "1") 2 [_Button("2","2.BMP","2.BMP")]^c^c^c(command "2") 1 Quote
acad1985 Posted September 18, 2018 Author Posted September 18, 2018 Hello BIGAL, Thanks for your reply. Actually i'm not aware of this *.mnu files, but i have load using MENULOAD as you mentioned. after that i'm checking in there is no Toolbar is available. i have checked on Menubar->Tools->Toolbar NUMBSTOOLBAR is available there. but when i select Alans2 on that toolbar, nothing is appear in Autocad . Could you please help me on this. Quote
tombu Posted September 18, 2018 Posted September 18, 2018 (initget "1 2 3 4 5") (setq OP (getkword " [1/2/3/4/5]: ")) You could modify the lisp. Allows you to enter an option, pick it on the command line, or pick it on the screen. Of course using descriptive command names would be easier for your users to understand while still being able to start one with a single click or entering a single letter. Still just using that one macro button. Quote
Grrr Posted September 18, 2018 Posted September 18, 2018 Recently I wrote this just for fun. Although I would advise to use/modify the acad.pgp file to assign shortcuts to the command calls. Quote
BIGAL Posted September 19, 2018 Posted September 19, 2018 (edited) Nice one Grr Acad1985 will find out why its not working not sure at this point just cut and pasted another toolbar. Grr I have c123 f45 o34 Circle with radius xxx, fillet with radius xx, offset etc reads the xxx bit of the unknown command posted a couple of times here. ps it has more options. Edited September 19, 2018 by BIGAL Quote
Grrr Posted September 19, 2018 Posted September 19, 2018 5 hours ago, BIGAL said: Grr I have c123 f45 o34 Circle with radius xxx, fillet with radius xx, offset etc reads the xxx bit of the unknown command posted a couple of times here. ps it has more options. I've seen that reactor program, BIGAL. And I find it awesome! Quote
BIGAL Posted September 19, 2018 Posted September 19, 2018 I changed the code above had the bmp with " Quote
acad1985 Posted September 19, 2018 Author Posted September 19, 2018 Hello Experts, Thank you so much for your time. Tombu, I tried your code, its shows unknown command what i entered the value. (defun c:asd() (initget "1 2 3 4 5") (setq OP (getkword " [1/2/3/4/5]: ")) ) Grrr and BIGAL I've seen your Post. Your code is Nice and awesome. but this code for Assign a Shortcut for Commands. actually i have lisp for multiple offset.. using this we will offset 4 lines at a time. but some time we need to offset 2,3,5 and 6 lines. so i have copy the lisp with different command (1,2,3,4,5,6 like that). so that's why i'm asking to call these all the commands with single command. Thanks for understanding. Quote
Grrr Posted September 19, 2018 Posted September 19, 2018 Okay, heres one suggestion: (defun C:asd ( / L n itm ) (and (setq L '(nil ; Write down your commands here : "CIRCLE" "LINE" "PLINE" "TEST" ; <- example for a custom LISP command ); list ); setq L (setq n (progn (initget 6) (getint (strcat "\nSpecify number of the command (max " (itoa (1- (length L))) ") <exit>: ")))) (setq itm (nth n L)) (vla-SendCommand (vla-get-ActiveDocument (vlax-get-acad-object)) (strcat itm "\r")) ); and (princ) ); defun (vl-load-com) (princ) (defun C:test ( / ) ; <- example for a custom LISP command defining (alert "\nThis is my other routine, it does awesome stuff.") (princ) ); defun Quote
rlx Posted September 19, 2018 Posted September 19, 2018 nice Grrr! maybe add a little user feedback .... );setq L (setq i 0) (princ (strcat "\n" (apply 'strcat (mapcar '(lambda (x)(strcat "(" (itoa (setq i (1+ i))) ") " x " ")) (cdr L)))) ) (setq n... ... of course only usefull when not having too many commands in the list Quote
acad1985 Posted September 19, 2018 Author Posted September 19, 2018 Hey Grrr Thank you so much This is awesome , it's working what i want Thank you so much rlx and Grrr Quote
rlx Posted September 19, 2018 Posted September 19, 2018 6 minutes ago, acad1985 said: Hey Grrr Thank you so much This is awesome , it's working what i want Thank you so much rlx and Grrr your welcome but 99.99% of the credits goes to Grrr! Think I would have used Grrr-read instead of initget (so I wouldn't have to use enter) but that would give longer code and be practical for no more than 9 or 10 commands. in the end , only thing that counts is you being happy. So well done Grrr ! Quote
BIGAL Posted September 20, 2018 Posted September 20, 2018 My version of multi offset uses a csv approach so can have as many offsets as you like, -ve numbers will go in opposite direction. Its at home so can not post now will see if I can find here. it asks for user input so no hard coding offset -> 1,34,23.45,-12,-25 etc. Quote
Recommended Posts
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.