Jump to content

Recommended Posts

Posted

Hi,

 

is it possible to run a macro from the numbers (not numberpad).

 

i am using all my F keys and want to set the keys up so the run a macro, even if it the number then enter?

 

is the only way possible thru lisp, or vba?

 

cheers,

 

Col

Posted

Using lisp you can make programs and give them a number name we use 39 59 99 for setting osnaps.

 

(defun c:39()(setvar "osmode" 39))

Posted

Hi, i tried setting them in my pgp but it only seems to work with commands and not a actual macro?

Posted

True, pgp can only contain shortcuts for a single AutoCAD command, not for lisps, not for a macro/group of commands.

 

I believe you'll need to use a lisp routine that includes an 'enter' after typing the number, per BIGAL's example.

Posted

Cheers, i will have a play around. is the same thing possible in vba, i do not no lisp at all but i think i will start to learn as it is obviously handy. i have a vba module that sets the layer based on what commnad you pick eg if you select dimlinear the layer is set to "Dimension", xl selected then layer is set to "Construction" from that i would assume you could do set vba to wait for key strokes then activate a macro?

 

cheers

 

col.

Posted

I believe you call a vba routine, in lisp, with (command "vbarun" "vba_module_name")

 

So lisp routine that would be acticvted with "1" and that would run the vba code would look something like:

 

(defun c:1 ()

(command "vbarun" "vba_module_name")

(princ)

)

Posted

you have a couple of options. You could use a command reactor to look at last command and do layer manip from there, or you could put all you work in code and set layer from there. Depends on what your trying to do.

Posted

We have some software that must do "the look at last command" if you manage to sort of jump out of it midstream (we often manage to do it) then it keeps asking for an OK to continue in between every normal Autocad command its a bit of a pain. We have to close and reopen we will advise the vendor of the bug.

 

I guess I am hinting at the pgp acad.lsp way calling vba's its simple and works.

 

(defun C:1() (vl-vbaload "F:/VBA/MYPROG.dvb") (vl-vbarun "LAYDIM"))

Posted

I use the lsp method as well. Simple, easy to maintain, and pretty much foolproof

Posted

Hi,

 

yes i have used the lisp method, never used lisp before but its very handy for creating new commands i am just transfering the macro i have wrote over to the lisp

 

cheers,

 

col.

Posted

(defun c:4 ()
(command "multiple" "dimlinear" pause pause pause)
(princ)
)

 

tried the above to allow me to use the key "4" to multiple command for dimlinear but not working, i tried ditching the "multiple" and put

 

""

 

at the end but it returned command 4 not found? i understand it is trying to repeat the command 4 but it is autocad does not understand this?

 

cheers,

 

col.

Posted

Why not just use a while statement to repeat the command?

 

(defun c:4  (/ iPt)
 (while (setq iPt (getpoint "\nSelect First Point: "))
   (command "multiple" "dimlinear" iPt pause pause))
 (princ)
 )

Posted

Lee,

 

Why not indeed!

 

that works really well, thansk for that will be able to modify it for a few other things

 

Cheers,

 

Col.

Posted
Lee,

 

Why not indeed!

 

that works really well, thansk for that will be able to modify it for a few other things

 

Cheers,

 

Col.

 

No probs, anything else Col, just ask :)

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