justindm Posted December 21, 2010 Posted December 21, 2010 I'm looking for a way to extract the X, Y and Z values from a set of selected blocks (there may be several types of blocks) and then have it export to a txt file. I'm not sure if it's possible but I'd like to have it export in the order that the blocks were placed. The format I'm looking for would be like this: x,y,z x,y,z and so on... I can do it in Microstation but would prefer an Autcad Lisp. Any help is really appreciated!!!!! Quote
alanjt Posted December 21, 2010 Posted December 21, 2010 What determines how they were placed? This isn't very difficult to code, what do you have so far? Quote
eldon Posted December 21, 2010 Posted December 21, 2010 Before you go for lisp, have you tried the Attribute Extraction Tool. This enables the insertion point of blocks to be exported, and I believe it lists the blocks in the order of creation. If that fails then by all means go the lisp route. Quote
alanjt Posted December 21, 2010 Posted December 21, 2010 Before you go for lisp, have you tried the Attribute Extraction Tool. This enables the insertion point of blocks to be exported, and I believe it lists the blocks in the order of creation. If that fails then by all means go the lisp route. Excellent suggestion. Quote
Lee Mac Posted December 21, 2010 Posted December 21, 2010 This perhaps? http://lee-mac.com/ptmanager.html Quote
LGarduno Posted December 21, 2010 Posted December 21, 2010 We use the EATTEXT command to extract that info. Quote
Tharwat Posted December 21, 2010 Posted December 21, 2010 Check this out ... (defun c:THex (/ fNme ss) ; THARWAT 2010 (if (and (setq fNme (open "D:/Block-coordinates.txt" "w")) (setq ss (ssget "_:L" '((0 . "INSERT")))) ) ( (lambda (i / ss1 e pt1 ) (while (setq ss1 (ssname ss (setq i (1+ i)))) (setq e (entget ss1)) (setq pt1 (cdr (assoc 10 e))) (write-line (strcat (rtos (car pt1) 2) "," (rtos (cadr pt1) 2) "," (rtos (caddr pt1) 2)) fNme) ) ) -1 ) (princ) ) (close fNme) (princ "\n Written by Tharwat") (princ) ) Good luck. Tharwat Quote
alanjt Posted December 21, 2010 Posted December 21, 2010 Where do you write your code? Your formatting gives me a headache. Quote
Tharwat Posted December 21, 2010 Posted December 21, 2010 Where do you write your code? Your formatting gives me a headache. I have just finished writting them at the office . And they are simple and you do know that of course , so where did the headache come from ? Thanks Tharwat Quote
alanjt Posted December 21, 2010 Posted December 21, 2010 I have just finished writting them at the office . And they are simple and you do know that of course , so where did the headache come from ? Thanks Tharwat The formatting. I meant, in what program do you write your code? Quote
Tharwat Posted December 21, 2010 Posted December 21, 2010 The attached Vlisp editor with Autocad .(vlide) Quote
alanjt Posted December 21, 2010 Posted December 21, 2010 The attached Vlisp editor with Autocad .(vlide)Look into the Format Selection button. It's your code, I'm just commenting that it's incredibly hard to read. Quote
Tharwat Posted December 21, 2010 Posted December 21, 2010 Look into the Format Selection button. It's your code, I'm just commenting that it's incredibly hard to read. Is it due to the unordering way ? I mean, each sentence should be completed in a line to be clear for some people to read them well ? Things like .( for example ) (setq pt (getpoint "\n Specify Point :")) Not like the way I used like .... (setq pt (getpoint "\n Specify Point :") ) Is this what you mean ? Quote
alanjt Posted December 21, 2010 Posted December 21, 2010 Is it due to the unordering way ? I mean, each sentence should be completed in a line to be clear for some people to read them well ? Things like .( for example ) (setq pt (getpoint "\n Specify Point :")) Not like the way I used like .... (setq pt (getpoint "\n Specify Point :") ) Is this what you mean ? No, look at your code. The parens don't match, they don't even make sense. Perhaps it's just a result of you using tabs and forum code brackets don't work well with them. Quote
Tharwat Posted December 21, 2010 Posted December 21, 2010 No, look at your code. The parens don't match, they don't even make sense. Perhaps it's just a result of you using tabs and forum code brackets don't work well with them. But in my Vlisp editor they are matched completely . Have you tried the routine ? What about the outcome of it ? Quote
Lee Mac Posted December 21, 2010 Posted December 21, 2010 Make sure the VLIDE isn't inserting tabs into your code: Tools » Environment Options » Visual LISP Formatting Options » (uncheck) Insert Tabs Quote
Tharwat Posted December 21, 2010 Posted December 21, 2010 Make sure the VLIDE isn't inserting tabs into your code: Tools » Environment Options » Visual LISP Formatting Options » (uncheck) Insert Tabs Thanks Lee . That's right , it was checked. so I released it . What is the problem that may cause for the others when they copy and paste codes in their Vlide editors ? Would codes get far from eachothers ? I am still wonder why ! Thanks Quote
justindm Posted December 21, 2010 Author Posted December 21, 2010 @Tharwat - yours works awesome! much simpler than the eattext (and much less filling ) Is there a way to specify the location of the output file? Or just to the same place as the dwg location? Quote
Lee Mac Posted December 21, 2010 Posted December 21, 2010 Is there a way to specify the location of the output file? Or just to the same place as the dwg location? See my earlier link... Quote
justindm Posted December 21, 2010 Author Posted December 21, 2010 im either blind or dumb (maybe both). not sure what link youre talking about...... 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.