Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: BR549 on June 10, 2011, 04:17:24 PM

Title: ACAD import points to a drawing
Post by: BR549 on June 10, 2011, 04:17:24 PM
DOes anyone know how to bring in points to a drawing in ACAD ?

What I have is a set of points that represents a cam lobe. The points consist of height around a 360deg circle (polar)

The height represents the profile of the lobe around a base circle.

(;-) TP
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 10, 2011, 06:23:08 PM
What format are they in? I might be able to whip together a VBA importer. What version of AutoCAD are you using?
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 10, 2011, 09:21:44 PM
HI GERRY, I can put the points in any format. I use ACAD2000.

(;-) TP
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 10, 2011, 10:03:49 PM
Let me see what you've got.

Actually, do you just want to create points, or do you want to do something else with them?
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 10, 2011, 10:24:19 PM
ACtually I want to place the points then do a smoothing of the shape.Then output that shape in Gcode form as X (linear) and A axis (polar) being a rotary axis

But I will take anything I can get (;-) This is for a CNC cam grinder project I am working on.

The first column is the height data is is based from the center of the base circle.

The second column is the polar positions in deg. At each polar point the height extends from the center.

(;-) TP
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 10, 2011, 10:27:13 PM
Can you give me a file to look at?
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 10, 2011, 10:50:45 PM
This is an example of the basic motion AND the profile based on the data. I can output the points file from EXCELL in about any manner or order you require.

A basic probed point file is 3600 an advanced profile may be up to 360,000 points
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 10, 2011, 11:21:18 PM
Comma separated is preferred. I have a macro that creates a mesh from a point cloud created with the digitizing wizard. I should be able to modify it to do what you want.
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 11, 2011, 09:22:41 AM
Disregard the csv statement. This works with TAB delimited files like the sample you posted. I hope it works in ACAD2000.  :o

All points are referenced from 0,0.

Note that there's an anamoly in your sample. Note the angle in the middle line here:
1.220   264.500
1.210   233.750
1.200   268.250


233.75° should be between the other two angles.

Here's a screenshot of AutoCAD with the points selected.

If you'd prefer, I can make the points a polyline. Or both. Just let me know.
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 11, 2011, 10:42:59 AM
(;-) That is one of the reasons to be able to SEE the profile AN anomoly sticks out like sore thumb.

That looks great.  Converting to polylines would be helpful I could always explode it out if needed.  Is it possible to include a center point for the base circle ?  WouldI just add in a zero lift data point?

NOW the next question. AFTER I have smoothed out any quircks can I do curve fitting where it will work???   CAn you take the finish product back out to points or possible simple GcodeGcode??

NOT an Acad wizz, (;-) TP

Title: Re: ACAD import points to a drawing
Post by: BR549 on June 11, 2011, 11:01:29 AM
Gerry, Is this run as a macro in Acad?

OT: I really like the new screenset. I am considering moving over to them.  Are they customizable? I have a ton of extra functions that I normally run that I would have to migrate to them  AND a few things I never use that need to come off.

(;-) TP
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 11, 2011, 11:12:51 AM
Is it possible to include a center point for the base circle ?

Done.

Quote
NOW the next question. AFTER I have smoothed out any quircks can I do curve fitting where it will work???  

I don't really understand what you want to do. Automatically fit a polyline to the points? Or some other entity?

Quote
Can you take the finish product back out to points or possible simple GcodeGcode??

You want to edit the points, and create g-code from them? What would the g-code look like?

As I said, I already had a similar macro, so it only took me about 20 lines of code to do what you wanted. Adding the polyline isn't too hard, but it can get complicated in a hurry.
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 11, 2011, 11:14:22 AM
Gerry, Is this run as a macro in Acad?


Yes. You can use VBALOAD to load it, and VBARUN to run it. All you have to do is select the .txt file.
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 11, 2011, 11:19:32 AM

OT: I really like the new screenset. I am considering moving over to them.  Are they customizable?

Depends on how good your Photoshop skills are. :)
It's 7 basically identical pages, with only the tab portions of each page being different. The Photoshop file I offer has the tab portions separated so that you can change any individual tab easily. If you want to change something on the toolbar or elsewhere outside the tab, the Photoshop file allows you to make a single change, and easily export the 7 pages with that change.
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 11, 2011, 11:43:18 AM
THanks Gerry The points will be just fine I think I can manage curve fitting and convert to polyline manually if needed.  I think I can export that profile back out as a DXF and use it . But have not tried that part  yet.

Thanks (;-) TP
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 11, 2011, 11:53:40 AM
Update to add center point
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 11, 2011, 12:17:15 PM
YOU are DA CADMAN, (;-) TP
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 11, 2011, 12:24:30 PM
Gerry could you do a favor? If you have the points file IN acad could you dxf it out and post it here. I am home and ACAD is at the shop. I did not plan to go to the shop today.

I use(testing ) a free copy of hobby Pogecad here and it does not support VBA.

I would like to play with drawing some today to see IF I am smarter than a box of rocks (;-)

(;-) TP
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 11, 2011, 12:56:57 PM
Here you go.
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 11, 2011, 01:20:08 PM
Thanks "CadManDo"

(;-) TP
Title: Re: ACAD import points to a drawing
Post by: djc on June 14, 2011, 08:15:30 AM
Does anyone know how to bring in points to a drawing in ACAD?

I realise that your question has now been amply answered, but for future reference, the way to proceed is via a DXF file. A few stabs into Google will reveal that free converters exist to take virtually any file you can think of both into and out of DXF format. In your particular case, CSV to DXF is the most appropriate.

In addition, you can do it yourself via Excel: open up a blank drawing in Acad and put a single point at the origin. Save as ASCII DXF. Open in Notepad and look for the [Entities] section. That is what a single point at 0,0 looks like. Save the DXF again with two points and examine. Note the difference. You now have enough information to cut and paste from Excel. Polylines are more complicated but same principle.

If you search a bit further, you can find the DXF file specification. This contains inter alia a minimal DXF file. Use this (as a header and footer) and you can automatically generate from Excel.
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 14, 2011, 04:22:55 PM
oK I see the method.But I don't see where it applies here. I am taking a points file with A/Z data being A is polar and Z is height.  THen Gerrys macro takes that data and converts it into XY coords and inserts into the drawing at 0,0 XY.

But all that aside(;-) How would I get the data inside EXCELL put into the DXF format.I would have to create a header and footer block. Then create an blank entity block for EACH point to input the data Inserting the data into the empty spaces in the block ??

The Number of data points could run from 360 to 360,000

Then save out as text file ? That is not counting the COnversion from polar to linear.

Just curious,(;-) TP
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 21, 2011, 12:01:53 AM
Gerry another ACAD question when you have the time.

Can you take a set of points, imported cam data, and start at one point and connect the dots with ARCs.

Lets say Start at a point then reference the next 2 points and set the  radius between the two outer points from the offset off of the center point???


Maybe a LISP routine ?

Just a thought, (;-) TP
Title: Re: ACAD import points to a drawing
Post by: ger21 on June 21, 2011, 06:50:43 AM
With Lisp or VBA, yes, but they'd be individual arcs.
Title: Re: ACAD import points to a drawing
Post by: BR549 on June 21, 2011, 01:25:03 PM
Hi Gerry the final output is straight lines any way BUT being that it is in the A axis they are all arcs .

Could I blend that process into the points import program?   I don't know much about Lisp or VBA but I can have a go at it.

I have been learning SheetCamism for building post so it can't possible be any harder than that (;-)

(;-) TP

Title: Re: ACAD import points to a drawing
Post by: ger21 on June 21, 2011, 01:58:33 PM
For me, VBA is much more readable the Lisp. I've written complex Lisp code in the past, but mostly use VBA now.

Look in the help file (VBA reference section) for the AddArc method. It looks like adding arcs is rather complicated, as you'll need to find the center of each arc, as well as the start and end angle. You can find the angles using the "AngleFromXaxis" method, after you find the centerpoint.

I think a much easier method is to create a polyline from the points. I'll need to check, but I think you can use pedit to fit arcs to the polyline, and explode the fit polyline into arcs. This would be a lot easier than creating the arcs. But I'm not sure if it'll change the accuracy.