Author Topic: To draw the shortest path on the network!!!  (Read 2753 times)

0 Members and 1 Guest are viewing this topic.

Franci

  • Guest
To draw the shortest path on the network!!!
« on: August 22, 2019, 03:12:24 AM »
Hello everybody!
I need a help to develop a lisp...
I haven't the ability to write this lisp, because it's too hard for me and my level...

The lisp should draw a polyline between two points only passing through on the network.
This lisp should also register in txt the length of the path and every chosen lines/polylines where the path is passed (information). 

It is given: the network, the starting point and the end point.
It is necessary: to draw the shortest path passing through the network and to save the information.

The lisp should look like this lisp in the following link:
https://knowledge.autodesk.com/support/autocad/learn-explore/caas/screencast/Main/Details/976eb40c-909d-47d2-afc9-ac7cbeb5ad8a.html

I think, it is necessary to pay attention on length of the path.

(The network can be built with any set of lines/polylines, instead, the starting and end point are choose by the user each time.

Thanks you very much in advance for each tips.


Franci

  • Guest
Re: To draw the shortest path on the network!!!
« Reply #2 on: August 22, 2019, 10:19:59 AM »
Thanks you, Dlanor.

The lisp does not, however, consider both polylines and lines, but one of the two. It also does not record the line that is running along the way.
Anyway this is a good start.

ronjonp

  • Needs a day job
  • Posts: 7526
Re: To draw the shortest path on the network!!!
« Reply #3 on: August 22, 2019, 11:35:58 AM »
Thanks you, Dlanor.

The lisp does not, however, consider both polylines and lines, but one of the two. It also does not record the line that is running along the way.
Anyway this is a good start.
The code here will draw the route.
http://www.theswamp.org/index.php?topic=45092.msg503931#msg503931
Adding lines should be fairly easy :) .. you need help figuring it out?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Dlanor

  • Bull Frog
  • Posts: 263
Re: To draw the shortest path on the network!!!
« Reply #4 on: August 22, 2019, 05:14:24 PM »
Thanks you, Dlanor.

The lisp does not, however, consider both polylines and lines, but one of the two. It also does not record the line that is running along the way.
Anyway this is a good start.

A line is an exploded single segment polyline and can be converted back.

Code - Auto/Visual Lisp: [Select]
  1. (setvar 'peditaccept 1)
  2. (setq ss (ssget "_X" '((0 . "LINE"))))
  3. (vl-cmdf "_pedit" "_M" ss "" "_J" "0" "")
  4.  

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18