KAPC Posted June 8, 2009 Share Posted June 8, 2009 I have a drawing that has a set of points (2000+) with correct X, Y information but where Z is 0. The Z-height is included in a TEXT adjacent to the points. Can anyone share a lisp routine that will either attach the text info to the point, as Z values, or convert the text into points with appropriate Z value. Points are on layers ROAD_PT and SITE_PT. Text info is on layers ROAD_ELEV and SITE_ELEV. Thanks! Quote Link to comment Share on other sites More sharing options...
Commandobill Posted June 8, 2009 Share Posted June 8, 2009 Do you have an example of a drawing? Quote Link to comment Share on other sites More sharing options...
KAPC Posted June 8, 2009 Author Share Posted June 8, 2009 Here you go Quote Link to comment Share on other sites More sharing options...
eldon Posted June 8, 2009 Share Posted June 8, 2009 If you had the original data text file, it would be even easier. I see some of the points have no text - what then? Quote Link to comment Share on other sites More sharing options...
KAPC Posted June 8, 2009 Author Share Posted June 8, 2009 There isn't a text file, that's the problem. The points that have no text have a reference number, as the rest does - I just turned the layer off for clarity. Quote Link to comment Share on other sites More sharing options...
eldon Posted June 8, 2009 Share Posted June 8, 2009 It would help to know whether the text has some justification that is the same point as the Point, i.e. Bottom Centre? Also useful would be a snippet of drawing with 20 or so points on it, so that anyone who is able to write a Lisp would have something to experiment on. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 8, 2009 Share Posted June 8, 2009 As hinted, the diffcult part here is identifying (through a programming perspective) which text item goes with which point. With a SelectionSet process, items are collected somewhat randomly, hence the points will not be assigned the correct Z-value most of the time. Another option would be to make a selection set crossing window around each point, but this obviously is still not 100% accurate as some text items may be missed. Another option to consider would be to sort the two selection sets of points and text by an arbitrary coordinate, say x, and, providing the text basepoint is close to the point, both selection sets will be in the correct order. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 8, 2009 Share Posted June 8, 2009 ...or convert the text into points with appropriate Z value.... Give this a shot: [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:ptZ [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] spc ss Objlst[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] spc [b][color=RED]([/color][/b][b][color=BLUE]vla-get-ModelSpace[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-ActiveDocument[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-get-acad-object[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]ssget[/color][/b] [b][color=#ff00ff]"_X"[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=#009900]0[/color][/b] . [b][color=#ff00ff]"TEXT"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=#009900]8[/color][/b] . [b][color=#ff00ff]"ROAD_ELEV,SITE_ELEV"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] Objlst [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]cadr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]ssnamex[/color][/b] ss[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]function[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]lambda[/color][/b] [b][color=RED]([/color][/b]x[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-addPoint[/color][/b] spc [b][color=RED]([/color][/b][b][color=BLUE]vlax-3D-point[/color][/b] x[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]function[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]lambda[/color][/b] [b][color=RED]([/color][/b]x y[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] x[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cadr[/color][/b] x[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]distof[/color][/b] y[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]function[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]lambda[/color][/b] [b][color=RED]([/color][/b]x[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]10[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] x[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] Objlst[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]function[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]lambda[/color][/b] [b][color=RED]([/color][/b]x[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]1[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] x[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] Objlst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]entdel[/color][/b] Objlst[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n<!> No Text Found <!>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] { ModelSpace Assumed } Quote Link to comment Share on other sites More sharing options...
KAPC Posted June 8, 2009 Author Share Posted June 8, 2009 Below is a dwg with a random selection of the points Points.dwg Quote Link to comment Share on other sites More sharing options...
eldon Posted June 8, 2009 Share Posted June 8, 2009 I see that the text insertion point is mostly at a certain offset from the point, but there are variations, and the size of text seems to alter the offset. Quite tricky. I have a lisp that puts a new point at the (x,y) of the point with the z value extracted from the text, but one point at a time manually, but these days, folk seem to want something that will do it in a trice. Over to you Lee Mac :wink: Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 8, 2009 Share Posted June 8, 2009 Over to you Lee Mac :wink: Well, I haven't yet taken a look at the posted drawing, but my posted LISP will just make a point at the text insertion, using the Z-value from the text... he did say in his original post that you could convert the text to a point with the correct Z.... Quote Link to comment Share on other sites More sharing options...
KAPC Posted June 8, 2009 Author Share Posted June 8, 2009 This actually worked great. The text offset to points was the same, with a few exceptions. After creating the points from the text, all I had to do was shift the new points to the location of the original survey locations. Thanks! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 8, 2009 Share Posted June 8, 2009 This actually worked great.The text offset to points was the same, with a few exceptions. After creating the points from the text, all I had to do was shift the new points to the location of the original survey locations. Thanks! No problem Happy to help Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 9, 2009 Share Posted June 9, 2009 Hey lee as usual beat me to it had this lisp for years a common problem is that you get supplied a drawing from someone and they say yeah its 3d but you then find exactly its as above 2d points with text, used this trick to convert 2d into 3d points and then create contour plans etc. Hope this hint helps others. 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.