eyeofnewt555 Posted October 14, 2016 Share Posted October 14, 2016 I just got some survey data with polylines at elevations like 789.9999 and 762.0001 (as well as some clean 0000). If they all were .0001 off in the same direction, I would just do a Z move, but since it's a mixed bag, a rounding LISP is looking like my best bet. Anyone know of an existing LISP or a different clever fix for this? Thanks! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 14, 2016 Share Posted October 14, 2016 (edited) Thanks to Lee-mac http://www.lee-mac.com/round.html this will do the rounding part. Now to change the vertices. Edited October 15, 2016 by BIGAL Quote Link to comment Share on other sites More sharing options...
lrm Posted October 15, 2016 Share Posted October 15, 2016 a different clever fix for this? Here's an easy (clever?) potential solution worth a try. Select the polylines and move them by a displacement of 1000000000000000,1000000000000000,1000000000000000 ( that's 1 followed by 15 zeros) then give the move command again and use P (to select Previous) and specify a displacement of -1000000000000000,-1000000000000000,-1000000000000000. Use the LIST command to check the results. Be sure to set the display to the maximum 8 decimal places so that the coordinate precision that is being displayed is closer to the actual precision. Since the AutoCAD precision is about 15 significant figures moving geometry to "hyperspace" and back will do some rounding. Try it. You can control the amount of rounding by adding more or fewer zeros. ~Lee Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 15, 2016 Share Posted October 15, 2016 Here is something to try ; read a 3dpoly ; and round up z value to a whole number 8.0000 ; by Alan H Oct 2016 ; Lee-mac rounding function (defun LM:Roundto ( n p ) (/ (fix (+ (* n (setq p (expt 10. p))) (if (minusp n) -0.5 0.5))) p)) ; round up z value for 3d poly (defun roundz ( / pt x y z ed e itis) (setq e (entget (car (entsel)))) (setq itis (cdr (assoc 0 e))) (if (/= itis "POLYLINE") (progn (alert "You have not picked a 3d polyline\nStart again sorry")(exit)) ) (while (and (/= (setq e (entget (entnext (cdr (car e))))) nil)(= (cdr (assoc 0 e)) "VERTEX")) (setq pt (assoc 10 e)) (setq x (nth 1 pt)) (setq y (nth 2 pt)) (setq z (nth 3 pt)) (setq z (LM:roundto z 0)) ; 0 is integer (setq ed (subst (cons 10 (list x y z)) pt e )) (entmod ed) ) ; while vertex ) (roundz) (princ) Quote Link to comment Share on other sites More sharing options...
David Bethel Posted October 15, 2016 Share Posted October 15, 2016 This is from 1 of my many point rounding routines : [b][color=BLACK]([/color][/b]defun c:rnd-3dpl [b][color=FUCHSIA]([/color][/b]/ ss ax f i en vn vd p[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]defun round [b][color=NAVY]([/color][/b] x m [b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]* m [b][color=MAROON]([/color][/b]fix [b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]minusp x[b][color=RED])[/color][/b] - +[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]/ x m[b][color=BLUE])[/color][/b] 0.5[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]initget 1 [color=#2f4f4f]"X Y Z All"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq ax [b][color=NAVY]([/color][/b]getkword [color=#2f4f4f]"\nAxis To Round - X/Y/Z/All: "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]initget 6[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq f [b][color=NAVY]([/color][/b]getdist [color=#2f4f4f]"\nRound To <1>: "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]or f [b][color=NAVY]([/color][/b]setq f 1[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 0 [color=#2f4f4f]"POLYLINE"[/color][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]cons -4 [color=#2f4f4f]"&"[/color][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]cons 70 8[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq i 0[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq vn [b][color=GREEN]([/color][/b]entnext en[b][color=GREEN])[/color][/b] vd [b][color=GREEN]([/color][/b]entget vn[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]while [b][color=GREEN]([/color][/b]= [color=#2f4f4f]"VERTEX"[/color] [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 0 vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]member ax '[b][color=RED]([/color][/b][color=#2f4f4f]"X"[/color] [color=#2f4f4f]"All"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq p [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] vd [b][color=RED]([/color][/b]subst [b][color=PURPLE]([/color][/b]list 10 [b][color=TEAL]([/color][/b]round [b][color=OLIVE]([/color][/b]car p[b][color=OLIVE])[/color][/b] f[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]cadr p[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]caddr p[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b] vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]member ax '[b][color=RED]([/color][/b][color=#2f4f4f]"Y"[/color] [color=#2f4f4f]"All"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq p [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] vd [b][color=RED]([/color][/b]subst [b][color=PURPLE]([/color][/b]list 10 [b][color=TEAL]([/color][/b]car p[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]round [b][color=OLIVE]([/color][/b]cadr p[b][color=OLIVE])[/color][/b] f[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]caddr p[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b] vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]member ax '[b][color=RED]([/color][/b][color=#2f4f4f]"Z"[/color] [color=#2f4f4f]"All"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq p [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] vd [b][color=RED]([/color][/b]subst [b][color=PURPLE]([/color][/b]list 10 [b][color=TEAL]([/color][/b]car p[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]cadr p[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]round [b][color=OLIVE]([/color][/b]caddr p[b][color=OLIVE])[/color][/b] f[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b] vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]entmod vd[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq vn [b][color=BLUE]([/color][/b]entnext vn[b][color=BLUE])[/color][/b] vd [b][color=BLUE]([/color][/b]entget vn[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]entupd vn[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq i [b][color=GREEN]([/color][/b]1+ i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] HTH -David Quote Link to comment Share on other sites More sharing options...
abra-CAD-abra Posted October 15, 2016 Share Posted October 15, 2016 This is from 1 of my many point rounding routines : [b][color=BLACK]([/color][/b]defun c:rnd-3dpl [b][color=FUCHSIA]([/color][/b]/ ss ax f i en vn vd p[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]defun round [b][color=NAVY]([/color][/b] x m [b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]* m [b][color=MAROON]([/color][/b]fix [b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]minusp x[b][color=RED])[/color][/b] - +[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]/ x m[b][color=BLUE])[/color][/b] 0.5[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]initget 1 [color=#2f4f4f]"X Y Z All"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq ax [b][color=NAVY]([/color][/b]getkword [color=#2f4f4f]"\nAxis To Round - X/Y/Z/All: "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]initget 6[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq f [b][color=NAVY]([/color][/b]getdist [color=#2f4f4f]"\nRound To <1>: "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]or f [b][color=NAVY]([/color][/b]setq f 1[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 0 [color=#2f4f4f]"POLYLINE"[/color][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]cons -4 [color=#2f4f4f]"&"[/color][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]cons 70 8[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq i 0[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq vn [b][color=GREEN]([/color][/b]entnext en[b][color=GREEN])[/color][/b] vd [b][color=GREEN]([/color][/b]entget vn[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]while [b][color=GREEN]([/color][/b]= [color=#2f4f4f]"VERTEX"[/color] [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 0 vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]member ax '[b][color=RED]([/color][/b][color=#2f4f4f]"X"[/color] [color=#2f4f4f]"All"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq p [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] vd [b][color=RED]([/color][/b]subst [b][color=PURPLE]([/color][/b]list 10 [b][color=TEAL]([/color][/b]round [b][color=OLIVE]([/color][/b]car p[b][color=OLIVE])[/color][/b] f[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]cadr p[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]caddr p[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b] vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]member ax '[b][color=RED]([/color][/b][color=#2f4f4f]"Y"[/color] [color=#2f4f4f]"All"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq p [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] vd [b][color=RED]([/color][/b]subst [b][color=PURPLE]([/color][/b]list 10 [b][color=TEAL]([/color][/b]car p[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]round [b][color=OLIVE]([/color][/b]cadr p[b][color=OLIVE])[/color][/b] f[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]caddr p[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b] vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]member ax '[b][color=RED]([/color][/b][color=#2f4f4f]"Z"[/color] [color=#2f4f4f]"All"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq p [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] vd [b][color=RED]([/color][/b]subst [b][color=PURPLE]([/color][/b]list 10 [b][color=TEAL]([/color][/b]car p[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]cadr p[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]round [b][color=OLIVE]([/color][/b]caddr p[b][color=OLIVE])[/color][/b] f[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]assoc 10 vd[b][color=PURPLE])[/color][/b] vd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]entmod vd[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq vn [b][color=BLUE]([/color][/b]entnext vn[b][color=BLUE])[/color][/b] vd [b][color=BLUE]([/color][/b]entget vn[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]entupd vn[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq i [b][color=GREEN]([/color][/b]1+ i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] HTH -David I have got to say, I am loving the parenthesis colour system. Is this done manually or can it be automated in VLIDE? Nice work! Cheers Quote Link to comment Share on other sites More sharing options...
David Bethel Posted October 16, 2016 Share Posted October 16, 2016 I have got to say, I am loving the parenthesis colour system. Is this done manually or can it be automated in VLIDE? Nice work! Cheers Thanks! I wrote a routine that creates an AutoLisp file in BBC format. I have 1 the converts to HTML as well. I don't like or use VLIDE. I'm just use an ASCII text editor with a program ALLY for debugging and development. All very old DOS based stuff. -David Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 17, 2016 Share Posted October 17, 2016 Have a look at this http://www.lee-mac.com/lispstyler.html Quote Link to comment Share on other sites More sharing options...
abra-CAD-abra Posted October 17, 2016 Share Posted October 17, 2016 Thanks guys! I will look into these. Cheers Quote Link to comment Share on other sites More sharing options...
eyeofnewt555 Posted October 20, 2016 Author Share Posted October 20, 2016 Thanks guys for all the different solutions! Will try them out! Quote Link to comment Share on other sites More sharing options...
guran Posted October 20, 2016 Share Posted October 20, 2016 I have got to say, I am loving the parenthesis colour system. Is this done manually or can it be automated in VLIDE? Nice work! Cheers http://www.crimsoneditor.com/ Quote Link to comment Share on other sites More sharing options...
eyeofnewt555 Posted October 20, 2016 Author Share Posted October 20, 2016 That worked perfectly! Thank you so much. What an elegant fix. Quote Link to comment Share on other sites More sharing options...
lrm Posted October 20, 2016 Share Posted October 20, 2016 Select the polylines and move them by a displacement of 1000000000000000,1000000000000000,1000000000000000 ( that's 1 followed by 15 zeros) then give the move command again and use P (to select Previous) and specify a displacement of -1000000000000000,-1000000000000000,-1000000000000000. Use the LIST command to check the results. Be sure to set the display to the maximum 8 decimal places so that the coordinate precision that is being displayed is closer to the actual precision. Note, if you wanted to round off just the Z coordinate then the move should only be in the Z direction. For example, given a 3DPoly with a coordinate in the hundreds such as: 100.12356789,200.123456789,300.123456789 you can move it by 0,0,10000000000000000 (1 and 16 zeros) and then move it again by 0,0,-10000000000000000 and a LIST command will show the vertex is now as: 100.1235,200.1235,300.0000 If UNITS is used to show the displayed precision to eight decimal places the output reads: X=100.12345679 Y=200.12345679 Z=300.00000000 or a rounding to the nearest whole number for the z coordinate. ~Lee Quote Link to comment Share on other sites More sharing options...
abra-CAD-abra Posted October 20, 2016 Share Posted October 20, 2016 http://www.crimsoneditor.com/ Thanks guran, I will give this a shot - Looks good! Cheers 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.