Insert Block and automatic break lines

Insert Block and automatic break lines

niceDYZP5
Participant Participant
5,410 Views
14 Replies
Message 1 of 15

Insert Block and automatic break lines

niceDYZP5
Participant
Participant

Hi all, I am looking for a LISP that will break or trim lines when inserting a block onto a line or polyline.

I have tried many different LISP routines  I found online, but not seeming to do exactly what I want.

 

I want to be able to insert a block (onto line or polyline) and have it break upon insertion.

I have tried Lee Macs "Automatic Block Break" which is awesome, but I didn't like how you have to manually type in a block name or browse to the folder where the block resides. 

 

I generally use "Design Center" to insert blocks.

Any ideas???

0 Likes
Accepted solutions (1)
5,411 Views
14 Replies
Replies (14)
Message 2 of 15

Kent1Cooper
Consultant
Consultant

Put a Wipeout in the Block.

Kent Cooper, AIA
0 Likes
Message 3 of 15

niceDYZP5
Participant
Participant

Thank you Kent, I have been considering this. I thought a wipeout would be better, due to the fact you can move the object and not have to extend or fix broken lines. 

But my co-workers have a different view on this. 

As it was explained to me by co-workers, they'd rather have a break in the line because one side of the symbol might need to be a different line type or layer.

 

 

0 Likes
Message 4 of 15

Kent1Cooper
Consultant
Consultant

@niceDYZP5 wrote:

.... they'd rather have a break in the line because one side of the symbol might need to be a different line type or layer.


Well, that can be done, but how satisfactorily depends a lot on the particular shapes of the Blocks, where their insertion points are, and the directions the linework runs in.  If a Block is circular, and its insertion point is at its center, then its diameter can be known and a Line [or Polyline] can be Broken the correct distance from the center in each direction, no matter what the Line direction or the Block rotation.  But if the same Block is square, and you want the broken ends of the Line to meet its perimeter, the Line should be broken for a different distance depending on its direction relative to the Block rotation.  The difference would be greater with more irregular shapes.  If a Block is bounded by a single closed outline object [Circle, Ellipse, Polyline], it may be possible to get that picked on in a TRIM command, and Trim out the part of the Line within it.

 

If you can post a small sample drawing with some typical linework and typical Blocks, it may be more apparent how to approach it, or what compromises you may need to accept [such as broken Lines maybe ending short of the Block in some cases and maybe penetrating slightly into it in others].

 

I suspect there are similar topics in the Forums, and it is worth a little Searching -- something may already be available.

Kent Cooper, AIA
0 Likes
Message 5 of 15

niceDYZP5
Participant
Participant

Kent, I attached a drawing that shows common symbols and lines.

I highlighted the blocks in yellow. As you can see, there are cases where the wipeout would work, but when we need to change linetype, layer, etc, we would need to break the line at that point.

0 Likes
Message 6 of 15

ВeekeeCZ
Consultant
Consultant

Removed by the user.

0 Likes
Message 7 of 15

niceDYZP5
Participant
Participant

thanks for the reply. I have this LISP downloaded already. I think its really good, but we were looking for a LISP that will break lines as you insert the block on a line. Lee Macs LISP, from what I see, you select all objects then you break the lines.

0 Likes
Message 8 of 15

Kent1Cooper
Consultant
Consultant

Would you be willing to change the Block definitions so that the insertion points are in the middle of each Block?  It would make a routine infinitely easier.  With the insertion points at the midpoint of the left side, placing the Blocks would require calculation from the picked Line/Polyline, affected by scale if that ever varies, etc.

 

Also, do the ones with an Attribute above [TB1 in your sample] ever occur on vertical Lines?  If so, should the break encompass the Attribute, or only the rectangle box?

Kent Cooper, AIA
0 Likes
Message 9 of 15

niceDYZP5
Participant
Participant

I would definitely consider changing the insertion point in the blocks. We do not have a large library yet, so that would be no issue. As far as your question regarding the TB1 attribute, yes, there are times this block would be placed on a vertical line. I would think the lines should be broke round the box and not the attribute.

I have downloaded and tested many "block line break" LISP's and none of them seem to work. Would it be because the insertion point of the blocks is typically on the left?

Also, if you agree with my comment above, which LISP routine would you recommend would be best to use? We would like to have line broken at insertion, not afterwards.....if that makes any sense??

 

0 Likes
Message 10 of 15

ВeekeeCZ
Consultant
Consultant

@niceDYZP5 wrote:

thanks for the reply. I have this LISP downloaded already. I think its really good, but we were looking for a LISP that will break lines as you insert the block on a line. Lee Macs LISP, from what I see, you select all objects then you break the lines.


 

Not really true. Load his lisp once more and try this line copy-paste to the command line.

(progn (initdia) (command-s "classicinsert") (LM:AUTOBLOCKBREAK (entlast) t))

0 Likes
Message 11 of 15

niceDYZP5
Participant
Participant

Thanks for this tip! When you say copy that line into the command line, do you mean at the command prompt in AutoCAD? Or in the Lisp file itself? 

0 Likes
Message 12 of 15

Sea-Haven
Mentor
Mentor

Was looking at boundary around block but text out side is a problem need to think harder and better solution than bounding box. maybe a bounding box of block elements then a outer boundary. 

 

As suggested call Lee's program he does state though "with all objects surrounding the block trimmed to the rectangular block outline" So a triangle will have bigger gaps.

 

screenshot398.png

Message 13 of 15

ВeekeeCZ
Consultant
Consultant
Accepted solution

@niceDYZP5 wrote:

Thanks for this tip! When you say copy that line into the command line, do you mean at the command prompt in AutoCAD...


Yes, that was just to prove the concept.

Anyway, here's the regular lisp.

Add this to the Lee's *.lsp file at the very end, load the file, run the InsertBreak command.

 

(defun c:InsertBreak ()
  (initdia)
  (command-s "classicinsert")
  (LM:AUTOBLOCKBREAK (entlast) t)
  (princ)
  )
0 Likes
Message 14 of 15

niceDYZP5
Participant
Participant

Thank you all for your guidance. I think I can get Lee's program to work for us now. Thanks!

0 Likes
Message 15 of 15

Sea-Haven
Mentor
Mentor

May have found a way for odd shapes draw a circle around block, trim line left right, then do extend use BLOCK, then left right lines. Have to go now but will try later.

 

screenshot400.png

0 Likes