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

Lisp to draw line between two lines - dividing space equally

48 REPLIES 48
SOLVED
Reply
Message 1 of 49
Anonymous
15870 Views, 48 Replies

Lisp to draw line between two lines - dividing space equally

Hi all,

 

 

First of all, Thanks for the effort and time you spend for this AutoCAD community.

 

Can some body let me know if there is a lisp program to draw lines, exactly dividing ( the user should be able to input the number of spaces he/she wants between the lines) the space between 2 polylines /lines ( Parallel or on parallel). I am using the lisp LineBetween currently, but it has its own limitations, like it will not work when the UCS is rotated, the midway line created  is a LINE rather than a polyline  even if the original lines selected are polylines, etc.

 

Purpose:

 

I basically use this  to make concrete scoring while doing storefront concrete, where I have to tell the general contractor where to give construction joints/ control joints. Depending upon the structural stoop and building wall projections, I have to decide whether I have to divide the space equally in 2, 3, 4 parts, etc.

 

Any help in this regard is highly appreciated.

 

Regards,

 

VM

Tags (1)
48 REPLIES 48
Message 41 of 49
Kent1Cooper
in reply to: barry2104


@barry2104 wrote:

is it possible to extend this Lisp to be able to pick two curved polylines (e.g. two S-curves which run alongside eachother but not necessarily parallel to one another, but start and finish around the same chainage) and get the curved "midline" as a (polyline or likely rather spline) Output?....


 

You can use PathAverage.lsp with its PAv command, >here<.  Read some of the subsequent posts for more considerations.

Kent Cooper, AIA
Message 42 of 49
vladimir_michl
in reply to: barry2104

Message 43 of 49
barry2104
in reply to: vladimir_michl

Using that lisp, Output looked good at first glance, but upon closer inspection it's obvious that this doesn't work accurately (at least not for my curved Situation)

Here the red line (Output) doesn't cross through the midpoint of the selected line, and for the curved part of the Output, lies obviously Closer to the top black curve. Why is this?Unbenannt.JPG

Running AutoCAD Architecture 2020, in German
Message 44 of 49
Kent1Cooper
in reply to: barry2104


@barry2104 wrote:

.... the red line (Output) doesn't cross through the midpoint of the selected line, and for the curved part of the Output, lies obviously Closer to the top black curve. Why is this?


 

Assuming that routine works similarly to my PathAverage.lsp routine [link in Message 41 here], here's why:
PathAverage.PNG

It divides the two paths equally, and draws Lines between the corresponding division points [here, the green, though PathAverage doesn't actually draw  the Points].  Here, the highlighted/gripped red Line is between the Points at the mid-point of the overall length of each path.  The "contortion" in the relative shapes of the paths is what "throws off" the relative positions of equally-spaced locations along them.

 

So tell me, how did you come up with the locations at which to put the endpoints of the blue Line  in your image, that the averaged path doesn't go through the midpoint of?  It's not the shortest distance from either of its endpoints to the other path.  Where is the distance between paths to be measured for a midpoint along it, and how?  For more discussion on the difficulties of deciding the distance between two such paths, see >this<.

Kent Cooper, AIA
Message 45 of 49
barry2104
in reply to: Kent1Cooper

since the lines aren't parallel, one can not simply draw a line from one arc perpendicular to the other arc and take this midpoint, because this midpoint would vary depending on which of the arcs you started from.

Hence, to get that line, I drew a (yellow) line from the below Point 1 to (perpendicular to) 2, then continued in green to (perpendicular to) 3. Then i used a "middle line" Lisp to create the Magenta line between yellow and green, trimming it at the blue arc. The midpoint of this Magenta line (labelled M in the screenshot) is what the Lisp should calculate to depict a more accurate (nevertheless nicht perfect) representation of the midpoint line/arc.

The Lisp Looks to be currently flawed if it breaks each of the polylines up into the same number of segments - this gets less accurate with a larger difference in length between the two polylines.

Not sure how much effort it would be to use my calculation principle described above to rewrite the Lisp though...Unbenannt.JPG

Running AutoCAD Architecture 2020, in German
Message 46 of 49
vladimir_michl
in reply to: barry2104

You don't need to construct perpendiculars - for such cases the "rolling ball" algorithms are being used. Try to search for a Rolling Ball routine by John Leavines or by Lee Mac. The result of such routine:

 

rollingball.jpg

 

Vladimir Michl, www.cadstudio.cz  www.cadforum.cz

 

Message 47 of 49
barry2104
in reply to: vladimir_michl

Thankyou - that Rollin Lisp seems to be the solution I am looking for

 

http://cnc.rs/mechmate/rolling_ball_method.lsp

Running AutoCAD Architecture 2020, in German
Message 48 of 49
john.uhden
in reply to: barry2104

It is lisply posible.  It wouldn't be exact but I guess it might save you 5 seconds compared to doing it by eye.

Just how many construction joint figures do you have to split each day?

John F. Uhden

Message 49 of 49
barry2104
in reply to: john.uhden

On days it needs doing, maybe 50-100 times. But those days are not frequent
Running AutoCAD Architecture 2020, in German

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report