Jump to content
justindm

Extract XYZ values from multiple blocks

Recommended Posts

justindm

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!!!!! :D

Share this post


Link to post
Share on other sites
alanjt

What determines how they were placed?

 

This isn't very difficult to code, what do you have so far?

Share this post


Link to post
Share on other sites
eldon

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.

Share this post


Link to post
Share on other sites
alanjt
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.

Share this post


Link to post
Share on other sites
LGarduno

We use the EATTEXT command to extract that info.

Share this post


Link to post
Share on other sites
JPlanera
We use the EATTEXT command to extract that info.

 

who would want to EAT TEXT? thats gross and i think impossible... :lol:

Share this post


Link to post
Share on other sites
LGarduno
who would want to EAT TEXT? thats gross and i think impossible... :lol:

 

You got me, I will give you that. That is how we get points out to place into a TotalStation to place sleves and hanger inserts.

Share this post


Link to post
Share on other sites
JPlanera

Phew... I was concerned because of the high trans fat... Its good you have found an alternate use.. LOL

Share this post


Link to post
Share on other sites
eldon
Phew... I was concerned because of the high trans fat... Its good you have found an alternate use.. LOL

 

What a comedian :shock: I suppose you now want to poke fun at all the peculiar AutoCAD commands.

 

I suppose a Moderator could expunge all the irrelevant posts.

Share this post


Link to post
Share on other sites
JPlanera

no no. the holidays put me in a peculiar mood. I apologize, and will be more professional. and if i feel the need to poke fun at autocad commands, a dedicated thread will be started in its respective place.. that gives me an idea..

Share this post


Link to post
Share on other sites
Tharwat

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

Share this post


Link to post
Share on other sites
alanjt

Where do you write your code? Your formatting gives me a headache.

Share this post


Link to post
Share on other sites
Tharwat
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

Share this post


Link to post
Share on other sites
alanjt
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?

Share this post


Link to post
Share on other sites
Tharwat

The attached Vlisp editor with Autocad .(vlide)

Share this post


Link to post
Share on other sites
alanjt
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.

Share this post


Link to post
Share on other sites
Tharwat
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 ?

Share this post


Link to post
Share on other sites
alanjt
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.

Share this post


Link to post
Share on other sites
Tharwat
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 ?

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...