Message 1 of 31
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
Is there a LISP that connects lines to the base point of a block? See attached pictures.
Solved! Go to Solution.
Hi all,
Is there a LISP that connects lines to the base point of a block? See attached pictures.
Solved! Go to Solution.
Done.
From the picture called "whatiwant" assuming that you already have it.
Please mark my answer as a solution if my answer helped you realize that you already have what you want.
Edit: You need to do a better job with an explanation because your initial attempt says literally nothing.
That is what can be done by hand yes.... I would like to have a lisp because i have hundreds of these.
So i have some hundreds of these blocks, which represent swirls, those lines represent pipes. But these lines need to be connected to the exact center of the blocks. They are mostly a few centimeters away. This is a somewhat time consuming job and boring job to do. So a LISP would help me a lot
@nkamphui wrote:Hi all,
Is there a LISP that connects lines to the base point of a block? See attached pictures.
Try this
(defun bbp ()(trans (cdr(assoc 10 (entget(car(entsel)))))0 1))
(setq p (bbp))
(bbp)
Usage. When asked to enter next point enter (bbp) into console line i.e.
Command: pline
ENTER to use last point/Follow/<Start of polyline>:
Current Lineweight: 0
Arc/Distance/Follow/Halfwidth/Width/<Next point>: (bbp)
You can use option (setq p (bbp)) to store block base point into variable p and use it in cpmmand
Command: (setq p (bbp))
Select entity: (573399. 5.08632E+006 0.000000)
an then use !p when needed
Command: circle
2Point/3Point/Ttr(tan tan radius)/Arc/Multiple/<Center of circle>: !p
2Point/3Point/Ttr(tan tan radius)/Arc/Multiple/<Center of circle>: (573399. 5.08632E+006 0.000000)
Miljenko Hatlak
...and how exactly did you have that in mind?
Selecting the line & block to connect to? Might as well do it by hand.
Selecting all the lines and blocks that need connecting? That's a lot of work. Might as well do it by hand.
Select nothing, let the lisp sort it all out for you? That's a whole lot of work, Might as well...
Great, now we heading somewhere. You need to fix your drawing.
Post some dwg with few examples to get an idea of units, scales...
Noo that is not a problem at all. It can be directed differently to be able to align with the base point.
Have you tested provided code?
Miljenko Hatlak
Instead of an algorithm, try to think of a workflow for the lisp...
Easiest would be if you select both the line & block. Get the end or start point from the polyline, whichever is closest to the block, and then "copy" the basepoint coords to the polyline end or start point. Relatively easy to do with lisp, but as i said before, this will bring you nothing as you might as well click the end/startpoint grip and drop it on the basepoint grip, manually.
To do all, or a selection (of many) would save you some time and a lot of clicking, but if for just one drawing, it would take more time to write such a lisp, as it would to do it all by hand. (as you would need to get each polylines end or start point and then find the nearest block. Not impossible, but usefull ?
Hi, thanks for the reply. I am trying but can't get it to work. I think i am a noob.
Am i supposed to paste the first bit only?
This method will work while drawing, but this is a matter of 'repairing' what's already drawn.
The workflow as i would see it is to select all lines and blocks and then executing the lisp which connects the lines based on the end point (which is indeed determined by which is closest to a block). This routine will need to be executed for multiple drawings in the future i guess. But writing a new LISP for it would probably not be worth the time. I was just wondering if anybody already had one or this could be written easily.