Jump to content

Recommended Posts

Posted

HI marko:

it's completely correct.👌👌👌👏👏👏

 

Thanks again for your help.

Posted

I've tried to develop it further more, but still it only works well on small distances involving only up to 2 branching... Still, I managed to utilize Djikstra algorithm with triangulation and this version could be used for further develop, as it has IMHO all that is needed for multiple wide branching, but with large inputs, in some cases it goes to endless loop and all you can do is terminate CAD... But, all in all, it is the best for now from me, and I do suggest that if someone is willing to step in, try to overcome problems within this code as a basis one...

 

Regards, M.R.

pts_along_pipe_trees_by_length.lsp

  • Thanks 1
Posted

Your sense of perfectionism is commendable.

 

The problem started here:

Suppose we want to determine the location of fire hydrants for a city pipe network.

According to the standard, each fire hydrant covers 1500 meters from its surroundings.

So, with a 1500-meter buffer, the range of the first valve is determined, and with a 3000-meter buffer, the installation location of the next valve is determined.

Please see link below (Maybe it can show the issue better) :

As it is clear in the video, we can use the distance (length) parameter instead of the time parameter.

You solved my problem in AutoCAD perfectly.

 

Posted

Dear Marko:
I don't know about the changes you make in the code.
But when I use it, the answer is completely correct.🙏🙏🙏
You are raining bombs, Marko😀😀😀

Posted (edited)

I've removed Djikstra algorithm and finally reduced and debugged final version... Still on some situations it just won't find, but should not mess if founded points and should never go into endless loop...

 

That's all...

M.R.

HTH.

 

 

 

 

 

pts_along_pipe_trees_by_length.lsp

Edited by marko_ribar
Posted

I've updated few times last *.lsp... Had some minor lacks...

Sorry, but that's unavoidable when debugging...

 

M.R.

Posted

I am really grateful to you.
I have saved all the sent versions.

Posted (edited)

Finally I've cobbled final version - it uses different - recursive method... It's pretty complicated, but somehow I've managed to overcome all possible situations that could be problematic... No Djikstra, just combinations between subs and recursion in some of them...

Regards, M.R.

HTH.

 

pts_along_pipe_trees_by_length.lsp

Edited by marko_ribar
Posted (edited)

I've implemented support and for SPLINE entities - all curve types should be processed like supposed to...

Dialog box is not an option - keyboard input is much faster IMHO...

Though I removed unnecessary defuns, it still is quite huge for a standard LSP file - now it's over 50K... I think that this is now the end of this topic, but who knows - we never know...

 

Regards, M.R.

 

pts_along_pipe_trees_by_length.lsp

Edited by marko_ribar
Posted (edited)

HI Dear Marko

Unfortunately, the last code does not work correctly.

Is it possible to set the entered parameters such as length and color as default?

And don't exit the program until the user specifies a new point.

And the sent code affects the other polylines in the dwg.

THX 🙏🙏

 

IDEA Network Topology.dwg

Edited by reza
Posted

Look, reza...

It works... It's just that your CAD may be overloaded with other functions or routines that are autoloading at startup... It happens to me too, but for debugging purposes and working tasks, I have setup without other LSP that may consume memory... That could be the case and with you... I've tested routine very thoroughly and should perform well in any situation... Here is your DWG with 1250 DWG units like you tried...

M.R.

IDEA Network Topology-reza-check.dwg

Posted

It is true.
Because I check it on another system and the result was correct.🙏🙏

Posted

Hi all, is my first post here: I'am CADaSchtroumpf on forum AutoDesk.

My try
For a speed of execution it is asked to select only the polylines likely to be concerned by the iso-distance search
Then the base/reference point of the measurement.
This base point can be anywhere, if it is not at the origin or at the end of the polyline, it will be cut (but preserving the Map object data and/or the Xdata)
You will also be asked for a fuzz for equality: network in large coordinates or standard.

If a secondary polyline is not attached to a vertex of the primary polyline, a vertex will be inserted at this node.
Tree research is done at all levels.
In the end points are created at the iso-distance of the base point.

iso_distance.fas

  • Like 1
Posted

Hi dear Marko_Ribar:

Is it possible to set the entered parameters such as length and color as default?

And don't exit the program until the user specifies a new point (while).

Posted

In short, yes...

 

Remove "dddd" and "c" variables from main (defun c:...) localization, and replace this part of the code :

 

  (if
    (and
      (setq bp (getpoint "\nPick or specify main base point : "))
      (not (initget 6))
      (setq dddd (cond ( (not (setq dddd (getdist bp "\nPick or specify length from base point for spread around <1.0> : "))) 1.0 ) ( t dddd )))
      (not (initget "Yes No"))
      (setq ch (cond ( (not (setq ch (getkword "\nDo you want to overmake new polylines up to resulting points [Yes / No] <Yes> : "))) "Yes" ) ( t ch )))
      (if (= ch "Yes")
        (progn
          (initget 6)
          (setq c (cond ( (not (setq c (getint "\nSpecify color for new polylines <3> : "))) 3 ) ( t c )))
        )
        t
      )
      (if (= ch "Yes")
        (progn
          (initget "Yes No")
          (setq chh (cond ( (not (setq chh (getkword "\nDo you want to explode all entities before main processing [Yes / No] <Yes> : "))) "Yes" ) ( t chh )))
        )
        t
      )
      (if (= ch "Yes")
        (progn
          (initget "Yes No")
          (setq chhh (cond ( (not (setq chhh (getkword "\nDo you want to convert all entities to SPLINES - resulting in new SPLINE curves before main processing [Yes / No] <No> : "))) "No" ) ( t chhh )))
        )
        t
      )
    )

 

With this :

 

  (while
    (and
      (setq bp (getpoint "\nPick or specify main base point : "))
      (not (initget 6))
      (or dddd (setq dddd (cond ( (not (setq dddd (getdist bp "\nPick or specify length from base point for spread around <1.0> : "))) 1.0 ) ( t dddd ))))
      (not (initget "Yes No"))
      (setq ch (cond ( (not (setq ch (getkword "\nDo you want to overmake new polylines up to resulting points [Yes / No] <Yes> : "))) "Yes" ) ( t ch )))
      (if (= ch "Yes")
        (progn
          (initget 6)
          (or c (setq c (cond ( (not (setq c (getint "\nSpecify color for new polylines <3> : "))) 3 ) ( t c ))))
        )
        t
      )
      (if (= ch "Yes")
        (progn
          (initget "Yes No")
          (setq chh (cond ( (not (setq chh (getkword "\nDo you want to explode all entities before main processing [Yes / No] <Yes> : "))) "Yes" ) ( t chh )))
        )
        t
      )
      (if (= ch "Yes")
        (progn
          (initget "Yes No")
          (setq chhh (cond ( (not (setq chhh (getkword "\nDo you want to convert all entities to SPLINES - resulting in new SPLINE curves before main processing [Yes / No] <No> : "))) "No" ) ( t chhh )))
        )
        t
      )
    )

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...