Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. GLAVCVS

    Hybrid parallel

    Everything SLW210 has researched is very interesting. I had no idea this had been such a thoroughly discussed topic — and with such limited success. I guess that makes it even more interesting. In my opinion, it is possible to obtain a center polyline that is equidistant from both edges. But two conditions must be met: 1. The user must ensure that the geometry of both edges is correct: they must be 2D polylines with no repeated points and no geometric inconsistencies of any kind. And, in principle, to avoid extending the search for a solution, these polylines should not contain arcs. 2. One must accept that any edge containing “recesses” (“recodos”) must be handled using auxiliary axes. What is a recess? It is a geometric setback, in any direction, along one of the edges. For example: if you advance segment by segment along an edge (in either direction), the start of a recess would be defined as any vertex from which the shortest distance to the opposite edge forces the projection to intersect its own edge. My conclusion: for edges without recesses, I believe it is possible to find an equidistant centerline or axis. And for edges with recesses, although considerably more code will be needed, they should be solvable using auxiliary axes. I hope to have code soon that supports all of this.
  3. Today
  4. mhupp

    Hybrid parallel

    I think ronjonp posted something that if you clicked two points on a polyline it would find the shortest path. (traveling salesman) The method I was working on but haven't finished. two open polylines find start and end points of each test how they are oriented and revers one to use to make a closed polyline find the longest distance between the two original polyline divide that by like 500 and offset in using entlast and eventually will end (cant offset anymore) find the polyline with the lowest area but still has the same amount of vertex as the original boundary. using that smaller boundary to draw vector lines between smallest and original boundary. (where im at now) take all other polylines inside smallest and add them to a point list. remove any points that are Collinear with any of the drawn vector lines. this should leave only the points on the center line. starting at one end need to start group points that are Collinear to each other. of those points entmake a line on the farthest distance. these lines are incomplete segments or might not be touching and will need to be extended to each other or the vector lines or both. problem i am finding/trying to solve what slw210 pointed out about if two segments are close to being parallel points wont be found. need three points to calculate collinear working over a group of points to split out each segment.
  5. SLW210

    Export layers with objectdata to GIS format

    I just use the QGIS Import for drawings from AutoCAD and I get the layers. I think for surfaces, QGIS needs DEM, IIRC _SurfaceExportToDem is in Civil 3D. Maybe in QGIS Import the SHP or just the .dwg and Go to "Layer" then "Add Layer" then "Add Vector Layer". My QGIS is at home, so I think those steps are close.
  6. GLAVCVS

    Hybrid parallel

    The "removeDuplicates" function is missing.
  7. Hi all, I get a DWG with multiple layers with lines and such. Now... each line has Object Data linked to it. I need to make a export to GIS, where each layer is its own layer in QGIS. When i make a export to SHP or GML, and load it in QGIS, all layer informatie is gone and is put on only GIS layer. What is the most effective way to export AutoCAD layers to GIS layers?
  8. SLW210

    Hybrid parallel

    I have been trying to explain the issues to the OP to no avail. From what I gather from my daughter, her coworker does the centerlines in CAD not ArcGIS, then imports them. From what I gather, CAD is better for tweaking a more accurate line manually after running a LISP or other program. Which is apparently what some if not most of the surveyors, geologist, map/civil, etc. are doing no matter the GIS software or CAD software. Getting it close with a tool then tweaking it if needed, or probably if just a one time deal completely manually. I have a couple of new LISPs, I left one of them to draw a different centerline depending on which polyline is picked first, between the two centerlines, one goes close to perfect through the right curves, the other close to perfect through the left curves on the OPs AxisExample.dwg. As I posted, a Voronoi is what most of the tools use, apparently they can get off center as well, but generally work the best. The other option is to go LRM's method or along the lines of Jeffery P. Sanders rolling ball, but the rolling ball can take a while it seems to if looking for accuracy. Daniel's Python method would probably be the best IMO. I still plan on seeing QGIS results when I get the time.
  9. dexus

    Hybrid parallel

    Does it not create a polyline for you? I did post it without the 'animation' if that is what you mean.
  10. GLAVCVS

    Hybrid parallel

    Is it possible that your attached code is incomplete?
  11. dexus

    Hybrid parallel

    I copied another function of dijkstra's algorithm to find the shortest path. It might need a lot of optimization, but just as a proof of concept. centerline voronoi dijkstra.lsp
  12. dexus

    Hybrid parallel

    Using a voronoi diagram (code by ymg, ElpanovEvgeniy and Marko Ribar) You can get some very good reference points. Just have to find a way to get rid of all the 'branches' and then take al the midpoints of every line to get a good centerline. centerline-voronoi.lsp
  13. (defun C:123 () (setq ss (ssadd)) (setq i 0) (while (setq m (ssget)) ; selected group of line one by one or in group large scale (repeat (sslength m) (setq n (ssname m i)) (if (not (ssmemb n ss)) (progn (ssadd n ss) ;;;;;code ) ;progn (progn (princ) (print "/nduplicate selected line:") ) ;progn ) ;if (setq i (1+ i)) ) ;Repeat (setq i 0) ) ;while loop ) ;defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;case 2 ;;;;;Press the Enter key once to continue the loop, and press it twice to exit. (defun C:bm () (setq flag T) (while flag (setq obj (ssget "_:S")) (cond (obj ;CODE ) ;ar (t (princ "\nNo selection made.") (initget "X") (setq bm (strcase (getstring "\nEnter 'X' to exit or press Enter to continue [X]: "))) (if (= bm "X") (setq flag nil) ; Exit the loop if user types 'x' (princ "\nInvalid input. Please try again.") ) ;if ); seo cond ) );WHILE ) @BIGAL Test Lisp for reference. The selection set gradually increases, which takes a long time when it is large.
  14. BIGAL

    Toggle dimension LISP

    Something is missing here, in my code it was the call to the Radio button DCL (if (= but nil) (setq but 1)) (cond ((= counter 1) (dotl)) ....... You only set counter to 2 ? You could do a "enter number 1-5 or press enter" Enter will add 1 to counter value. Need to wrap in a while to do this.
  15. Yesterday
  16. ScottMC

    Toggle dimension LISP

    (defun c:dodimcorner-while (/ *error* ent obj entg dimsc but counter) (defun *error* ( msg ) (setvar 'cmdecho 0) ;; 5.28.24 (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (if msg (prompt (strcat "\n" msg))) (setvar 'cmdecho 1) (princ) ) (defun dotl (/) (setq tpos (mapcar '+ (cdr (assoc 13 entg)) (list 0 dimsc 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dotr (/) (setq tpos (mapcar '+ (cdr (assoc 14 entg)) (list 0.5 dimsc 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dobl (/) (setq tpos (mapcar '+ (cdr (assoc 13 entg)) (list 0.0 (- dimsc) 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dobr (/) (setq tpos (mapcar '+ (cdr (assoc 14 entg)) (list 0.0 (- dimsc) 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (setvar 'cmdecho 0) (setq counter 2) (while (setq ent (car (entsel "\nPick a dim "))) (setq entg (entget ent)) (setq obj (vlax-ename->vla-object ent)) (setq dimsc (vlax-get obj 'scalefactor)) (if (= but nil) (setq but 1)) (cond ((= counter 1) (dotl)) ((= counter 2) (dotr)) ((= counter 3) (dobl)) ((= counter 4) (dobr)) ) (setq counter (+ counter 1)) (if (= counter 5) (setq counter 1)) ) (setvar 'cmdecho 1) (*error* nil) (princ) ) ;;; UPDATE TO INCLUDE RESET ;; (defun c:dtf (/ *error* ent obj entg dimsc but counter) (princ "\n Move DIM Text to Another Location..") ;; https://www.cadtutor.net/forum/topic/97280-toggle-dimension-lisp/#findComment-666274 (defun *error* ( msg ) (setvar 'cmdecho 0) ;; 5.28.24 (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (if msg (prompt (strcat "\n" msg))) (setvar 'cmdecho 1) (princ) ) (defun dotx (/) (princ "\n ** Reset **..") (command "dim" "hometext" "_L" "") (command) (command) ;; resets 'dim ) (defun dotl (/) (setq tpos (mapcar '+ (cdr (assoc 13 entg)) (list 0 dimsc 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dotr (/) (setq tpos (mapcar '+ (cdr (assoc 14 entg)) (list 0.5 dimsc 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dobl (/) (setq tpos (mapcar '+ (cdr (assoc 13 entg)) (list 0.0 (- dimsc) 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dobr (/) (setq tpos (mapcar '+ (cdr (assoc 14 entg)) (list 0.0 (- dimsc) 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (setvar 'cmdecho 0) (setq counter 2) (while (setq ent (car (entsel "\n Pick DIM: "))) (setq entg (entget ent)) (setq obj (vlax-ename->vla-object ent)) (setq dimsc (vlax-get obj 'scalefactor)) (if (= but nil) (setq but 1)) (cond ((= counter 1) (dotl)) ((= counter 2) (dotr)) ((= counter 3) (dobl)) ((= counter 4) (dobr)) ((= counter 5) (dotx)) ) (setq counter (+ counter 1)) (if (= counter 6) (setq counter 1)) ) (setvar 'cmdecho 1) (*error* nil) (princ) ) try this.. update
  17. Like others I really don't understand what your trying to do. You talk about large data sets but what are they and what exactly are you trying to do ? I use a group lists function to look at groups of common item where say 1st item in a sub list is the same, speeds up searches.
  18. Have a progress output to the bottom left for long process is always a good idea because people will cancel commands that they think are hung. https://www.cadtutor.net/forum/topic/75702-all-objects-inside-this-selection-want-to-send-layer-0/#findComment-598604 in the update loop if user hits esc exit lisp
  19. Case 2: This nicest user friendly way I found.. is not the nicest user friendly way in programming - involves grread which the help suggests is rarely needed and for advanced users.... grread if the input is keyboard or mouse input. If keyboard check if it is enter, X, space or escape (enter, space, escape got to use character codes) else ignore text inputs. If mouse input check if they have selected an object or just clicking empty space However the help suggests doing this in other ways. For both cases, and MHUPPs question what is the goal you are wanting to achieve.
  20. Case 1: ssadd does a check if the entity exists in the set, you can change CASE 1 (setq ss (ssadd)) (if (not (ssmemb n ss)) (ssadd n ss) ;code );if to CASE 1 (ssadd n ss) ;code Often in code optimisation is rarely a single line that makes a difference... unless you are doing thousands of calculations, so here taking out an if statement won't do a lot. Most likely you have a loop within a loop that slows things - might be more efficient to look back at how you are selecting the entities and processing them before adding to the selection set. However don't just accept that, if you code will work without the line take out your if statement, and ssadd and you shouldn't really notice a big difference in speed
  21. Danielm103

    Hybrid parallel

    Apparently, it’s a difficult task, people write papers on them https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8625416
  22. I understand what your asking for in case1 case2. I am asking is why your using them. might be a better optimization in how your selecting things. just asking for a higher level of what your trying to do.
  23. Thank you for your time. The inside stringer is set to code, because we do not "roll" our stringer plates, the outside plates are different than the inside plates, this forces the plates to form a spiral. Really more of a polygon shape with a lot of edges, the selected objects below are for the outside stringer, while they start off in the same position, they move further apart each step, the amount is determined by the diameters. While the math for solving how much the difference is per step isn't very complicated, but it can be very time consuming. All of my searching leads me to believe that a path array will never be the answer, at least for the outside.
  24. SLW210

    Hybrid parallel

    Speaking of @marko_ribar here is some of his work at the SWAMP. To AutoCAD yours are complicated, if you would pay attention to what's been posted they all get off center in pretty much the same areas, sharp curves that get very wide and very narrow. The inside is shorter than the outside and the reference points differ in number. I posted links to Civil/GIS forums where lots of different software struggle with this. You'll probably have to be satisfied with Gian's solution. If I have time I "might" work on a [send points to Excel/CSV and bring them back in solution], though IMO, I like the QGIS solution or Python might be a way to go for more accuracy. What type of work are you doing? What you have posted looks to be Civil and/or GIS work. Why don't you have the proper programs for this type of work?
  25. @mhupp Case 1: I want to reduce the time. I use the "not (ssmemb n ss)" function, but it takes a long time when the selection set is large. case 2: Press the Enter key once to continue the loop, and press it twice to exit. ( empty selection set handle) The above two cases do not relate to each other. Please
  26. I'm not quite sure what your asking to optimize.
  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CASE 1 (setq ss (ssadd)) (if (not (ssmemb n ss)) (ssadd n ss) ;code );if ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CASE 2 (setq flag T) (while flag (setq obj (ssget "_:S")) (cond (obj ;CODE ) ;ar (t (princ "\nNo selection made.") (initget "X") (setq bm (strcase (getstring "\nEnter 'X' to exit or press Enter to continue [X]: " ) ) ) (if (= bm "X" ) (setq flag nil) ; Exit the loop if user types 'x' (princ "\nInvalid input. Please try again.") ) ;if ) ) );WHILE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CASE 1: If the dataset is large, it will slow down the process. alternatives or tricks. CASE 2: Press the Enter key once to continue the loop, and press it twice to exit. or Only the letter "x" and empty inputs are acceptable.
  28. Agree with @mhupp, just set the layer in question to not plot. But don't use the Defpoints layer for this (that is reserved for dimension definition points) - use/create your own non-plotting layer.
  1. Load more activity
×
×
  • Create New...