therock005 Posted May 12, 2010 Share Posted May 12, 2010 Suppose you have two seperate non-linear objects. At different points on the geometry of each object you get different distance between them. How can you find the least distance between them, i.e. the points on each of object in which the distance is the minimum of all possible distances? EDIT: I am adding the picture example So there's a crircle and a spline. And then there's three possible distances between them, from which the one marked red is the least from them. But the thing required here is the ABSOLUT minimum distance of all possible solutions for this problem, or any similar problem given two objects. Quote Link to comment Share on other sites More sharing options...
fahim108 Posted May 12, 2010 Share Posted May 12, 2010 Hmm... now this is tricky! Frankly, I'm not that good in Cartesian Geometry but as far as AutoCAD is concerned, I can suggest you a work-around. Make a polyline starting from 1 and hit a perpendicular at 2, repeat this for 3, then 4 and go on until you find no apparent difference in the location of the newer points. I know, a bit crude way, but that's the best that I can offer! Quote Link to comment Share on other sites More sharing options...
MikeScott Posted May 12, 2010 Share Posted May 12, 2010 Draw a line from Centerpoint of arc to centerpoint of arc, then trim it off at the arcs, and that line will represent the closest distance. If there's no way to get two centerpoints, then Fahim's answer is as good as any I can come up with... Perhaps you could run a perpendicular line from the centerpoint of the circle, and it might nail it for you.. never tried that because I always have the two centerpoints. *update* I tried it, and it worked like a charm, so if there's only one centerpoint availible, you do a line from that CENterpoint to PERpendicular to the other object. Thanks Fahim! Quote Link to comment Share on other sites More sharing options...
lpseifert Posted May 12, 2010 Share Posted May 12, 2010 Try this, compliments from guys at theSwamp MinDist.lsp Quote Link to comment Share on other sites More sharing options...
fahim108 Posted May 12, 2010 Share Posted May 12, 2010 ...Try this, compliments from guys at theSwamp...Reports the following error: Command: md Error: Automation Error. No database; error: An error has occurred inside the *error* functionAutoCAD variable setting rejected: "lunits" nil Quote Link to comment Share on other sites More sharing options...
MikeScott Posted May 12, 2010 Share Posted May 12, 2010 ooh the error had an error within another error, but that's ok because it managed to replicate itself all over your harddrive first. :wink: Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 12, 2010 Share Posted May 12, 2010 I did this a while back (just playing around)... http://www.theswamp.org/index.php?topic=30812.0 Quote Link to comment Share on other sites More sharing options...
lpseifert Posted May 12, 2010 Share Posted May 12, 2010 ooh the error had an error within another error, but that's ok because it managed to replicate itself all over your harddrive first. :wink: An attempt at humor or what? I get no error here. Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 12, 2010 Share Posted May 12, 2010 An attempt at humor or what?I get no error here. Works for me too. Quote Link to comment Share on other sites More sharing options...
MikeScott Posted May 12, 2010 Share Posted May 12, 2010 I was joking about the error message that Fahim posted above mine. The error that seemed, (to my non-code savy self) to come from within the error handler while it was handling another error. We recently had a discussion about LSP viral programming, so I made a joke about it. I meant no offense by it. I don't try LSP scripts because I'm on 2004, and most newer ones won't work for me anyways. (plus my solution for this is quick enough for me anyways, though it might not work on some shapes). Maybe it uses something in Civil 3d that's not in the standard 2008 release? The other person (non-civil 3d) got the error, while two Civil 3d 2008 folks apparently didn't get the error. Could be a million other things I guess, but without more info, that's the first thing I see as far as troubleshooting the error. Quote Link to comment Share on other sites More sharing options...
therock005 Posted May 13, 2010 Author Share Posted May 13, 2010 Thank you guys for your usefull responses. I tried the lisp that was upped here. So let me guess how it works. Ir calculates all possible perpendicular distances between the two objects and then compares them to find the least one? I would also like to tryyours too alanjt. What do you mean on your post that your routine needs the AT subroutine? What is this subroutine good for? Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 13, 2010 Share Posted May 13, 2010 I would also like to tryyours too alanjt. What do you mean on your post that your routine needs the AT subroutine? What is this subroutine good for? It's a selection subroutine. Follow the link provided, save the subroutine in the same file as the Intersection file and load. However, the other posting is a lot nicer. Mine was just a proof-of-concept that I did a while back. I was just posting it as another example. As you can see in the video, they do basically the same thing. Quote Link to comment Share on other sites More sharing options...
therock005 Posted May 14, 2010 Author Share Posted May 14, 2010 It's a selection subroutine. Follow the link provided, save the subroutine in the same file as the Intersection file and load. However, the other posting is a lot nicer. Mine was just a proof-of-concept that I did a while back. I was just posting it as another example. As you can see in the video, they do basically the same thing. Well it'd be nice to give yours a try too. It looks neat as well, it even creates the intersecion points and a report window. :wink: But you mean to save the subroutine in the same folder or destination? If i save it on the same file as the lisp it will overwrite the lisp leaving me with no main routine to execute! Quote Link to comment Share on other sites More sharing options...
fahim108 Posted May 14, 2010 Share Posted May 14, 2010 ...Try this, compliments from guys at theSwamp... I stand to correct my earlier observation, this Lisp does work. However, I first ran in on Windows 2000, where it crashed. But on XP, the story is different Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 14, 2010 Share Posted May 14, 2010 Well it'd be nice to give yours a try too. It looks neat as well, it even creates the intersecion points and a report window. :wink: But you mean to save the subroutine in the same folder or destination? If i save it on the same file as the lisp it will overwrite the lisp leaving me with no main routine to execute! Either way will work, but what I said is correct. Copy the subroutine and paste the contents in the intersection file (appending to existing data, not overwriting). LISP files can be viewed like text files, just scroll to the bottom and paste the contents of the sub. Quote Link to comment Share on other sites More sharing options...
therock005 Posted May 14, 2010 Author Share Posted May 14, 2010 Oh right that's what you meant. I misunderstood you, sorry! Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 14, 2010 Share Posted May 14, 2010 Oh right that's what you meant. I misunderstood you, sorry! No worries. Did you get it to work? Quote Link to comment Share on other sites More sharing options...
therock005 Posted May 15, 2010 Author Share Posted May 15, 2010 I Will try it on Monday as i'm away from my office pc right now! Will keep you posted with my feedback though. Quote Link to comment Share on other sites More sharing options...
neodd70 Posted April 26, 2018 Share Posted April 26, 2018 I realize this is an old post but the minDist lisp function mentioned in here is very close to what I need and I was wondering if it could be altered for what I need or if there is maybe something else that would work better. I'm new to writing code so I can fumble thru simple routines but the complicated ones still stump me. What I am looking for is a lisp routine that would let me window select multiple entities (polylines, circles, arcs, splines) could be as few as 2 but as many as 30 or 40 and they could be closed or open, and have it determine and tell me if any of the entities are closer than a specified distance and if so maybe draw a line in red at the point or points that the entities are too close. Any help would be greatly appreciated. TIA Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 27, 2018 Share Posted April 27, 2018 Its a complicated question, is it comparing one object or all Objects to each other ? 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.