Author Topic: Help Finding Block Route  (Read 15122 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7327
Help Finding Block Route
« on: August 08, 2013, 12:55:21 PM »
So I'm drawing a blank on how to achieve the following result:
I have an existing route that consists of multiple polylines. There are multiple blocks that reside on this "route". The blocks need to traverse this existing route from their insertion point back to a user defined point.


Could someone help out or at least get me started on the thought process?


Attached is a drawing with a simple scenario.


Thanks :)

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

ronjonp

  • Needs a day job
  • Posts: 7327
Re: Help Finding Block Route
« Reply #1 on: August 09, 2013, 08:44:08 AM »
I guess it's not that easy to do.

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

hmspe

  • Bull Frog
  • Posts: 344
Re: Help Finding Block Route
« Reply #2 on: August 09, 2013, 09:35:25 AM »
If I understand what you are trying to do, random thought:

1.  Create a single pline that overlays the existing plines and follows the backbone for its entire length.  Reverse the pline if necessary so that it starts at the correct end.
2.  Use vlax-curve-getClosestPointTo on each block to get the apparent intersection with the working pline, then get the distance along the working pline from the pline start point to the apparent intersection.   Store the data in an array so that the block data and the distance along the working pline are kept together. 
3.  Determine if each block is to the left of the working pline, on the pline, or to the right of the pline.  Add to the data set for the block in the array.
4.  Sort  the array based on distance of the apparent intersection from the pline start point, closest to start point first.
5.  Iterate through the array.  For points on the left or on the line offset the pline to the left.  Keep a running counter so you can step the offsets by (N * offset distance).  Drop a line from the block to the offset pline.  Trim out the excess offset pline.  Same process on the right, but with a different counter and offsets to the right.
6.  Do whatever is necessary to clean up at the start point.

"Science is the belief in the ignorance of experts." - Richard Feynman

CAB

  • Global Moderator
  • Seagull
  • Posts: 10395
Re: Help Finding Block Route
« Reply #3 on: August 09, 2013, 11:33:53 AM »
Ron,
I did not follow the explanation of what you are trying to do.  :(
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7327
Re: Help Finding Block Route
« Reply #4 on: August 09, 2013, 11:41:38 AM »
Charles,


Did you download the drawing ? I'm trying to tally wires (grey lines) that are run from each valve to a controller location, but these wire routes have to follow the shortest predetermined path back (white polyline).


Thanks :)

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

hmspe

  • Bull Frog
  • Posts: 344
Re: Help Finding Block Route
« Reply #5 on: August 09, 2013, 01:03:27 PM »
Ron,

What I posted earlier does not account for the pipes that are branches, but the general procedure should work.  Maybe check for tees and use each tee as a start point for a recursive run through the function.  If the diagram has branches off of branches it could get interesting. 

Two deadlines today so I can't play with this much.

Martin
"Science is the belief in the ignorance of experts." - Richard Feynman

ronjonp

  • Needs a day job
  • Posts: 7327
Re: Help Finding Block Route
« Reply #6 on: August 09, 2013, 01:06:05 PM »
Thanks for the reply Martin. Unfortunately these "networks" can be very complicated and could sometimes contain loops within loops :(.


Perhaps I've bit off more than I can chew. :)

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12514
  • London, England
Re: Help Finding Block Route
« Reply #7 on: August 09, 2013, 04:56:14 PM »
This reeks of Dijkstra's algorithm...
« Last Edit: August 09, 2013, 04:59:19 PM by Lee Mac »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10395
Re: Help Finding Block Route
« Reply #8 on: August 09, 2013, 05:37:41 PM »
Yep, looks like the solution.  ::)
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7327
Re: Help Finding Block Route
« Reply #9 on: August 10, 2013, 08:49:14 AM »
Thanks guys .. will take a look at it on Monday. Have a nice weekend.

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Help Finding Block Route
« Reply #10 on: August 10, 2013, 12:28:01 PM »
Yep, looks like the solution.  ::)

I don't understand, this:

This reeks of Dijkstra's algorithm...

Seems like a perfectly good response to the question:

Could someone help out or at least get me started on the thought process?

Amongst the other responses in the thread. It identifies the problem, a way to solve it and antes up pseudo code to boot.

What's the problem?
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

ymg

  • Swamp Rat
  • Posts: 725
Re: Help Finding Block Route
« Reply #11 on: August 10, 2013, 07:11:07 PM »
RonJomp,

Not sure If I follow you, but I believe you are after the Traveling Salesman Problem.

Here is a link  http://cadtips.cadalyst.com/linear-objects/tsp-problem to a routine that appeared
10 years ago in Cadalyst.

Still works ! that's the joy of Lisp.

ymg

CAB

  • Global Moderator
  • Seagull
  • Posts: 10395
Re: Help Finding Block Route
« Reply #12 on: August 10, 2013, 10:20:23 PM »
Yep, looks like the solution.  ::)

I don't understand, this:

 Just saying that the pseudo code Lee suggested looks like the solution to the problem.
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Help Finding Block Route
« Reply #13 on: August 10, 2013, 10:35:10 PM »
Just saying that the pseudo code Lee suggested looks like the solution to the problem.

Guess I just don't understand how you guys use rolling eyes anymore, seemed like the antithesis of a "Nice find Lee" sentiment.
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10395
Re: Help Finding Block Route
« Reply #14 on: August 11, 2013, 04:50:26 PM »
Just saying that the pseudo code Lee suggested looks like the solution to the problem.

Guess I just don't understand how you guys use rolling eyes anymore, seemed like the antithesis of a "Nice find Lee" sentiment.
Yea, I paid no attention to the "Rolling Eyes" but it looks up to Lee's post above mine. At least it does on my browser & settings.
Sorry for the confusion.
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.