Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

line break when inserting a block.

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
darryl.m.bowen
1928 Views, 11 Replies

line break when inserting a block.

I used to work at a place that when you inserted a block be it a valve, flanges, or any inline component you would clock on the button for the item you wanted and the prompt would ask "pick line to insert on" or something close.  You would select your line and the it would insert the block and break the line.  

 

Now the fun part.  Where I am working at now not all the blocks are nowhere near the same size.  So I will need to modify the command to work with about 50+ different symbols.

 

break down of whats needed

1. type in command

2. pick line to insert block

3. insert block

4. break line

5. close command....

 

 

 

11 REPLIES 11
Message 2 of 12
Lee_Mac
in reply to: darryl.m.bowen

Would this help at all?

Message 3 of 12
darryl.m.bowen
in reply to: Lee_Mac

That was it. works everytime all the time.  

 

 

Message 4 of 12

Lee one question.  I have been looking thru the routine and would like to put a default black name.

the name of the block is "inlfuz" 

 

Where would that go in the routine...

Message 5 of 12
Lee_Mac
in reply to: darryl.m.bowen

darryl.m.bowen wrote:

That was it. works everytime all the time.  

 

 

 

Excellent - glad to hear it!

Message 6 of 12
Lee_Mac
in reply to: darryl.m.bowen

darryl.m.bowen wrote:

Lee one question.  I have been looking thru the routine and would like to put a default black name.

the name of the block is "inlfuz" 

 

Where would that go in the routine...

 

You can call the main function with your own custom program:

 

(defun c:inlfuz ( / *error* blk dwg ins )

    (setq blk "inlfuz")
 
    (defun *error* ( msg )
        (LM:endundo (LM:acdoc))
        (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
            (princ (strcat "\nError: " msg))
        )
        (princ)
    )
 
    (cond
        (   (= 4 (logand 4 (cdr (assoc 70 (tblsearch "layer" (getvar 'clayer))))))
            (princ "\nCurrent layer locked.")
        )
        (   (not (or (tblsearch "block" (setq dwg blk)) (setq dwg (findfile (strcat blk ".dwg")))))
            (princ (strcat "\nBlock \"" blk "\" not found."))
        )
        (   (setq ins (getpoint "\nSpecify point for block: "))
            (LM:startundo (LM:acdoc))
            (LM:AutoBlockBreak
                (vlax-vla-object->ename
                    (vla-insertblock
                        (vlax-get-property (LM:acdoc) (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))
                        (vlax-3D-point (trans ins 1 0))
                        dwg 1.0 1.0 1.0
                        (angle '(0.0 0.0 0.0) (trans (getvar 'ucsxdir) 0 (trans '(0.0 0.0 1.0) 1 0 t) t))
                    )
                )
                (= "ON" (getenv "LMac\\ABBRotation"))
            )
            (LM:endundo (LM:acdoc))
        )
    )
    (princ)
)

 

Simply copy the above code on a new line at the end of my AutoBlockBreak program file, and call the program with 'inlfux' (or whatever command you wish to use)

Message 7 of 12
mid-awe
in reply to: Lee_Mac

Lee,

I'm only curious, and because of your kind nature I'll ask. Wouldn't it make good sense to entmake a wipeout and place it under all block entities? In my thinking the block could be moved anytime without adding a mend requirement? Also, just in the case that the length of the curve object is important for later calculations.

Likely difficult to do.

( BTW - I'm not saying that I could do it 😉 )
Message 8 of 12
Lee_Mac
in reply to: mid-awe

mid-awe wrote:
Lee,

I'm only curious, and because of your kind nature I'll ask. Wouldn't it make good sense to entmake a wipeout and place it under all block entities? In my thinking the block could be moved anytime without adding a mend requirement? Also, just in the case that the length of the curve object is important for later calculations.

Likely difficult to do.

( BTW - I'm not saying that I could do it 😉 )

 

This is indeed the route that some drawing offices follow - some use wipeouts, others use solids/traces with the colour set to 255,255,255. The main obstacle with using this method are plotting issues in which the wipeout or solid is plotted as a solid black object.

 

But, yes - a good suggestion Smiley Happy

 

Lee

Message 9 of 12
mid-awe
in reply to: Lee_Mac

Thank you 🙂
Message 10 of 12
bubba820
in reply to: darryl.m.bowen

Lee,

This code works great on my valve blocks, but not so good on my flange blocks. It does not break my flanges where I would like them to. The flange on the left is how yours does it but I need it to look like the flange on the right. Also, I have to shut off rotation because it will rotate the flange 90 degrees. Is there a way you can define which way the rotation of the blocks is?

 

Dave

 

auto-break.PNG

Message 11 of 12
Lee_Mac
in reply to: bubba820

bubba820 wrote:

Lee,

This code works great on my valve blocks, but not so good on my flange blocks. It does not break my flanges where I would like them to. The flange on the left is how yours does it but I need it to look like the flange on the right. Also, I have to shut off rotation because it will rotate the flange 90 degrees. Is there a way you can define which way the rotation of the blocks is?

 

Hi Dave,

 

As briefly noted on my site, the method used by the program to trim the objects surrounding the block is to obtain the dimensions of the rectangular bounding box of the block at zero rotation, transform this bounding box to account for the block rotation, scale and orientation, and then test for intersections between the bounding box and a selection set of the surrounding objects.

 

This method has the advantage of being relatively quick and requiring no user input to determine the break points, however, since the rectangular bounding box is used, this method assumes that the surrounding objects should be trimmed level with the extremeties of the block - which is great for convex blocks, but does not always produce the desired result for blocks with concave sections - this is unfortunately an inherent restriction of the program.

 

Regarding the block rotation, simply rotating the objects in your block definition should easily resolve this problem (i.e. the block at zero rotation should be how you want it to appear on a horizontal line).

 

I hope this helps.

 

Lee

 

Message 12 of 12
stevor
in reply to: bubba820

To make the cutting box large enough,

you might need to use a 'convex hull'

info of which is also at LeeMac's, etal.

S

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost