barba Posted July 10, 2008 Share Posted July 10, 2008 hello from Cro... I have a problem reducing the number of points that are to dense. they are so close together they basically form a line. problem is that there are about 5000 points at the line were I want to be 50 of them. deleting them manually would take forever... Is there a command that can reduce no. of points at one area? I have ACAD2008 Civil, Map, Pateia and Quicksurf Thank you for any help! Quote Link to comment Share on other sites More sharing options...
CarlB Posted July 11, 2008 Share Posted July 11, 2008 Are thes Autocad points, or LDD points (AECC_POINT), or vertices in a polyline, or ...? Quote Link to comment Share on other sites More sharing options...
barba Posted July 11, 2008 Author Share Posted July 11, 2008 Plain ACAD points with z position. I can transform them into COGO points, but that does not change much. They represent profile of the river and were measured at site... I got them in .xyz format file. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 13, 2008 Share Posted July 13, 2008 I used simple trick read the xyz file in via lisp and skipped a preset number of points eg set 2 then every second point skipped we were loading 200,000 pts pretty simple "read a line" in lisp Note !!! you do lose accuracy in your model by doing this Quote Link to comment Share on other sites More sharing options...
dusko Posted July 14, 2008 Share Posted July 14, 2008 try with "weed" command...see attach weed.lsp lisp_weed.txt Quote Link to comment Share on other sites More sharing options...
barba Posted July 15, 2008 Author Share Posted July 15, 2008 Thank you Dusko!!! problem solved, WEED rules hvala! Quote Link to comment Share on other sites More sharing options...
mossieramm Posted July 24, 2009 Share Posted July 24, 2009 I used simple trick read the xyz file in via lisp and skipped a preset number of points eg set 2 then every second point skipped we were loading 200,000 pts pretty simple "read a line" in lisp Note !!! you do lose accuracy in your model by doing this How do you do this ??? Quote Link to comment Share on other sites More sharing options...
DANIEL Posted July 24, 2009 Share Posted July 24, 2009 filter them out then delete them all , but seriously, if layered properly you can filter them out through the filter command. Quote Link to comment Share on other sites More sharing options...
jimmy5353 Posted March 11, 2010 Share Posted March 11, 2010 So not helpful for a dummy like me! Quote Link to comment Share on other sites More sharing options...
Cad64 Posted March 11, 2010 Share Posted March 11, 2010 What is the problem jimmy? Why is this thread "so not helpful"? Your reply does not give us any information to work with. Quote Link to comment Share on other sites More sharing options...
jimmy5353 Posted March 12, 2010 Share Posted March 12, 2010 What is the problem jimmy? Why is this thread "so not helpful"? Your reply does not give us any information to work with. Oh well, I have a CAD file with lots of polylines which have millions of points. I am trying to simplify them. But I have no idea how lisp works. I hope there is a simpler way of solving this issue, with simple explanation, unlike someone telling dummies "there is always OVERKILL". Quote Link to comment Share on other sites More sharing options...
Cad64 Posted March 12, 2010 Share Posted March 12, 2010 Do you have a lisp routine, but you don't know how to use it? Take a look at this: http://www.cadtutor.net/faq/questions/28/How+do+I+use+an+AutoLISP+routine%3F Or do you need a lisp routine that will remove the excess points? Try the routine posted below. It only works on Polylines though. It won't work on LWPolylines. So in order to use this routine, you must first convert your LWPolylines to Polylines using the CONVERTPOLY command. When prompted, select "Heavy", hit Enter, select the LWPolylines in your drawing and then hit Enter to convert them. Now you can load and run the code below to remove extra verts from your polylines. Once finished, run CONVERTPOLY again. But this time select "LIGHT" when when prompted, select the Polylines in your drawing and then hit Enter to convert them back to LWPolylines. ; Weeds out extranous verticies from a polyline ;=========================WEED.LSP=========================== ;Jerry Workman CIS 70717,3564 December 28, 1987 ; Last modified February 21, 1991 ;============================================================ ;*----- this is executed at load (textscr) (princ(strcat "\n\n=========================WEED.LSP===========================" "\n\nWEED removes extranious verticies from LINEs or a POLYLINE." "\nShort segments less than the specified leg length ...AND..." "\nhaving an offset distance less than the minimum distance" "\nare removed. Try different combinations to get the result" "\ndesired. Changes can be undone by entering the U command" "\ntwice. The routine will convert LINEs to a POLYLINE providing" "\nthat all line segments endpoints match exactly. Additional" "\nverticies that have been added by a Spline or Fit curve can" "\nbe treated like \"real\" verticies, or can be ignored." "\n\nExample: " "\nEnter offset distance: 10 <Enter number or pick 2 pts>" "\nEnter leg length: 100 <Enter number or pick 2 pts>" "\n\nAll included verticies having the longest leg less than 100" "\nAND being less than 10 from the original line will be removed." "\nIf you wish offset to control select a large leg length." "\nIf you wish leg length to control select a large offset." "\nJerry Workman CIS 70717,3564" "\nLoading...")) ;*----- Debugging stuff, load this file by entering LD<RETURN> ;(defun c:ld() (load "weed")) ;(defun c:ed() (command "q" "d:\\acad\\support\\weed.lsp")) ;*----- Error Routine (defun w-error (s) (redraw) (grtext) (princ "\nWeed Error: ") (princ s) (exit) ) ;*----- Exit Routine (defun exit() (if (boundp 'f) (setq f (close f))) (setvar "cmdecho" cmdecho) (setvar "blipmode" blipmode) (setq *error* olderr) (princ) ) ;*----- Extract a field from a list (defun fld (num lst) (cdr (assoc num lst))) ;*----- Plot a temporary X (defun blip (blpoint / s x1 y1 x2 y2 p1 p2 p3 p4) (setq s (/ (getvar "viewsize") 100) ; 1/100 of viewsize x1 (+ (car blpoint) s) y1 (- (cadr blpoint) s) x2 (- (car blpoint) s) y2 (+ (cadr blpoint) s) p1 (list x1 y1) p2 (list x2 y2) p3 (list x2 y1) p4 (list x1 y2)) (grdraw p1 p2 -1) (grdraw p3 p4 -1) ) ;*----- Convert a line to a polyline entity (defun line2pline(ent / dat etype epnt ss1 ss2) (if ent (progn (setq dat (entget ent) etype (fld 0 dat)) (if (= etype "LINE") (progn (princ "\nConverting LINE to PLINE") (setq epnt (fld 10 dat) ss1 (ssadd ent) ss2 (ssget "C" (getvar "EXTMIN") (getvar "EXTMAX"))) (ssdel ent ss2) (command "pedit" ss1 "y" "j" ss2 "" "x") (ssname (ssget epnt) 0) ; return the new entity name ) ;else return nil (progn (princ "\nNot a Line") nil) ) );else (progn (princ "\nNothing selected") nil) ) ) ;*----- Get a polyline or line entity (defun fetch(/ pl etyp flgs ans) (setq etyp nil) (while (not (or (= etyp "LINE") (= etyp "POLYLINE"))) (progn (setq ename nil) (setq e (car (entsel "\nSelect a PolyLine or Line: "))) (if e (progn (setq pl (entget e) etyp (fld 0 pl) ename e) (if (or (= etyp "LINE") (= etyp "POLYLINE")) (progn (princ (strcat "\n" etyp " selected")) (if (= etyp "LINE") (setq e (line2pline e) ename e pl (entget e)) )) ;else (progn (princ "\nThat's not a LINE or POLYLINE, it's a ") (princ etyp)) ); end if ); end progn ; else (princ "\nNothing Selected") ); end if )); end while (setq flgs (fld 70 pl)) (setq closed (=(boole 1 flgs 1) 1)) (if closed (princ "\nClosed Polyline")) (cond ((=(boole 1 flgs 2) 2) (progn (setq ptyp "F") (princ "\nFit curve verticies have been added"))) ((=(boole 1 flgs 4) 4) (progn (setq ptyp "S") (princ "\nSpline curve verticies have been added..."))) (t (setq ptyp "N")) ;Normal polyline ) (if(/= ptyp "N") (progn (initget "Y N") (if(= (getkword "\nDecurve polyline during weeding[y/N]:") "Y") (setq ptyp "N")) )) ) ;*----- Check vertex type (defun vt_ok () (if (= etype "VERTEX") (cond ((= ptyp "F") (or(=(boole 1 flags 1) 1) (= flags 0))) ((= ptyp "S") (>(boole 1 flags 9) 0)) (t (=(boole 1 flags 25) 0)) ;"N" normal, 1 8 16 off ) ;else t ) ) ;*----- extract the list containing vertex coordinates (defun get_vertex(/ vert etype sub_ent flags) (setq vert nil etype nil) (while (and e (null vert) (/= etype "SEQEND")) (progn (setq v (entnext e) e v etype nil) (if e (progn (setq sub_ent (entget v) flags (fld 70 sub_ent) etype (fld 0 sub_ent)) ;(princ "flags =")(princ flags) (if (vt_ok) (if (= etype "VERTEX") (setq vert_cnt (1+ vert_cnt) vert (fld 10 sub_ent)) ; else return nil ) ) )) )) ) ;*----- Add a vertex to the temporary file for the new pline (defun add_vert(vt) (if (null f) (setq f (open "weedtmp.$$$" "w"))) (prin1 vt f) (princ "\n" f) ) ;*----- Read a vertex from the temporary file for the new pline (defun read_vert(/ pt) (setq pt (read-line f)) (if pt (read pt) nil) ) ;*----- Read new polyline from the tempory file (defun retrieve() (setq f (open "weedtmp.$$$" "r")) (command ".PLINE") (setq v (read_vert)) (while v (progn (command v) (setq v (read_vert)) )) (command "") ;(command "del" "weedtmp.$$$") ) ;*----- Check the internal angle and leg lengths then add or delete (defun check_it(/ ang dist1 dist2 dist offset off) (setq ang12 (abs(angle v1 v2)) ang13 (abs(angle v1 v3)) ang (abs(- ang12 ang13)) dist1 (distance v1 v2) dist2 (distance v2 v3) dist (max dist1 dist2) ; largest distance off (* dist1 (sin ang)) offset (+ p_off off) p_off offset ) (if (and (< offset max_offset) ;offset distance criteria (< dist min_dist) ;minimum leg length criteria ) ;then skip middle vertex (progn (blip v2) ;mark the deleted vertex (setq v2 v3 v3 (get_vertex) skip_cnt (1+ skip_cnt)) (princ "\nSkipping vertex # ") (princ (- vert_cnt 2)) ; (princ (strcat ", max_offset " (rtos max_offset 2 2) " ; min_dist " (rtos min_dist 2 2))) ; (princ (strcat ", offset " (rtos offset 2 2) " dist " (rtos dist 2 2))) ) ;else add first vertex to list (progn (add_vert v2) (setq v1 v2 v2 v3 v3 (get_vertex) p_off 0) ); end progn ); end if ) ;*----- The main routine... (defun C:WEED( / v1 v2 v3 ename v skip_cnt vert_cnt cmdecho blipmode f olderr max_offset min_dist closed spline fit e_del p_off vstart ptyp) (setq cmdecho (getvar "cmdecho") blipmode (getvar "blipmode") olderr *error* *error* w-error ; *error* nil skip_cnt 0 p_off 0 f nil vert_cnt 0 ) (setvar "cmdecho" 0) (setvar "blipmode" 0) (initget (+ 1 2 4)) (setq max_offset (getdist "\nEnter offset distance: ")) (initget (+ 1 2 4)) (setq min_dist (getdist "\nEnter leg length: ")) (initget "Y N") (setq e_del (getkword "\nDelete original Polyline [Y/n]: ")) (if (null e_del) (setq e_del "Y")) (fetch) (princ "\nChecking polyline verticies...") (setq v1 (get_vertex) vstart v1 v2 (get_vertex) v3 (get_vertex)) (add_vert v1) (while v3 (check_it)) (if (< (distance v1 v2) min_dist) (progn (setq skip_cnt (1+ skip_cnt)) (princ "\nSkipping vertex # ") (princ vert_cnt)) ;else (add_vert v1) ); end if (add_vert v2) (if closed (add_vert vstart)) ; Delete old line and draw new Pline (if (> skip_cnt 0) (progn (close f) (if (= e_del "Y") (entdel ename)) (retrieve) (princ (strcat "\n" (itoa skip_cnt) " verticies removed " "out of " (itoa vert_cnt) " tested (" (rtos(/ (* 100.0 skip_cnt) vert_cnt) 2 2) ") percent")) ) ;else (princ "\nNothing to change!") ) (exit) ) Quote Link to comment Share on other sites More sharing options...
jimmy5353 Posted March 12, 2010 Share Posted March 12, 2010 Thanks. I have tried. The number of points of the polylines still remain the same. Unfortunately. Quote Link to comment Share on other sites More sharing options...
CarlB Posted March 12, 2010 Share Posted March 12, 2010 How it functions depends on what you supplied for the weed criteria: "Enter offset distance: " "Enter leg length: " Play around with those. "leg" is probably distance between vertices. Quote Link to comment Share on other sites More sharing options...
jimmy5353 Posted March 13, 2010 Share Posted March 13, 2010 How it functions depends on what you supplied for the weed criteria: "Enter offset distance: " "Enter leg length: " Play around with those. "leg" is probably distance between vertices. This did not work. All my polylines are horizontal. Thanks anyway. Quote Link to comment Share on other sites More sharing options...
Cad64 Posted March 13, 2010 Share Posted March 13, 2010 This did not work. All my polylines are horizontal. Thanks anyway. Can you post a screenshot? It shouldn't matter if your lines are horizontal, vertical, diagonal or a combination of all three. The routine should work as long as you input the correct numbers. Quote Link to comment Share on other sites More sharing options...
jimmy5353 Posted March 14, 2010 Share Posted March 14, 2010 Can you post a screenshot? It shouldn't matter if your lines are horizontal, vertical, diagonal or a combination of all three. The routine should work as long as you input the correct numbers. I hope you can see the attachment. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 14, 2010 Share Posted March 14, 2010 Try this buddy Quote Link to comment Share on other sites More sharing options...
jaisn Posted November 17, 2010 Share Posted November 17, 2010 Is there a way to convert LWpolylines to regular polylines? Thanks Quote Link to comment Share on other sites More sharing options...
jaisn Posted November 17, 2010 Share Posted November 17, 2010 Is there a way to convert LWpolylines to regular polylines? Thanks Oops, didn't see the second page of this thread until I posted.....working on it now! Quote Link to comment Share on other sites More sharing options...
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.