Jump to content

Match Z elevation of a point to another point


symoin

Recommended Posts

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

.elevation.jpeg

 

Thanks in Advance

Link to comment
Share on other sites

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 by David Bethel
Added Green Set Testing
Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by symoin
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...