1. ## Importing X & Y points to AutoCAD- how plz?

OK, I've had no luck telling autocad that I want it to draw X and Y points according to a formula Z=f(X), exact formula below:

Z=[X^2/{R+((R^2-((K+1)*X^2))^0.5))}] +A2^2 +A4^4 +A6^6 +A8^8 +A12^12

So I made a program in Basic that said... basicaly (you get the idea, not writing the whole code out):

For X= 0 to DIA STEP INCR
Z=f(X)
Open 1,1,1 FILENAME\$
Print #1, X;".";Z
Next X
Print #1 "EOF"
Close #1

Now.. this gives me around 790 lines of co- ordinates in X and Y for a step size of 10um over an X travel of about 7.4mm. The sag (Z) values check out, so my code is ok.

So.. I have the X, Y co- ordinates *bounces*.

My question is... can I import this from a simple text file into Autocad so it draws the profile in 2D?

Ie: Can I import over 700 X, Y co- ordinates into AutoCAD cos it is doing my nut in.

I would dearly love to just give AutoCad the formula and say "step 0.01mm in X and figure it out Y yourself due to the formula", but there seems no way to do this. However... I am not daft enough to think that others don't know better than me myself and I.

Any help greatly appreciated!

Iain.

2. I can write the VBA code to do it, if you give me a week or two. What do you want to draw, a 2D polyline? Or just a series of points. I'll try to post some code for you as well to open a text file in AutoCAD and read the points. I have a macro that reads a point cloud from mach3 and creates a mesh of 3D faces. This should be similar. What format is the text file?

3. Thanks Ger!

I know you be a busy man and so your reply is very much appreciated - I've been trying to do this for a week or more and have resorted to actualy trying to programme something on my own that will print me a profile of the surface in 2D, but I'm sure there must be some way to do it within ACAD.

I've got about half way through my own prog- it lets me take all the above variables and calculates the Z value for a given X value and repeats in steps determined by the increment.

These values I can output as a text file- editeable in WordPad so I can manualy add the Prologue, side and back face. I can then rename it to a .JFL file (Job File) that my machine can read.

My aim, however, is to be able to get all these X and Z values into ACAD as a set of point-to-point lines. I plan to REVOLVE these lines (after PEDIT) to create a solid 3D graphical representaion of the job to impress my customers (all the above variables change with each job, but the formula stays roughly the same- any alterations I can make in my prog easily enough).

All I need ("all" I say, lol- been trying for a week!) is to be able to get ACAD to recognise a bunch of X and Z values and print these as a 2D line (note that ACAD calls it X and Y, I only call it X and Z cos of my lathe's terminology).

Here's the X and Z values, ignore the prologe, side and back face etc, I only needed these in there for my machine to *stupidly* know what to do

It's easy nuff for me to replace Z with Y if that helps, or even delete all the X's and Z's and stick a space in between them if that helps?

Iain.

4. A clean file with just the X and Y values with a space between them would be easiest.

5. No problem! I deleted the X and leading space and the Z values which I replaced with a Space. Saved as Windows text default with a carriage return and linefeed (can delete these too if needed?).

Thanks again for looking at this, you've helped me in the past and it's well appreciated!

6. GER21 what macro do you have that reads pointclouds in mach3...

9lrac9

7. Originally Posted by 9lrac9
GER21 what macro do you have that reads pointclouds in mach3...

9lrac9

8. Iman, try this, it seems to work OK. Reads your text file and draws a single polyline.

Go to Tools>Macro>Load project and load the macro. Then use Tools>macro>macros and choose run. Pick your text file and away you go. There's no error trapping, so it will crash if the file format is not correct. Just X and Y coordinates separated by a space.

9. Thanks mate, will try it today- couldn't yesterday cos I was having Real Life hassles.

Iain

10. Hmm gives errors, file format is ok, might be my version of AutoCAD- I have 2002 on my Desktop, but I've got 2006 on my laptop- will try that. Errors are as follows:

***Fatal Error Unimplemented AcRx Class::Copy from () function invoked.
***Error handler re- entered. Exiting now.

In fact, since I only need it for presentation purposes I manualy inputed the points (not all of them, just a few)... will work on it more laters. Got to go design lots of tooling (and am 2 weeks behind lol).

11. Works fine in 2002 here, and also worked in 2007. When do you get the error?

12. Here's the macro results of your sample file you posted.