See the top rated post in this thread. Click here

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: Insert block and break any line in its way

  1. #11
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    1

    Default Re: Insert block and break any line in its way

    OK I tried to write a solution that would trim lines that pass through a symbol.

    What I came up with is this.

    In the routine you select the block and all the linework running through the symbol.

    The routine creates a temporary block definition and uses the copyobject method to copy the block into the definition.

    It creates a bounding circle around the symbol in the temp block definition.
    Centered on the middle of the bounding box around the symbol and passing through the points of the bounding box.

    It then copy one line at a time each of the lines passing through the symbol. Runs multiple intersect with methods on each. Saving each intersecting point as a parameter on the line. If the line only passes through the bounding circle once it adds its own end param inside the circle to the list of params.

    It then sorts the list of param's and takes the max and min values converts them back into points and breaks the linework in the drawing (not the temp block)

    It then deletes the line in the temp block and copyobjects another line into the block and repeats the process.

    It doesn't work for minserts and it apparently doesn't line blocks without uniform x and y scale factors.

    Try it out, at least it works for fairly uniform blocks I have tried it on.

    Peter
    Attached Files Attached Files

  2. #12
    I could stop if I wanted to jgratton's Avatar
    Join Date
    2002-07
    Location
    Calgary, Canada
    Posts
    397
    Login to Give a bone
    0

    Default Re: Insert block and break any line in its way

    Command: trimins
    Select Block:
    Select objects: Specify opposite corner: 1 found
    Select objects: Specify opposite corner: 1 found, 2 total
    Select objects:
    no function definition: LISTTOSAFEARRAY
    Command:

    Can I defun all the block names I need to break somewhere in this lisp? I'll send you this test drawing to show you what I need.

    Thanks for your help Peter.
    Attached Files Attached Files

  3. #13
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Insert block and break any line in its way

    Try this version.

    It worked to me.

    Peter
    Attached Files Attached Files

  4. #14
    I could stop if I wanted to jgratton's Avatar
    Join Date
    2002-07
    Location
    Calgary, Canada
    Posts
    397
    Login to Give a bone
    0

    Default Re: Insert block and break any line in its way

    It breaks to the first crossing, which would work for some blocks except the ones that cross the line more than once. Also it appears to break only one line not a second one that may cross or adjoin.

  5. #15
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Insert block and break any line in its way

    Can you email me a drawing with the results you are seeing.

    You can send it to me offline if you like. peter@cordecksales.com

    When I insert the sw3wayr-va block into the drawing you send me before it trimmed it perfectly.

    It actually checks every time any "line" or "arc" objects in the block cross a the underlying wide lines.

    Peter

    Are you running any osnaps? like endpoint? You would have to turn them off, or add a line to the program to turn them off during the breaking commands.

  6. #16
    I could stop if I wanted to jgratton's Avatar
    Join Date
    2002-07
    Location
    Calgary, Canada
    Posts
    397
    Login to Give a bone
    0

    Thumbs up Re: Insert block and break any line in its way

    Quote Originally Posted by peter View Post
    Are you running any osnaps? like endpoint? You would have to turn them off, or add a line to the program to turn them off during the breaking commands.
    That's the ticket! I needed to run this on a 3 party app and their programming is very osnap-happy!

    I met you at Au 2005. This year I'll buy you a

    In the meantime, thank you very much.

  7. #17
    I could stop if I wanted to jgratton's Avatar
    Join Date
    2002-07
    Location
    Calgary, Canada
    Posts
    397
    Login to Give a bone
    0

    Default Re: Insert block and break any line in its way

    Ok, I have trimins.lsp loading in the mnl file and put these 3 lines at the top of your lisp
    (defun c:tr42std0000103_049()(Trimins "tr42std0000103_049" )(PRINC))
    (defun c:tr42std0000103_051()(Trimins "tr42std0000103_051" )(PRINC))
    (defun c:tr42std0000103_052()(Trimins "tr42std0000103_052" )(PRINC))

    And in my tool palettes I have the following macros:

    ^c^cosmode;0;;Trimins;;osmode;31743;;

    It returns the following:

    Command:
    OSMODE
    Enter new value for OSMODE <0>: Trimins

    Requires an integer between 0 and 32767.

    Enter new value for OSMODE <0>: *Cancel*

    Command: *Cancel*

    Command:
    Command:
    Command: osmode

    Enter new value for OSMODE <0>: 0


    It is skipping over the trimins command and doesn't return the osmode to "select all"

    I haven't a clue how to fix this! Probably something simple I am missing.

  8. #18
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Insert block and break any line in its way

    Take out the OSMode from the macro I put them into the lisp routine and modified the routine to allow you to pass a block name to it.

    ^c^c(trimins2 "tr42std0000103_049" );

    if "tr42std0000103_049" is the block name.

    Peter
    Attached Files Attached Files

  9. #19
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Insert block and break any line in its way

    A couple more bugs fixed.

    Remember this routine will have a little trouble with very short lines that stop inside the symbol.

    Otherwise it seems to work well.

    I am working on the very short line issue.

    Version 3

    Peter
    Attached Files Attached Files
    Last edited by peter; 2007-10-06 at 10:15 PM.

  10. #20
    Woo! Hoo! my 1st post
    Join Date
    2007-11
    Posts
    1
    Login to Give a bone
    0

    Smile Re: Insert block and break any line in its way

    I want to thank you gentlemen for this routine you developed as it is exactly what I've been looking for a great while. I tested and tried the routine and fantastic!!!
    Hats off to all of you!!!

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Insert unique block at each end of newly created line
    By jpcadconsulting347236 in forum AutoLISP
    Replies: 6
    Last Post: 2014-01-28, 06:51 PM
  2. LISP trim/break line inserting block
    By aldiyars1925 in forum AutoLISP
    Replies: 1
    Last Post: 2008-09-09, 01:33 PM
  3. insert block (all predefined) break line inserted on
    By Hammer.John.J in forum AutoLISP
    Replies: 84
    Last Post: 2007-11-08, 04:46 PM
  4. routine for insert block break line
    By Hammer.John.J in forum VBA/COM Interop
    Replies: 4
    Last Post: 2006-01-06, 02:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •