Jump to content

Recommended Posts

Posted

Hi Every one.

 

Today I`m trying to find the way to import a specific block from specific dwg, and I`ve found This great program of Lee Mac that allow me to selected it, but I would like to avoid the selection step in this case because I have to do it with a lot of drawings and the block is the same in each one.

 

In fact I've already done a small change that avoid the file selection dialog box:

...(cond
        (   (not (setq dwg "C:/Users/User/Desktop/Jovan G/MyDWG.dwg"))...

but I haven`t figured out how to avoid block selection, and in fact I do not need to insert it because  I`m going to use the below code to replace it with a existing block:

(defun c:aux (/ ss n edata)

  (if (setq ss (ssget "_X" '((2 . "Old_block"))))

    (repeat (setq n (sslength ss))

      (setq edata (entget (ssname ss (setq n (1- n)))))

      (entmod (subst '(2 . "New_block") '(2 . "Old_block") edata))

    ); repeat
  ); if
); defun

I hope you can help me.

Thanks in advance for your time and help.

Posted
16 hours ago, JovanG said:

Hi @pkenewell, I really thank you! if I use it like a subfunction it works perfectly

 

No problem. I read your initial response and was going to suggest you look at the sub-function.

Posted
2 hours ago, pkenewell said:

 

No problem. I read your initial response and was going to suggest you look at the sub-function.

 

Jejejeje, Yeah, what happens when you don't read all the information 😅. Thanks again!

  • Like 1
Posted

I use (if (not StealAll)(load "StealV1-6")) at start of your code this way it loads Lee's steal lisp and all the steal code does not live in your lisp program.

  • Like 1
Posted (edited)

As I use it in a few dozen macros many times a day for importing layouts, plot styles, page setups, dimension styles, etc… I load it in acaddoc.lsp. 

Example

^C^C^P(Steal (strcat (vl-filename-directory (getenv "QnewTemplate")) (chr 92) "AutoCAD Template" (chr 92) "Templates.dwt") (list (list "Page Setups" (list "11×17" "11×17 PDF")))) .regen

 

Edited by tombu
  • Like 1
Posted
On 3/5/2021 at 9:43 PM, BIGAL said:

I use (if (not StealAll)(load "StealV1-6")) at start of your code this way it loads Lee's steal lisp and all the steal code does not live in your lisp program.

Oh! it`s great to know that, because now my lisp program is pretty more clear than before. Thank you BIGAL

Posted
On 3/6/2021 at 3:09 PM, tombu said:

As I use it in a few dozen macros many times a day for importing layouts, plot styles, page setups, dimension styles, etc… I load it in acaddoc.lsp. 

 

That`s a great idea tombu, thank you for teach me the way to load it in acaddoc.lsp. I will do that with some frequently used lisps.

Posted (edited)

Like tombu I use a different method, put your often loaded lisps into 1 lisp, for me Autoload.lsp, then "Appload" and add to "Startup suite". My autoload.lsp has 38 defuns in it. Some like 2 lines others more complicated.

 

It also has lots of "Autoload" commands in the file worth looking into check help "AUTOLOAD". eg (autoload "COPYCOMMAND" '("ZZZ")) they get loaded automatically once you type the command.

Edited by BIGAL
  • Like 1

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