symoin Posted December 26, 2010 Share Posted December 26, 2010 Hai All, I have a survey drawing that has a lot of point without elevation and I have a dwg from another source that has Z elevation to the points, the problem is that the points are not exactly at the same position. Iam just checking the properties and editing the z for each point individually at the property manager. Is there any lisp that will match the Z elevation from source to target, Red are the points with Z and green are the points without Z . Thanks in Advance Quote Link to comment Share on other sites More sharing options...
David Bethel Posted December 26, 2010 Share Posted December 26, 2010 (edited) I'd start with something like this: [b][color=BLACK]([/color][/b]defun C:Red2GrnZ [b][color=FUCHSIA]([/color][/b]/ tol ri rs rn rd rp md gs ce gi gn gd gp[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]defun p2d [b][color=NAVY]([/color][/b]p[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]car p[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cadr p[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]initget 7[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq tol [b][color=NAVY]([/color][/b]getdist [color=#2f4f4f]"\nBase Point Search Tolerance: "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ri -1[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq rs [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"POINT"[/color][b][color=BLUE])[/color][/b][b][color=BLUE]([/color][/b]62 . 1[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 gs [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"POINT"[/color][b][color=BLUE])[/color][/b][b][color=BLUE]([/color][/b]62 . 3[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]while [b][color=MAROON]([/color][/b]setq rn [b][color=GREEN]([/color][/b]ssname rs [b][color=BLUE]([/color][/b]setq ri [b][color=RED]([/color][/b]1+ ri[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq rd [b][color=GREEN]([/color][/b]entget rn[b][color=GREEN])[/color][/b] rp [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 10 rd[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] md [b][color=GREEN]([/color][/b]distance [b][color=BLUE]([/color][/b]p2d [b][color=RED]([/color][/b]getvar [color=#2f4f4f]"EXTMIN"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]p2d [b][color=RED]([/color][/b]getvar [color=#2f4f4f]"EXTMAX"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]and [b][color=GREEN]([/color][/b]setq gs [b][color=BLUE]([/color][/b]ssget [color=#2f4f4f]"C"[/color] [b][color=RED]([/color][/b]polar rp [b][color=PURPLE]([/color][/b]* pi 0.25[b][color=PURPLE])[/color][/b] tol[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]polar rp [b][color=PURPLE]([/color][/b]* pi 1.25[b][color=PURPLE])[/color][/b] tol[b][color=RED])[/color][/b] '[b][color=RED]([/color][/b][b][color=PURPLE]([/color][/b]0 . [color=#2f4f4f]"POINT"[/color][b][color=PURPLE])[/color][/b][b][color=PURPLE]([/color][/b]62 . 3[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq ce nil gi -1[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]while [b][color=BLUE]([/color][/b]setq gn [b][color=RED]([/color][/b]ssname gs [b][color=PURPLE]([/color][/b]setq gi [b][color=TEAL]([/color][/b]1+ gi[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq gd [b][color=RED]([/color][/b]entget gn[b][color=RED])[/color][/b] gp [b][color=RED]([/color][/b]p2d [b][color=PURPLE]([/color][/b]cdr [b][color=TEAL]([/color][/b]assoc 10 gd[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]< [b][color=PURPLE]([/color][/b]distance [b][color=TEAL]([/color][/b]p2d rp[b][color=TEAL])[/color][/b] gp[b][color=PURPLE])[/color][/b] md[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]setq md [b][color=PURPLE]([/color][/b]distance [b][color=TEAL]([/color][/b]p2d rp[b][color=TEAL])[/color][/b] gp[b][color=PURPLE])[/color][/b] ce gn[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] gn[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]and ce [b][color=BLUE]([/color][/b]entmod [b][color=RED]([/color][/b]subst [b][color=PURPLE]([/color][/b]list 10 [b][color=TEAL]([/color][/b]car gp[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]cadr gp[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]caddr rp[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]assoc 10 gd[b][color=PURPLE])[/color][/b] gd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]redraw ce 3[b][color=BLUE])[/color][/b][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] Given that: The Red And Green colors are forced on the point entities ( not BYLAYER with their respective layers ) My guess is that your tolerance would 1 unit ( probably meter ) PDMODE hasn't changed since the last REGEN PDMODE display geometry will be included in the Tolerances Just to name a few.... You could do away with the tolerance, but a drawing with thousands of points would be slower than molasses in the Arctic. Have fun! -David -CPT.DWG Edited December 27, 2010 by David Bethel Added Green Set Testing Quote Link to comment Share on other sites More sharing options...
alanjt Posted December 27, 2010 Share Posted December 27, 2010 Looks like a fun project. I would say too bad I won't be near AutoCAD, let alone much of a computer for another week, but I'd be a liar. Quote Link to comment Share on other sites More sharing options...
pBe Posted December 27, 2010 Share Posted December 27, 2010 I start with something like this: [color=black]... ri))))[/color] [color=blue](setq rd (entget rn)[/color] [color=blue]rp (cdr (assoc 10 rd))[/color] [color=blue]md (distance (p2d (getvar "EXTMIN"))[/color] [color=blue](p2d (getvar "EXTMAX"))))[/color] [color=blue](setq sg (ssget "C" (polar rp (* pi 0.25) tol)[/color] [color=blue](polar rp (* pi 1.25) tol)[/color] [color=blue]'((0 . "POINT")(62 . 3))))[/color] [color=black](setq ...... [/color] Very cretive David, i always wonder how to deal with such conditions Quote Link to comment Share on other sites More sharing options...
David Bethel Posted December 27, 2010 Share Posted December 27, 2010 Very cretive David, i always wonder how to deal with such conditions Thanks, By comparing every point to every other point, the iterations would grow exponentially. I guess you could try to calculate a ssget crossing value, but it would still be a guess. -David Quote Link to comment Share on other sites More sharing options...
symoin Posted December 27, 2010 Author Share Posted December 27, 2010 (edited) Lot of thanks and appreciation to you Mr. David, hope my work load will get lighter. Mr. David, is there any way that I can work layer by layer or area by area instead of all the features in one shot. Here there are many features who different level one above the other like the road and the bridge, etc Edited December 27, 2010 by symoin Quote Link to comment Share on other sites More sharing options...
David Bethel Posted December 27, 2010 Share Posted December 27, 2010 symoin, Yes, There are lots of ways that you could break out the selection sets. You would have to have some consistent parameters to work from. ie layer names, point colors. You can remove the "X" from ssget call to allow for user selections as well. -David Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 4, 2011 Share Posted January 4, 2011 What about also removing the point from the look up list as its found this means it will get progressivly faster as the list reduces. Another trick 10,000 pts it takes 13 goes to find the correct one not 9999 Do I have your attention ? Quote Link to comment Share on other sites More sharing options...
symoin Posted January 5, 2011 Author Share Posted January 5, 2011 What about also removing the point from the look up list as its found this means it will get progressivly faster as the list reduces. Another trick 10,000 pts it takes 13 goes to find the correct one not 9999 Do I have your attention ? This sound samazing, can you do it. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 5, 2011 Share Posted January 5, 2011 Its easy just have to think about it your list looking for a point in 10,000 sort the list jump to the middle value = item 5000 is it equal yes no jump then to 1/2 the half list again either more or less repeat and keep reducing by half the remainder of items. 10000 items start 5000 item no 2500 item no 1250 item no and so on 13 times max 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.