Break without the command?

Discussion in 'AutoCAD' started by T.Willey, Feb 8, 2005.

  1. T.Willey

    T.Willey Guest

    I've been looking through post and the help, and haven't found anyway to break an object except with the command.

    I was just wondering if anyone has found a way to do it.

    Thanks.
    Tim
     
    T.Willey, Feb 8, 2005
    #1
  2. T.Willey

    cwitt Guest

    um.. I think you will have to give us a little more information as to
    what you are wanting..

    I don't see how anyone could break an object without using the command..
    (even custom break commands use the core cad version).

    AFAIK anyway.
     
    cwitt, Feb 8, 2005
    #2
  3. T.Willey

    Jeff Mishler Guest

    Well, a break command can be written......here's one for lines that I just
    whipped up. Arcs would need more work, and plines and other objects are even
    more work......but it is doable ;-)

    (defun c:mybrk (/ endpt line1 line2 pt1 pt2 ss startpt)
    (and (setq ss (ssget "s:" '((0 . "LINE"))))
    (setq line1 (vlax-ename->vla-object (ssname ss 0)))
    (setq pt1 (getpoint "\nFirst break point: "))
    (setq pt2 (getpoint pt1 ".....next break point: "))
    (setq pt1 (vlax-curve-getclosestpointto line1 pt1))
    (setq pt2 (vlax-curve-getclosestpointto line1 pt2))
    (setq startPt (vlax-get line1 'startpoint))
    (setq endPt (vlax-get line1 'endpoint))
    (setq line2 (vla-copy line1))
    (if (< (distance startpt pt1) (distance startpt pt2))
    (progn
    (vlax-put line1 'endpoint pt1)
    (vlax-put line2 'startpoint pt2)
    )
    (progn
    (vlax-put line1 'endpoint pt2)
    (vlax-put line2 'startpoint pt1)
    )
    )
    )
    (princ)
    )
     
    Jeff Mishler, Feb 9, 2005
    #3
  4. These kinds of posts always make me wonder -- what would be the reason
    someone would want to do what Break does, but not use Break to do it? It
    may well be possible to write something that will do it, but I'd be
    interested in what the benefit of that could be, that would overcome the
    obvious drawbacks.
     
    Kent Cooper, AIA, Feb 9, 2005
    #4
  5. T.Willey

    T.Willey Guest

    I just wanted to know, so that I could write a routine that didn't use any commands. Just a progression in code writing, but after reading the post, it just looks like to much work, to be able to catch all the occurrences that the routines might run into.

    Tim
     
    T.Willey, Feb 9, 2005
    #5
  6. T.Willey

    Joe Burke Guest

    Hi Kent,

    Obviously I can only speak for myself. I think the reason Tim asked is because he
    thought there might be a break "method". Certainly something I've wished for. Why?
    Because without it there's no alternative to command. And that means you are likely
    faced with setting and resetting things like osnap and cmdecho, which typically isn't
    needed if you are using vlisp.

    OK, in most cases that's not a big deal with an error handler. But try some code
    which allows the user to repeat the function until cancel or enter. And make it work
    so that each pass is undoable, rather than undo the function entirely. Also make sure
    each undo puts cmdecho and osnap back to the states they were before the function.
    The user can do five passes, undo three times, and everything works as expected.

    It's not a trivial exercise IMO. It would be moot point if we were not forced to
    resort to command functions in some cases, like this one.

    Regards
    Joe Burke
     
    Joe Burke, Feb 9, 2005
    #6
  7. T.Willey

    T.Willey Guest

    That was my main reason. Good catch Joe.
    I'm still learning all the abilitys of ActiveX and Vlisp stuff, so I wasn't sure if someone knew of a method using those ways that I didn't.

    Tim
     
    T.Willey, Feb 9, 2005
    #7
  8. Luis,
    on a different subject.
    Can you write something similar to the Gbound prog by Tovna but sell it for like $50 a seat instead of $300?
    It sounds like you have the subroutines to analyze lines/arcs and come up with internal shapes.
    I found the code to do it but its in C and I need to translate it.
    I'm just mentioning it because its an opportunity to make some money if you are already close.
    I'll be your first customer on it, Gbound is expensive, but super super slick and fast...
    thanks

    "Luis Esquivel" <>
    |>In my case, I need precision on breaking entities, exactly on each
    |>intersections, if I use the built-in command I required to zoom to the
    |>specific area, when to many objects are around to an intersection.
    |>
    |>In example, I have a routine that draws walls base on center lines, the
    |>program can be done by breaking at all intersections after doing an offset
    |>to both sides and at each node, then erase all the short lines or arcs
    |>leftovers.
    |>
    |>That would work in a simple layout, but is not the best solution.
    |>
    |>Now, if I do some calculations on each node, I can draw exactly all the
    |>elements that passes the node stop and continue on the right spot.
    |>
    |>In the case that the center lines form complex forms or areas that represent
    |>rooms or spaces and is to big in scale or to crowded.... break will not work
    |>properly and could produce undesired results.
    |>
    |>HTH

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Feb 9, 2005
    #8
  9. T.Willey

    James Allen Guest

    Trim/extend -method(s)- would also be nice.

    James Allen
     
    James Allen, Feb 9, 2005
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.