M76 Posted May 31, 2010 Share Posted May 31, 2010 I need to join lines together into one polyline. The problem is that sometimes if there is a T junction, it will join the branch line to either part of the main line. What do I need it to do to join the lines that are close to each other in angle, and keep the other ones seperate. ? Is there an option besides manual supervision of each joint? Quote Link to comment Share on other sites More sharing options...
mdbdesign Posted May 31, 2010 Share Posted May 31, 2010 Fillet with 0 radius? Quote Link to comment Share on other sites More sharing options...
M76 Posted June 1, 2010 Author Share Posted June 1, 2010 What do you mean? Fillet trims or extends two selected lines together, how could I use it for this purpose? The lines are already connected, I need to join the right ones into one polyline. Quote Link to comment Share on other sites More sharing options...
Tiger Posted June 1, 2010 Share Posted June 1, 2010 I'm wondering how you join the lines? Do you have an automation of some kind, a lisp or a macro? My way of doing this would be manual labour, and then I select the right lines from the start - but it sounds like you do it some other way? Quote Link to comment Share on other sites More sharing options...
M76 Posted June 1, 2010 Author Share Posted June 1, 2010 There are a couple hundred files, and each with thousands of lines, manual labour is out of the question. Especially because this routine has to be completed on a file each time its changed. If there is no other way I'll have to compare the angle of each line ending in a lisp, and determine which ones to join. This is only a small part of a bigger project. I need to create buffer zones around the lines, and if the lines don't connect correctly the buffer won't look right at these junctions. Quote Link to comment Share on other sites More sharing options...
M76 Posted June 1, 2010 Author Share Posted June 1, 2010 Here is an example what will happen if the lines are joined incorrectly, and how it should look when the lines are connected the right way. Quote Link to comment Share on other sites More sharing options...
eldon Posted June 1, 2010 Share Posted June 1, 2010 Can you leave a gap where the branch line joins, of half the width of your polyline. Then the gap would not show and the branch line would not join. Quote Link to comment Share on other sites More sharing options...
M76 Posted June 1, 2010 Author Share Posted June 1, 2010 The files are given. Creating a gap is only replacing the problem with another one that isn't any easier to implement. Quote Link to comment Share on other sites More sharing options...
Tiger Posted June 1, 2010 Share Posted June 1, 2010 If there are hundreds of files and thousands of lines - will it make a difference how the joining is done, really? I bet you that everyone here is a stickler for it being exact - even when it really doesn't matter (89.5degrees is NOT 90 - but it's enough most of the times). Would the work you have to put into writing a lisp that determines what lines to join be worth it in the end? Quote Link to comment Share on other sites More sharing options...
M76 Posted June 1, 2010 Author Share Posted June 1, 2010 If there are hundreds of files and thousands of lines - will it make a difference how the joining is done, really? Being a wiseguy about it won't help in making your point. Of course it makes a difference, if there were only a few lines the logical solution would be to do it manually. Would the work you have to put into writing a lisp that determines what lines to join be worth it in the end? Its not the point, the reason I opened the topic is to find out, if there is any other solution. It needs to be done the question is only about the how. Writing this algorithm isn't something that can be done in five minutes, so if possible I'd have liked to avoid it. Quote Link to comment Share on other sites More sharing options...
M76 Posted June 1, 2010 Author Share Posted June 1, 2010 Anyway since there were no real ideas, I've started to create the routine. Quote Link to comment Share on other sites More sharing options...
eldon Posted June 1, 2010 Share Posted June 1, 2010 Anyway since there were no real ideas, I've started to create the routine. In the light of some of your responses, it would be a brave person who would suggest any more ideas. As you say, better to go for the routine. Best of luck. Quote Link to comment Share on other sites More sharing options...
Tiger Posted June 1, 2010 Share Posted June 1, 2010 Being a wiseguy about it won't help in making your point. Of course it makes a difference, if there were only a few lines the logical solution would be to do it manually. Its not the point, the reason I opened the topic is to find out, if there is any other solution. It needs to be done the question is only about the how. Writing this algorithm isn't something that can be done in five minutes, so if possible I'd have liked to avoid it. Hundreds of files and thousands of lines was your words, not mine. I apologise if my remark came off as 'wise guy'-ish - that was not my intent. I have stared myself blind at small faults myself just to after an hour or two realise that it will not make the slightest different in the end - since the answers you have gotten point towards that there is no easy solution, my question was to perhaps make you see if it was the same case with you now. Since you say that it does indeed make a difference, I wish you good luck in making the algorithm - that kind of programming is far above my head so I bow out here. Quote Link to comment Share on other sites More sharing options...
ReMark Posted June 1, 2010 Share Posted June 1, 2010 Hundreds of files and thousands of lines and how many intersections and endpoints will you have to analyse and then join? And how will you verify that it has been done correctly or to your satisfaction? What if the junction is made to the wrong branch? Sounds like you need a program with some artificial intelligence incorporated within it. Quote Link to comment Share on other sites More sharing options...
M76 Posted June 2, 2010 Author Share Posted June 2, 2010 Hundreds of files and thousands of lines and how many intersections and endpoints will you have to analyse and then join? And how will you verify that it has been done correctly or to your satisfaction? What if the junction is made to the wrong branch? Sounds like you need a program with some artificial intelligence incorporated within it. The important thing is to join the lines that have a smaller difference in angles. That can be determined by comparing the last/first segment of the three connecting lines, there is no intelligence required for that. I've finished the routine and it works, if anything that should be proof enough that it can be done. Its brute force, and its ugly, and probably can be done much more efficiently, so I won't bother posting it. Also its map3d specific. Quote Link to comment Share on other sites More sharing options...
ReMark Posted June 2, 2010 Share Posted June 2, 2010 Well thank you for sharing the fact that it can be done. I'm disappointed you won't share your solution with the CAD community here at CADTutor. Now if someone here had come up with a solution you would have expected them to share it with you right? Right. Yeah, I thought so. Quote Link to comment Share on other sites More sharing options...
M76 Posted June 2, 2010 Author Share Posted June 2, 2010 I would have posted it if I thought anyone would benefit from it. But since, you asked so nicely The map_clean and make-vert-list functions are not written by me, but since its useless without them I included those too. But a word of warning, its not tested thoroughly, and the running time exponentially increases with the number of lines. It takes 3-5 minutes with 200 polylines. I didn't test it with anything more than that, but I assume the time could go up to hours with enough plines. join.lsp Quote Link to comment Share on other sites More sharing options...
ReMark Posted June 2, 2010 Share Posted June 2, 2010 M76: Thank you for posting the lisp routine. I'm sure someone else may derive some benefit from it as well. 3-5 minutes for 200 polylines? I can only imagine what it might take for thousands of polylines then. Aren't you afraid you'll lock up your system? What do you do while it is working away at the problem in the meantime? I hope you have a dedicated machine that can concentrate on those hundreds of files you mentioned. Brute force you say? I say as long as it works who cares how ugly it is right? Thanks again. Quote Link to comment Share on other sites More sharing options...
M76 Posted June 2, 2010 Author Share Posted June 2, 2010 M76: Thank you for posting the lisp routine. I'm sure someone else may derive some benefit from it as well. 3-5 minutes for 200 polylines? I can only imagine what it might take for thousands of polylines then. Aren't you afraid you'll lock up your system? What do you do while it is working away at the problem in the meantime? I hope you have a dedicated machine that can concentrate on those hundreds of files you mentioned. Autocad locks up more times than I could count anyways. I'm not concerned with speed since its not even working correctly yet I mean the whole thing, not the joining. Joining the lines takes very little time compared to what autocad spends with unioning 2-3000 regions. That is if it not fails with an edge inconsistency error, which I'm yet to find a way around. Quote Link to comment Share on other sites More sharing options...
ReMark Posted June 2, 2010 Share Posted June 2, 2010 Sounds like you might have more tinkering to do. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.