export x y z of multiple points to txt file

export x y z of multiple points to txt file

hugues_monard
Explorer Explorer
1,923 Views
15 Replies
Message 1 of 16

export x y z of multiple points to txt file

hugues_monard
Explorer
Explorer

Dear Autocad experts

 

I am new user of Autocad (last version). I am importing a STEP file with no problem.

 

The ID fonction allows me to get the X Y Z coordinates in the SCU of points by cliking on it.

I need to do it on a large number of objects 50 to 100, representing a lot of points. So doing it by hand is a pain.

 

I'd like to have a function as ID, on multiple points on which I will clic. 

 

For example, I have a yellow 3D L shape mechanical support (see attach file), and I' d like to get the list of all the

12 points coordinates x y z in a txt file, of all the 8 points for the red objet, etc, in the same reference frame.

 

I imagine a function allowing me to clic on mutiple points of a first object, till I say this is the last, then

start again for another object, etc.

 

Is it also possible to clic on a circle and get the center xyz and the radius ?

 

The extractdata functions is giving information but the X Y Z of the insertion point, not all the points of my object.

 

Thanks for your help

0 Likes
1,924 Views
15 Replies
Replies (15)
Message 2 of 16

CGBenner
Community Manager
Community Manager

@hugues_monard 

Hello & Welcome!

I've moved your post here as there may be a programming solution for what you would like to do.  Hopefully the experts here can offer some advice.  Good luck!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes
Message 3 of 16

VincentSheehan
Advisor
Advisor

Something like this?List Point.PNG

Vincent Sheehan

Sr. Civil Designer
Poly In 3D Blog

Message 4 of 16

Kent1Cooper
Consultant
Consultant

Since the parts you mention picking the corners of are 3D Solids, I think going around and picking on the corners is going to be necessary, because there's no way I know of to extract those locations from the information stored about them.  And some are nested several levels down into Blocks, which would complicate things further even if corners could be extracted, but doesn't matter if you're just picking points.

 

Can you give an example of the kind of output file you are picturing?  That is, in what format the X & Y & Z coordinates should be written, how the flagging of a new object should be designated, etc.

 

And yes, you can get the center and radius of a Circle that you pick on, in several ways.  How would that fit into your imagined process?  For example, an option to call for, indicating that the next pick will not be a point location like a corner, but an object like a Circle from which to pull information regardless of where on it you pick?  Etc.

Kent Cooper, AIA
0 Likes
Message 5 of 16

Sea-Haven
Mentor
Mentor

I think you need to clarify which points you want and why are you trying to get 3d points of a solid ?

 

If you use massprop it returns a box size of a 3d object, you can get at this data.

Select entities:  ----------------   SOLIDS    ---------------- 

                    Mass:  1764929.015
                  Volume:  1764929.015
            Bounding Box:  
             Lower Bound:  X=   644.000  Y=   96.000  Z=   0.000
             Upper Bound:  X=   856.000  Y=   308.000  Z=   50.000
0 Likes
Message 6 of 16

hugues_monard
Explorer
Explorer

thanks for the right place !

 

H

0 Likes
Message 7 of 16

hugues_monard
Explorer
Explorer

Dear vlsheehan

 

thanks for your answer.

Whats you are showing is the result of the exportdata function.

The X Y Z shown here are the coordinates of the insertion points of all objects identified,

not the coordinates of all the points of the objects.

For example, for the Lbracket object, I would want to get an output like :

 

Lbracket
p1_1 175 80 -125
p1_2 175 15 -125
p1_3 ...

...
p1_12 5 20 -25

 

Rbracket
p2_1 175 80 -25
p2_2 ...

 

Here I got the xyz with the ID function giving me in the command window :

Commande: ID
Spécifiez un point: X = 175.0000 Y = 80.0000 Z = -125.0000
Commande: ID
Spécifiez un point: X = 15.0000 Y = 80.0000 Z = -25.0000
Commande: ID
Spécifiez un point: X = 5.0000 Y = 20.0000 Z = -25.0000

 

but one has to type in "ID" each time, which is a pain for 200 points .

 

I would like to type in a unique command, and click each time to get xyz of the points.

 

 

H

 

0 Likes
Message 8 of 16

hugues_monard
Explorer
Explorer

Dear Kent1Copper

 

I would like to type a command and then click on the points I need to get on output looking like :

 

Lbracket
p1_1 175 80 -125
p1_2 175 15 -125
p1_3 ...

...
p1_12 5 20 -25

 

Rbracket
p2_1 175 80 -25
p2_2 ...
...
p2_12 ...

 

Rod1  [cylinder center x y z radius length ]
C1 190 60 -75 5 200

 

etc...

 

I guess I have to write a function in Lisp to do that, but I don't have the time to learn Lisp

 

H

0 Likes
Message 9 of 16

Sea-Haven
Mentor
Mentor

"but I don't have the time to learn Lisp" 

 

But I don't have time to answer !

 

Oh yeah can do but you need to pay. 

 

The forum is not a ask and you will get, the people posting are doing it as a free service taking time out of their day to help you. 

Message 10 of 16

john.uhden
Mentor
Mentor

@Kent1Cooper ,

I think one entsel could provide all the info needed.

(setq pick (entsel "\nSelect a point on the object: "))

... (ename (x y z))

(setq e (car pick))

... ename

(setq p (cadr pick))

,,, (x y z)

(setq p (osnap p "end"))

... (x y z) at nearest end

 

Of course you could apply a different snap depending on what type of object ename is.

 

John F. Uhden

0 Likes
Message 11 of 16

Sea-Haven
Mentor
Mentor

Picking a pt on a solid may not return Z, need to set snap settings to accept Z, having problems with my Bricscad V20.

0 Likes
Message 12 of 16

hugues_monard
Explorer
Explorer

Dear John

 

thanks for the frame of the Lisp suggested.

 

I'll try to make it work !

 

H

0 Likes
Message 13 of 16

Kent1Cooper
Consultant
Consultant

@john.uhden wrote:

I think one entsel could provide all the info needed.

(setq pick (entsel "\nSelect a point on the object: "))

... (ename (x y z))

.....

Of course you could apply a different snap depending on what type of object ename is.


Except that Osnap doesn't apply during selecting an object under (entsel).  So if they want the corners of a 3D solid, a routine would then presumably need to apply an Osnap call to the point where they picked.

Kent Cooper, AIA
0 Likes
Message 14 of 16

Kent1Cooper
Consultant
Consultant

@hugues_monard wrote:

....

I would like to type a command and then click on the points I need to get on output looking like :

 

Lbracket
p1_1 175 80 -125
p1_2 175 15 -125
p1_3 ...

...
p1_12 5 20 -25

 

Rbracket
p2_1 175 80 -25
p2_2 ...
...
p2_12 ...

 

Rod1  [cylinder center x y z radius length ]
C1 190 60 -75 5 200

 

etc...

....


That defines only part of what I was asking about, regarding User procedure.  There would need to be some prompt at the beginning for the heading for the first object [your "Lbracket" -- not something that could be extracted from the object iself], and some kind of option to pick or type in to start on a new object when you've gotten the last point from the current one, with prompt for what to call that, and some other kind of option by which to specify whether the next one [including for the first one] is going to be a Circle or a Solid [or any other kind(s) of thing(s)?], etc., etc.

 

So let's say, in your outline above, you've picked your p2_12 point, the last one on the "Rbracket" object.  Now you intend to pick on the "Rod1" object.  What should the prompt look like?  It should still offer the option to pick another point on "Rbracket" because it can't know yet that you've gotten all you want from that.  And it needs to allow for a new object, and what kind it should be so it can either advance the start of the next text line to p3_1 or to C1 [or something else?}.

Kent Cooper, AIA
0 Likes
Message 15 of 16

hugues_monard
Explorer
Explorer

Dear Kent

 

thanks for you reply. It make me think and  helping me to clarify my ideas on what I want.

The output format is driven by another soft I will use that is only knowing simple objects as

planes, parallelepides, cylinders, wedges, ..

 

The user should indeed have identify the type of entry wanted, before clikcing on the points.

In the step file example the L bracket can be reduced to two paralelepipede shape with 8 points,

the rod with a cylinder.

 

Now the macro should do   :

 1 enter a name for example "Lbracket1",

 2 a type "RPP" or "RCC" or "plane" or else (list to be defined)

3 and click on 8 points if RPP, 3 for RCC, etc..

4 the prompt should ask if it is the last entry point of this object

 5 the prompt ask for the next object or was it the last one

6 go to 1

 

H

 

 

0 Likes
Message 16 of 16

Sea-Haven
Mentor
Mentor

Picking multi points is easy, (while (setq pt (getpoint if you press enter rather than picking a point the while will finish, so next step is make the text of the point.

 

You will need a double while, the outer says continue with a new label, inner is get points.

 

(while

change label here

  (while

0 Likes