command line macros in mns files - how to do
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
command line macros in mns files - how to do

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
Dave R.
Guest





Posted: Tue Jan 11, 2005 7:23 pm    Post subject: command line macros in mns files - how to do Reply with quote

Can I put simple command line macros in a custom MNS file so they are
portable? If so what is the syntax?

For example if I wanted to map a command "str" to ^C^C^CSTRETCH;CP;


Thanks,

Dave R.

Back to top
j buzbee
Guest





Posted: Tue Jan 11, 2005 7:30 pm    Post subject: Re: command line macros in mns files - how to do Reply with quote

How about in an ACADDOC.lsp file in the search path? It'll get loaded in
each drawing. Syntax could simply be:

(defun c:str( / )
(command "_.stretch cp ")(princ))

Note the spaces between stretch and cp.

jb
Back to top
Dave R.
Guest





Posted: Tue Jan 11, 2005 7:49 pm    Post subject: Re: command line macros in mns files - how to do Reply with quote

I would prefer the portability of an MNS if possible. For me it lessens the
impact of version upgrades and creating a mirror of my work setup at home.

- Dave R.


"j buzbee" <jdb@journeysendfarm.net> wrote in message
news:41e3e301$1_2@newsprd01...
Quote:
How about in an ACADDOC.lsp file in the search path? It'll get loaded in
each drawing. Syntax could simply be:

(defun c:str( / )
(command "_.stretch cp ")(princ))

Note the spaces between stretch and cp.

jb



Back to top
Dave R.
Guest





Posted: Tue Jan 11, 2005 8:09 pm    Post subject: Re: command line macros in mns files - how to do Reply with quote

jb,

I loaded your lisp macro into my acad2004doc.lsp but I get the following
error while trying to use it:

Command: str
_.stretch cp Unknown command "STRETCH CP ". Press F1 for help.

It doesn't look like it is executing the command then the subcommand
sequentially but both at the same time. I know nothing about lisp syntax so
I'm lost...

- Dave R.

"j buzbee" <jdb@journeysendfarm.net> wrote in message
news:41e3e301$1_2@newsprd01...
Quote:
How about in an ACADDOC.lsp file in the search path? It'll get loaded in
each drawing. Syntax could simply be:

(defun c:str( / )
(command "_.stretch cp ")(princ))

Note the spaces between stretch and cp.

jb

Back to top
ecable
Guest





Posted: Tue Jan 11, 2005 8:18 pm    Post subject: Re: command line macros in mns files - how to do Reply with quote

Create your own menu and load that. Then create yourmenu.mnl to load your stuff. Use jb's example in yourmenu.mnl.
Back to top
ecable
Guest





Posted: Tue Jan 11, 2005 8:20 pm    Post subject: Re: command line macros in mns files - how to do Reply with quote

(defun c:str( / )
(command "_.stretch" "cp")(princ))
Back to top
Tom Smith
Guest





Posted: Tue Jan 11, 2005 8:28 pm    Post subject: Re: command line macros in mns files - how to do Reply with quote

Quote:
I loaded your lisp macro into my acad2004doc.lsp but ...

Dave, several points.

It's recommended that you don't modify the supplied acad2004doc.lsp. If
you're going to do this, create your own acaddoc.lsp as per the suggestion.

The syntax suggested doesn't work. It should be:

(defun c:str( / )
(command "_.stretch" "cp")
(princ)
)

The indentation doesn't matter, but note the use of quotation marks for each
separate string. You want to quote separately each thing that you would
enter at the command prompt. Without getting deeply into lisp, you can use
this as a template for other keyboard macros, such as:

(defun c:ze( / )
(command "_.zoom" "e")
(princ)
)

Finally, a good measure for portability might be to put such things in an
MNL file of the same base name as your MNS. The MNL will load automatically
when the menu loads. MNL's are intended to hold any lisps which are used by
the MNS file, but because of their automatic loading they can be used for
the same type things as the acaddoc.lsp file.
Back to top
Luis Esquivel
Guest





Posted: Tue Jan 11, 2005 8:31 pm    Post subject: Re: command line macros in mns files - how to do Reply with quote

Probably it is reffering to use sendcommand function, ie:

(defun C:STR ()
(vla-sendcommand
(vla-get-activedocument (vlax-get-acad-object))
"_.stretch cp "))


[&StretchIt]^C^CSTR

--
For free AutoLisp/Visual Lisp resources go to:
http://www.draftteam.com/free.php?&lang=en


"Dave R." <noSpam@please.com> wrote in message news:41e3ec2c_2@newsprd01...
Quote:
jb,

I loaded your lisp macro into my acad2004doc.lsp but I get the following
error while trying to use it:

Command: str
_.stretch cp Unknown command "STRETCH CP ". Press F1 for help.

It doesn't look like it is executing the command then the subcommand
sequentially but both at the same time. I know nothing about lisp syntax
so
I'm lost...

- Dave R.

"j buzbee" <jdb@journeysendfarm.net> wrote in message
news:41e3e301$1_2@newsprd01...
How about in an ACADDOC.lsp file in the search path? It'll get loaded
in
each drawing. Syntax could simply be:

(defun c:str( / )
(command "_.stretch cp ")(princ))

Note the spaces between stretch and cp.

jb



Back to top
j buzbee
Guest





Posted: Wed Jan 12, 2005 4:02 am    Post subject: Re: command line macros in mns files - how to do Reply with quote

yea yea yea - what he said

Quote:
(defun c:str( / )
(command "_.stretch" "cp")(princ))
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB