reza Posted August 26, 2022 Author Posted August 26, 2022 HI marko: it's completely correct. Thanks again for your help. Quote
marko_ribar Posted August 27, 2022 Posted August 27, 2022 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 1 Quote
reza Posted August 27, 2022 Author Posted August 27, 2022 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. Quote
marko_ribar Posted August 27, 2022 Posted August 27, 2022 Just slightly better... pts_along_pipe_trees_by_length.lsp Quote
marko_ribar Posted August 27, 2022 Posted August 27, 2022 Another update... pts_along_pipe_trees_by_length.lsp Quote
reza Posted August 28, 2022 Author Posted August 28, 2022 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 Quote
marko_ribar Posted August 28, 2022 Posted August 28, 2022 (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 August 30, 2022 by marko_ribar Quote
marko_ribar Posted August 28, 2022 Posted August 28, 2022 I've updated few times last *.lsp... Had some minor lacks... Sorry, but that's unavoidable when debugging... M.R. Quote
reza Posted August 28, 2022 Author Posted August 28, 2022 I am really grateful to you. I have saved all the sent versions. Quote
marko_ribar Posted August 31, 2022 Posted August 31, 2022 (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 September 1, 2022 by marko_ribar Quote
marko_ribar Posted September 2, 2022 Posted September 2, 2022 (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 September 2, 2022 by marko_ribar Quote
reza Posted September 3, 2022 Author Posted September 3, 2022 (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 September 3, 2022 by reza Quote
marko_ribar Posted September 3, 2022 Posted September 3, 2022 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 Quote
reza Posted September 4, 2022 Author Posted September 4, 2022 It is true. Because I check it on another system and the result was correct. Quote
Tsuky Posted September 6, 2022 Posted September 6, 2022 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 1 Quote
marko_ribar Posted September 7, 2022 Posted September 7, 2022 (edited) One more revision... I hope it's now even better than before... pts_along_pipe_trees_by_length.lsp Edited October 4, 2022 by marko_ribar 1 Quote
reza Posted September 9, 2022 Author Posted September 9, 2022 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). Quote
marko_ribar Posted September 9, 2022 Posted September 9, 2022 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 ) ) Quote
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.