faisal Posted May 1, 2011 Posted May 1, 2011 (defun c:bhy() (setvar "cmdecho" 0) (graphscr) (setq fd (open "c:\\CAD\\BHY.txt" "r") info (read-line fd) ) (while (/= info nil) (setq eas (atof (substr info 4 13)) nor (atof (substr info 15 12)) ipt (list eas nor) fi (atoi (substr info 27 3)) ba (atof (substr info 31 3)) x (fix ba) y (fix (* (- ba x)10)) xs (itoa x) ys (itoa y) ) (command "insert" "Bathy" ipt 1 1 0 xs ys fi) (setq info (read-line fd)) ) (close fd) (princ) ) Quote
faisal Posted May 1, 2011 Author Posted May 1, 2011 correct sir but i dont know what type of txt. i mean it needs xyz with fix numbers or something else. Quote
faisal Posted May 1, 2011 Author Posted May 1, 2011 718230.9 2141655.86 79.7 718230.72 2141666.48 79.6 718230.6 2141678.3 79.53 718230.39 2141689.31 79.44 718230.44 2141700.79 79.34 718230.69 2141711.85 79.24 718230.8 2141722.4 79.16 718230.86 2141732.27 79.13 718230.35 2141742.55 79.07 718229.81 2141752.45 78.95 718229.05 2141763.07 78.82 718228.39 2141773.71 78.69 718228.33 2141784.11 78.59 718228.14 2141794.83 78.58 718227.65 2141804.88 78.43 718227.19 2141815.69 78.44 718226.83 2141826.63 78.44 718226.48 2141836.53 78.44 this is what i hve made and i think that this one s wrong Quote
faisal Posted May 1, 2011 Author Posted May 1, 2011 i dont know how to make this one as per the lisp Quote
Organic Posted May 1, 2011 Posted May 1, 2011 If you don't know how to use the lisp and what input is required for it I suggest you don't use it and find another lisp. Are you trying to insert a block at E, N and elevation? Quote
faisal Posted May 1, 2011 Author Posted May 1, 2011 right i even have old drawings someone had made this i dont know how to appload the dwg file Quote
faisal Posted May 1, 2011 Author Posted May 1, 2011 actually i know that this lisp import xyz and its fix nos. as block attributes with metres and decimetres. Quote
LibertyOne Posted May 1, 2011 Posted May 1, 2011 i dont know how to make this one as per the lisp Each line of text in the file needs to be at least 33 characters long. The variable EAS starts with the fourth character and is 13 characters long. That's how you read the (substr info 4 13) The last variable being set by each line BA is 3 characters long starting with the 31st character. It is then turned into a floating number. Quote
eldon Posted May 1, 2011 Posted May 1, 2011 I would think that the lisp is not correct. It seems to be looking for a space delineated file, and the one posted is certainly not in that format. Following on from LibertyOne's post, the variable "eas" starts at character 4 and is 13 characters long, so it ends at character 16. The variable "nor" starts at character 15, but this overlaps the characters from variable "eas", so is patently nonsense. You must try to find out the correct code and the correct format data file. Quote
pBe Posted May 2, 2011 Posted May 2, 2011 (edited) If the text file is indeed on that format, what you can do is convert it to list "718230.9 2141655.86 79.7" (read (strcat "(" "718230.9 2141655.86 79.7" ")")) (718231.0 2.14166e+006 79.7) (defun c:bhy (/ fd info pts) (setvar "cmdecho" 0) (setq fd (open "D:\\BHY.txt" "r")) (while (setq info (read-line fd)) (setq pts (strcat "(" info ")")) (command "_insert" "Bathy" "_non" (read pts) 1 1 0) ;;; Block attribute edit here;;;;; ) (close fd) ) Hope this helps Edit: Reading the other thread, I suspect your Bathy block includes attributes, we can re-write it to input data into the attributes. Edited May 2, 2011 by pBe Quote
pBe Posted May 2, 2011 Posted May 2, 2011 Create your attribute block like the way it was shown here: http://www.cadtutor.net/forum/showthread.php?58787-I-need-a-LISP-or-Tool-Pac-for-placing-Cordinate-point Then no need for Attribute modify code on the above post 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.