jason tay Posted January 24, 2008 Posted January 24, 2008 Hi all:D , i wonder any one know how to create lisp which could list out the coordinate of group of point (not pick point by point) and create individual layer of N and E with the text stick on the point position and if it can create numbering also will be much helpful. I need this lisp becase i always need to create the coordinate for lots of point (more than 50). Im first time post at this forum if any things wrong please forgive me, here is really a good place for learning. thanks all . Sample.dwg Quote
Guest Alan Cullen Posted January 24, 2008 Posted January 24, 2008 yeah, Jason, It can be done, relatively easily. So stop panicking. There will be a lot of our lisp gurus along shortly to point you in the right direction. Just stand by. If you have no response overnight, just yell for me, I'm sure I can get these gurus up and running for you. :lol: Quote
wizman Posted January 24, 2008 Posted January 24, 2008 this can be a start: (defun c:test (/ mysset counter) (setq mysset (ssget)) (setq counter 0) (setq sch 0.5) (while (< counter (sslength mysset)) (setq p1 (cdr (assoc 10 (entget (ssname mysset counter))))) (setq ytxt (strcat "N" (rtos (cadr p1) 2 3))) (setq xtxt (strcat "E" (rtos (car p1) 2 3))) (command "text" p1 (* sch 2.5) "0" xtxt) (command "text" "" ytxt) (command "text" "" (itoa (1+ counter))) (setq counter (+ counter 1)) ) ;_ end of while (princ) ) Quote
eldon Posted January 24, 2008 Posted January 24, 2008 I don't know which part of the world you come from, but Eastings before Northings is the usual order for coordinates in the UK Quote
jason tay Posted January 25, 2008 Author Posted January 25, 2008 Thank you very much all of the guru here , especially to Wizman !you all are really great! but is that possible that the coordinate and numbering all in single layer - East, North and Num if cannot then never mine because what you have done alreally helping me a lot. Eldon im from Malaysia:oops: sorry for the confuse i make Quote
jason tay Posted January 25, 2008 Author Posted January 25, 2008 another things is the text height had been fix, hope it can be flexible based on the drawing scale we need Quote
Guest Alan Cullen Posted January 25, 2008 Posted January 25, 2008 Jason, it looks like the text height is based on the dimscale you have set in the drawing. Quote
jason tay Posted January 25, 2008 Author Posted January 25, 2008 Alan, i have change the dim scale but it seem like no effect. Quote
Guest Alan Cullen Posted January 25, 2008 Posted January 25, 2008 Mate, if you can wait until I get home tonight, I'll have a play with that lisp and modify it for you, I'm pretty busy here at work at the moment. I think wizman is assuming your dimscale is set at 0.5. Quote
wizman Posted January 25, 2008 Posted January 25, 2008 (defun c:test (/ mysset counter laylist p1 sch xtxt ytxt) (setq laylist (list "NORTH" "EAST" "NUM")) (foreach x laylist (if (tblsearch "Layer" x) (command "._layer" "_thaw" x "_on" x "_unlock" x "_set" x "") ;_ closes command (command "._layer" "_make" x "_color" "7" x "") ;_ closes command ) ) (prompt "SELECT POINTS JASON: ") (setq mysset (ssget '((0 . "POINT")))) (setq counter 0) (if (null sch) (setq sch 1.0) ) (initget 6) (setq temp (getreal (strcat "\nENTER SCALE <" (rtos sch 2 2) ">: "))) (if temp (setq sch temp) (setq temp sch) ) (while (< counter (sslength mysset)) (setq p1 (cdr (assoc 10 (entget (ssname mysset counter))))) (setq xtxt (strcat "E" (rtos (car p1) 2 3))) (setq ytxt (strcat "N" (rtos (cadr p1) 2 3))) (command "text" p1 (* sch 2.5) "0" xtxt) (command "_change" (entlast) "" "p" "la" "EAST" "") (command "text" "" ytxt) (command "_change" (entlast) "" "p" "la" "NORTH" "") (command "text" "" (itoa (1+ counter))) (command "_change" (entlast) "" "p" "la" "NUM" "") (setq counter (+ counter 1)) ) ;_ end of while (princ) ) Quote
jason tay Posted January 25, 2008 Author Posted January 25, 2008 Dear Alan,is no problem for me to wait i have a lisp dont know where i found which list the coordinate pick point by point is similar to some lisp i found in this forum and i try to modify it so it can -1.select group of point 2. individual layer for East,North and numbering but end up with fail, because im not familiar with the lisp language. WCO.LSP Quote
jason tay Posted January 25, 2008 Author Posted January 25, 2008 wow wizman your great! thats what i need!Thanks alot!! Quote
surveyman Posted February 15, 2009 Posted February 15, 2009 Wizman - that's a great automated routine. Would it be possible to get it to write the coords to a .txt file in the form pt number,E,N,Z I have seen some lsp routines doing this, but they require manual picking of the points. For my particular purpose I don't need the E,N,Z to be plotted on the drawing - just the point number is useful. I'm new to this forum so hope my reply was posted correctly, and hope I'm not taking too many libertys early on! Thanks alot. Quote
Lee Mac Posted February 15, 2009 Posted February 15, 2009 Hi surveyman, Correct me if I am wrong, and I may be well off the mark, but do you just want the x,y,z and pt number of ACAD points in the drawing written to the notepad txt file. Is this correct? Quote
Lee Mac Posted February 15, 2009 Posted February 15, 2009 If that indeed is your intention - this should suit your needs: (defun c:ptwriter (/ file ss file eLst i) (vl-load-com) (if (and (setq file (getfiled "Create a Text File" "C:\\" "txt" 9)) (setq ss (ssget "X" (list (cons 0 "POINT") (if (getvar "CTAB")(cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE")))))))) (progn (setq file (open file "w") eLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) i 1) (foreach e eLst (write-line (strcat (rtos i) "," (rtos (cadr (assoc 10 (entget e)))) "," (rtos (caddr (assoc 10 (entget e)))) "," (rtos (cadddr (assoc 10 (entget e))))) file) (setq i (1+ i)))) (princ "\n<!> No File Selected or No Points found <!>")) (princ "\n<< Points Written to File >>") (close file) (princ)) Quote
surveyman Posted February 16, 2009 Posted February 16, 2009 Lee Mac, Thanks for your response. Wow that works quickly! The lsp ran so quickly I opened the file expecting it to be blank. However..... What I really want is a combination of your routine and Wiz Mans (which currently automatically plots "number, E,N,Z" on the drawing) Required workflow 1. Select text file name 2. Preferably select starting point number to count from 3. Select points from drawing 4. Lsp will then automatically plot a point number (next to each point) on the drawing ( E,N,Z is not required to be plotted) at each point 5. These points will be written to a text file as per your routine in format number,E,N,Z 6. Purpose is I can then take a drawing onto site, select the point number I wish to set out (from the plotted numbers on the drawing) and then select this point (which will contain the coords) from my data logger for setting out. Does this workflow make sense? Thanks again for the work so far. Surveyman Quote
Lee Mac Posted February 16, 2009 Posted February 16, 2009 Hi Surveyman, I understand things a lot better now thanks. But I do have one further question - would you like to select the points that are to be plotted to the text file/have a number printed? Or would you like the program to automatically select all the points in the drawing as it does currently? Quote
surveyman Posted February 16, 2009 Posted February 16, 2009 Lee Mac, I would like to select them using a selection tool. This way I can just pick one or 2 houses (for example) from a design drawing showing 50. Should I want all 50 I could of course pick the whole drawing - no doubt this process complicates things a bit. I really do appreciate your input. Thanks Surveyman:) Quote
Lee Mac Posted February 16, 2009 Posted February 16, 2009 No worries surveyman, it is not any harder to have the user select the points than it is to have the program select all points in the drawing - just a means a smaller selection set is retrieved. Will see what I can do Quote
eldon Posted February 16, 2009 Posted February 16, 2009 I have seen some lsp routines doing this, but they require manual picking of the points. If you want to have any control over the order of the point numbering, you have to pick the points manually. Unless the lisp is cleverer than I thought Usually for setting out, it is easier to have your point numbers going consecutively in the order for setting out. Quote
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.