Jump to content

Extract XYZ values from multiple blocks


justindm

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 39
  • Created
  • Last Reply

Top Posters In This Topic

  • Tharwat

    12

  • alanjt

    6

  • Lee Mac

    5

  • symoin

    5

Top Posters In This Topic

Posted Images

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ?

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...