Jump to content

Break lines around blocks with selection


ibanez_222

Recommended Posts

I attached this lsp. that I found off a site, and it works great. It is basically two commands in one kind of, which is ABB or ABBE. I don't know what the letters stand for but the ABB pretty much copies a selected block and you can insert it anywhere you want and it automatically breaks the lines around the block. The ABBE lets you select a block and it will break the lines around it and the command stays in play so you can keep going around the drawing to clean up the blocks. This works great but I was wondering if this could be modified to work with a selection window, and cleans all blocks within the selection set? This would make thinks a lot faster. Thanks.

ABB.LSP

Link to comment
Share on other sites

Glad you like my program :)

 

A full description of the program and the latest version can be found on my site here.

 

To break all in a selection set, add this on a new line at the end of the program file:

 

(defun c:abbss ( / ss i )
 (if (setq ss (ssget "_:L" '((0 . "INSERT"))))
   (repeat (setq i (sslength ss)) (LM:AutoBlockBreak (ssname ss (setq i (1- i)))))
 )
 (princ)
)

PS: ABB = AutoBlockBreak, ABBE = AutoBlockBreak Existing

Link to comment
Share on other sites

Yea we thought about doing that but unless we can lock the draw order we would rather not. You would constantly have to check the draw order because in my experiences it never stays where you want it to. Thanks Lee Mac that works great!

Link to comment
Share on other sites

Yea we thought about doing that but unless we can lock the draw order we would rather not. You would constantly have to check the draw order because in my experiences it never stays where you want it to. Thanks Lee Mac that works great!

 

My experience is the same.

Link to comment
Share on other sites

I've found the draworder gets screwed every single time you use RefEdit anywhere near that drawing. Other times is when you use Tool Palette / Design Center to insert that block from out of another drawing, but then it's only this one time (though only sometimes).

 

That's why I made a lisp for moving all wipeouts to bottom inside of blocks. The attached has 2 commands: LayerstoTop (you'll need to modify the list to suit your needs) and BlockWipeouts2Bottom

DwgOrder.LSP

Link to comment
Share on other sites

  • 1 year later...

This is a really useful script, but is there any way to make it automatically run when you insert the block in the first place?

 

For example, I use a lisp script to insert certain blocks:

 

(defun c:valve (/ pt)

(while (setq pt (getpoint "\nPick Insertion point.")) ; Choose insertion point

(command "-insert" "k:/valve" "_non" pt "" "" pause) ; Insert block

)

(princ)

)

 

Right now I type in "valve" and place the block on an existing line. Next, I type ABBE and click on the valve, which trims the lines. Is it possible to automatically trim the lines between the block as soon as I place it?

Link to comment
Share on other sites

This is a really useful script, but is there any way to make it automatically run when you insert the block in the first place?

 

Assuming that you are referring to my Automatic Block Break program and not the other program posted in this thread, you can call the LM:AutoBlockBreak subfunction contained in my program from your code, for example:

 

(defun c:valve ( / el )
   (setq el (entlast))
   (while (vl-cmdf "_.-insert" "k:/valve" "_S" 1.0 "_R" 0.0 "\\")
       (if (not (eq el (setq el (entlast))))
           (LM:AutoBlockBreak el t)
       )
   )
   (princ)
)

Of course, you will need to ensure that my program is loaded in the drawing session before calling the function.

 

Demo:

 

AutoBlockBreakExample.gif

 

PS: Please edit your post and enclose your code with code tags:

 

[highlight][noparse]

[/noparse][/highlight] Your code here [highlight][noparse]

[/noparse][/highlight]

Edited by Lee Mac
Link to comment
Share on other sites

  • 2 weeks later...
...is there any way to make it automatically run when you insert the block in the first place?

 

Did the above solution work for you, madmonocle? Or did I waste the time & effort I spent responding to your question?

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