Search code examples
geometrylispautolisp

Trim VLA-OBJECTS Outside Circles automatically without selecting anything


what I want to do is to trim some polylines that are saved as VLA-OBJECTS, there is no problem on converting them into Entities, but what I graphically want is to trim my Image in the following way:

enter image description here

enter image description here

So as you can see I want to trim everything of the blue lines outside the red circles on the corners and I want to it automatically without selecting anything. For this purpose, I have stored the circle as a VLA-OBJECT, The blue polylines as independent VLA-OBJECTS, the centers of the circles, in fact everything on the first image is stored on memory as a VLA-OBJECT. So I was wondering if you can suggest any lisp routine to do it automatically?. I was thinking on using the Break command or the Extend command but I can not find a real solution. Many thanks in advance.


Solution

  • I have no time enought to prepare working sample code, but I may show You the way. I would try to make it in this way:

    You can find intersections of circles and lines.

    ( vlax-invoke-method circle 'IntersectWith BlueLine acExtendNone )
    

    break each blue line by this

    (foreach line BlueLines 
        (command "_break" line pt pt ) ; where pt is point returned by IntersectWith 
    )
    

    and the last step is to check if all entities created by _break are inside or outside circles.

    You don't have easy access to entities created by _break. to get them, You may use (entlast) before command _break. and (entnext) after that .