goldy2000 Posted December 16, 2009 Share Posted December 16, 2009 Hello there!!! Have a question, maybe someone had a deal with it...I have a coordinate with X and Y, no Z (0.00), but have Z in number near that point, I need now to assign that number to that point like this diagram maybe: 1. pick number 2. pick point 3. assign number to point I have a lisp that extract Z coord from point to text (so this would be opposite reaction) I have a situation of about 2000 points that don't have Z coordinates but have a number in text format, so it would be complicated to edit every point manually....If anyone have any idea I would be grateful.. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 16, 2009 Share Posted December 16, 2009 Are all the text objects on the same layer? Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted December 16, 2009 Author Share Posted December 16, 2009 Are all the text objects on the same layer? They could be, I found them separated in 3 different layers, but I can put them in one unique layer, did you mean on that or...? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 16, 2009 Share Posted December 16, 2009 They could be, I found them separated in 3 different layers, but I can put them in one unique layer, did you mean on that or...? Well, my thinking was this: Collect all the points Collect all the Z-text on the layer Foreach each point, get the Z-text that is closest to the point, and put the value in the text as the Z-coord. This is not bullet-proof, but is the best method I can see, above selecting each text/point manually. Lee Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted December 16, 2009 Author Share Posted December 16, 2009 Well, my thinking was this: Collect all the points Collect all the Z-text on the layer Foreach each point, get the Z-text that is closest to the point, and put the value in the text as the Z-coord. This is not bullet-proof, but is the best method I can see, above selecting each text/point manually. Lee Write you in 1 hour Lee...must travel home.. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 16, 2009 Share Posted December 16, 2009 Try this (when you get home ) (defun c:putZ (/ dxf txt2num ELST ENT I PT SS TLAY TLST TSS Z) (vl-load-com) (setq tLay "Text") [color=Red][b];; <<--< Z-Text Layer[/b][/color] (defun dxf (code lst) (cdr (assoc code lst))) (defun txt2num (txt) (cond ((distof txt 5)) ((distof txt 2)) ((distof txt 1)) ((distof txt 4)) ((distof txt 3)))) (cond ( (not (tblsearch "LAYER" tlay)) (princ "\n** Text Layer Non-existent **")) (t (if (and (setq i -1 ss (ssget '((0 . "POINT")))) (setq tss (ssget "_X" (list (cons 0 "TEXT,MTEXT") (cons 8 tLay))))) (progn (setq tLst (mapcar (function (lambda (x) (cons (dxf 10 x) (dxf 1 x)))) (mapcar (function entget) (vl-remove-if (function listp) (mapcar (function cadr) (ssnamex tss)))))) (while (setq ent (ssname ss (setq i (1+ i)))) (setq pt (cdr (assoc 10 (setq elst (entget ent))))) (setq z (cdar (setq tLst (vl-sort tLst (function (lambda (a b) (< (distance (car a) pt) (distance (car b) pt)))))))) (setq tLst (cdr tLst)) (or (setq z (txt2num z)) (setq z 0.0)) (entmod (subst (cons 10 (list (car pt) (cadr pt) z)) (assoc 10 elst) elst))))))) (princ)) Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted December 17, 2009 Author Share Posted December 17, 2009 G'morning.....Thx Lee for lisp, I tried it but don't understand it quite...I make TEXT layer, and first highlight point(s) and then what..? I tried to select Z txt but nothing happened Quote Link to comment Share on other sites More sharing options...
CarlB Posted December 17, 2009 Share Posted December 17, 2009 Did you check if the point's z value got modified? Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted December 17, 2009 Author Share Posted December 17, 2009 Did you check if the point's z value got modified? Yep, nothing happened, it stayed on 0.00 like it was Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted December 17, 2009 Author Share Posted December 17, 2009 Maybe it is problem that I work in ACAD 2008?? Quote Link to comment Share on other sites More sharing options...
eldon Posted December 17, 2009 Share Posted December 17, 2009 Perhaps you could post a drawing file that has 20 or so of your points. That would give some data, and a better chance of a solution. Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted December 17, 2009 Author Share Posted December 17, 2009 Yep you're right Eldon, here is example of my drawing... Quote Link to comment Share on other sites More sharing options...
eldon Posted December 17, 2009 Share Posted December 17, 2009 I think that a drawing file would be of more use than a picture, if you can manage that - thank you. Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted December 17, 2009 Author Share Posted December 17, 2009 I think that a drawing file would be of more use than a picture, if you can manage that - thank you. No problem, here is small part of dwg file... example.dwg Quote Link to comment Share on other sites More sharing options...
eldon Posted December 17, 2009 Share Posted December 17, 2009 Having looked at the file, I would say that a completely automatic lisp would be impossible in places, due to the relative placement of the elevation text in relation to the ground point. For example, the text is not at a consistent displacement left or right. In areas of congested detail, some levels are on top of other ground points, so a programme to search for the closest text would choose the wrong one. In some areas there is no elevation text for a ground point. Some of the ground points are blocks. All in all, I would go for a manual approach.. I hesitate to post my lisp to do this, because last time, I was chided for producing an untidy lisp. All I know is that it works, and for 2000 points, you could do that in an hour or so. With Osnaps set to suitable settings, the work goes quite fast, even if it is one at a time. Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted December 17, 2009 Author Share Posted December 17, 2009 Having looked at the file, I would say that a completely automatic lisp would be impossible in places, due to the relative placement of the elevation text in relation to the ground point. For example, the text is not at a consistent displacement left or right. In areas of congested detail, some levels are on top of other ground points, so a programme to search for the closest text would choose the wrong one. In some areas there is no elevation text for a ground point. Some of the ground points are blocks. All in all, I would go for a manual approach.. I hesitate to post my lisp to do this, because last time, I was chided for producing an untidy lisp. All I know is that it works, and for 2000 points, you could do that in an hour or so. With Osnaps set to suitable settings, the work goes quite fast, even if it is one at a time. Thx for your time Eldon, manual approach lisp would also be good in this case, maybe much more better solution than automatic lisp8) Quote Link to comment Share on other sites More sharing options...
eldon Posted December 17, 2009 Share Posted December 17, 2009 The lisp is not complicated, and as long as Lee Mac is not looking, here it is (defun c:grlev ( / p1 tx e zd os); puts 3D point at level shown by text; by eldon 2000 (setvar "OSMODE" 104); set Osnap for picking plan point (setq p1 (getpoint "\n Pick plan point..... ")) (setvar "OSMODE" 64) (setq tx (entsel "\n Pick Level text...... ")) (setvar "OSMODE" 0) (setq e (entget (car tx))) (setq zd (atof (cdr (assoc 1 e)))) (setq p1 (list (car p1) (cadr p1) zd)) (command "point" p1) ) You have to set up the Osmode variable according to the list below. It is currently set for Node, Insertion and Intersection. It works one point at a time, but by pressing the right mouse button, it starts again. There are no error traps. I hope it works for you. Sets running Object Snap modes using the following bitcodes: 0 NONe 1 ENDpoint 2 MIDpoint 4 CENter 8 NODe 16 QUAdrant 32 INTersection 64 INSertion 128 PERpendicular 256 TANgent 512 NEArest 1024 QUIck 2048 APParent Intersection 4096 EXTension 8192 PARallel To specify more than one object snap, enter the sum of their values. For example, entering 3 specifies the Endpoint (bitcode 1) and Midpoint (bitcode 2) object snaps. Entering 16383 specifies all object snaps. Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted December 17, 2009 Author Share Posted December 17, 2009 :shock:YEP, that is it, I found that it makes new points with correct Z coord, after I do this just quick select all Z=0 and erase and this is it!!!!! Thx man, you helped me a lot!!! Quote Link to comment Share on other sites More sharing options...
eldon Posted December 17, 2009 Share Posted December 17, 2009 Very glad to help. Perhaps you can work out what is happening in the lisp, and then start writing your own. That is how I started 15 years ago, before there was CADTutor Quote Link to comment Share on other sites More sharing options...
goldy2000 Posted December 17, 2009 Author Share Posted December 17, 2009 Very glad to help. Perhaps you can work out what is happening in the lisp, and then start writing your own. That is how I started 15 years ago, before there was CADTutor I wanted to do it already, but always find something to do for my work, but think I should do it once:glare:, it seems not so complicated?? To examine some tutorials and think this would be a good start.. 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.