Jump to content

Create sample LISP to insert block


soan

Recommended Posts

Hi,

 

I search for Lisp for insert block faster.

 

Ex.: if a write "1" on keyboard, i can insert "block 1" in my drawing. I can insert "block 1" until a stop the LISP

 

if a write "2" on keyboard, i can insert "block 2" in my drawing. I can insert "block 2" until a stop the LISP

 

All my block are in the same drawing.

 

Thanks a lot

Link to comment
Share on other sites

Do you really think using a number as a way to invoke a lisp routine for inserting a block is a good idea? What happens after you have loaded and run the lisp routine 1.lsp the first time you actually need to use the number "1" in your drawing as an actual number?

Link to comment
Share on other sites

With all of the ways available for inserting blocks, LISP is hardly necessary.

 

Are you maybe looking for something that will insert the same block multiple times without needing to use the COPY command?

Link to comment
Share on other sites

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

 

LINE pick point drag mouse with ortho on type 39 no probs line is 39 long.

 

But yeah insert blocks palette, slides, menu etc lots of ways.

Link to comment
Share on other sites

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

 

LINE pick point drag mouse with ortho on type 39 no probs line is 39 long.

 

But yeah insert blocks palette, slides, menu etc lots of ways.

Using defun c:39 just need one step, simply invoke command 39

 

Alternative,

If blocks exist in drawing, i prefer a simple defun using initget & getkword

just setq bn (eg: block name is 39) etc..

(command "insert" bn pt 1)

 

But this requires 2 steps, invoke command , then 39

Link to comment
Share on other sites

B29 B43 B56 it can be done look at this http://www.cadtutor.net/forum/showthread.php?93661-Lisp-for-fillet-radius./page3 just add a "B" option.

 

That's great idea by reactor

im sure many draft persons love this!!

 

p/s : ive seen many draft using number defun (c:30 c:40 etc..) as snapang etc..

may conflict? due to defun is global variable

Link to comment
Share on other sites

I may add the "B" option it may rain this weekend. So long as the block name has no spaces it should work. So thats "B" "C" "O" & "F" used, any other ideas anyone.

Link to comment
Share on other sites

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