how to plot 2-D point distribution from text file

how to plot 2-D point distribution from text file

Anonymous
Not applicable
3,547 Views
19 Replies
Message 1 of 20

how to plot 2-D point distribution from text file

Anonymous
Not applicable

Hi:

   I have autodesk autocad 2016 (actually I am confused what is autocad civil, plant....I guess my version includes everything?). We want to make a pattern .dxf file, which will be sent to a manufacturer to make a pattern glass.  We will put 300,000 small circles(15e-3mm diameter) in a 12mm diameter large circle region. small circle need to be white and large circle need to be black. I could produce .dxf file in Matlab, but somehow I could specify the absolute size, and also have color issue. So I turn into Autocad, I guess Autocad could do it (please do not tell me I am wrong^_^)

  I generated the coordinate text file using Matlab, and then I tried to convert a small test text file to be a .scr file (add commas, and add one command on the first line, such as line, circle). but when I input "script" and try to load this file in Autocad, if my command is "line" in the .scr file, I could get spline plot, howeever, if I use "circle" I got nothing.

   Please let me know how to do it, thanks

0 Likes
Accepted solutions (1)
3,548 Views
19 Replies
Replies (19)
Message 2 of 20

Patchy
Mentor
Mentor

Autolisp probably can do it.

Let's see your photo and an example of coordinates, that would help.

0 Likes
Message 3 of 20

Anonymous
Not applicable

the attachment is a similar pic (I want my point/circle is white and the background is black)

my coordination file is simply like 

"

97.4645,45.6789,0

56.3546,35.4587,0

......

"

the first column is x, the second column is y, the third is z (actually z is always zero)

 

thanks

0 Likes
Message 4 of 20

Patchy
Mentor
Mentor

Can I have 10,000 coordinates of the circles?

0 Likes
Message 5 of 20

john.vellek
Alumni
Alumni

Hi @Anonymous, I suspect that you could do this more easily using blocks (one for each type of circle) and use your script as well.

 

Can you give me an example of your script file?

 

Please select the Accept as Solution button if my post solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 6 of 20

Anonymous
Not applicable

Hi:

   The attachment is a small example of my coordination file, thanks

0 Likes
Message 7 of 20

Anonymous
Not applicable

all circles have same radius, here is a simpla coord text file, first column is x, second is y, third is Z (always zero)

not sure how to add radius in the coord text file, even all radius are same.

0 Likes
Message 8 of 20

Patchy
Mentor
Mentor

I got this, not sure I got it right

 

 

 

Message 9 of 20

john.vellek
Alumni
Alumni

Hi @Anonymous,

 

I suggest using a block instead of just a circle. This will give you the opportunity to change the properties or even the shape of all the similar entities all at once if you need.

 

I brought your data into an Excel file and created a new column to build the command: =CONCATENATE("-insert block1 ",A1,1,1,0," ")

 

Once you add this to each row you can then copy this column and paste it into a text file with an extension of scr.

 

 

Then in AutoCAD, if your block exists in your drawing, you can use SCRIPT and select your file. It should insert all the blocks at the points you specify.

 

I didn't actually run this so it might need a bit of tweaking but I hope it gets you started. I suggest adding a post in the Customization forum for more help or I can move this thread if you like.

 

Please select the Accept as Solution button if my post solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 10 of 20

Anonymous
Not applicable

yes, thanks, this is what I want, even I noticed you only have the white boundary for each circle, not the inside

could you briefly explain how to do it? thanks

0 Likes
Message 11 of 20

Anonymous
Not applicable
I am testing it, please feel free to paste my thread to any forum, thanks
0 Likes
Message 12 of 20

Patchy
Mentor
Mentor

It can be done with script to insert block (which I don't know a lot)

 

In the drawing, make a circle and make a block out of it with name likes   c1

 

Make a script with points like this:

 

 

multiple

point
6.837156e+01,9.879347e+01,0
1.320830e+01,1.704320e+01,0
7.227245e+01,2.577923e+01,0
1.103535e+01,3.967993e+01,0
1.174929e+01,7.399477e+00,0
6.407179e+01,6.840961e+01,0
3.288142e+01,4.023883e+01,0
6.538120e+01,9.828352e+01,0
7.491315e+01,4.021840e+01,0

cancel

 

After I got the points, use autolisp replace points with block called c1

 

 

Some one will show you a shorter way and easier (Maybe this: http://www.lee-mac.com/ptmanager.html)

 

 

 

0 Likes
Message 13 of 20

Anonymous
Not applicable

thanks, I could plot multi points with .scr, but I still have the problem to run your .lsp file, could you briefly introduce more? thanks

0 Likes
Message 14 of 20

Patchy
Mentor
Mentor

You have points , then make a block

Draw a circle 15e-3mm diameter with center at 0,0,0

Command block, give it a name, insertion point at 0,0,0, pick the circle

 

command APPLOAD, find the PT2BLK.LSP and load it.

command PT2BLK, enter the name of the block you made, give it scale of 1, rotation 0 then pick the points by window or crossing.

 

Message 15 of 20

Anonymous
Not applicable

thanks, I am studying blocks and try to follow your commands

 

btw, from your multiplot points, I tried the follwoing in .scr file

"

multiple
DONUT
0 15.000000 -11.175222,-107.212631,0
0 15.000000 -275.747919,-371.234849,0

"

 I was very excited it could plot filled circles, however, I found  it will plot 3 circles for 2 line .scr file! please see the first attachment , and plot 5 circls for 3 lines .scr file, see the second attachment!

This is tooooooooooo strange

autocad.pngautocad_1.png

0 Likes
Message 16 of 20

Patchy
Mentor
Mentor

Insert as blocks then explode them, you'll get all circles.

Donut with i.d. same as o.d. will not work if you explode them, you'll get 2 arcs.

0 Likes
Message 17 of 20

Anonymous
Not applicable

Thanks 

I have succesfully repeat yoor steps,

now how to make them filled and output .dxf files? 

0 Likes
Message 18 of 20

Patchy
Mentor
Mentor
Accepted solution

Two ways, BHATCH command to fill them

if you want to make them donuts, should be an autolisp somewhere to make circles to donuts.

 

Make .dxf use command DXFOUT and ask the manufacture which version of .DXF does he want.

 

Capture.JPGTh

Message 19 of 20

Anonymous
Not applicable

thank you so much for the help, problem solved!

 

you .lsp did a cool work to replace all points with filled circles (set as block)

 

even the problem is solved, I still feel strange why

"

multiple
DONUT
0 15.000000 -11.175222,-107.212631,0
0 15.000000 -275.747919,-371.234849,0

....

"

plot more filled circles then listed. probably this multiplot only support "points"? What is the limit of the multiplot? thanks

0 Likes
Message 20 of 20

Patchy
Mentor
Mentor

Because you have not given the script i.d. and o.d. of the donut.

 

Try This:

 

multiple
donut
0
15.000000
-11.175222,-107.212631
-275.747919,-371.234849
-150.175222,-444.212631
cancel

0 Likes