DXF to G-code conversion

Hi, I would like to write small tool for my private use which will convert AutoCAD DXF files to G-code like file for my NC machine.

I would say that I am almost done. My prog writes lines and is able to calculater radius of a circle.

The problem is that when reading DXF file I don't know how to get something which will tell me if the circle will be G02 or G03<

does anybody know how similar programs convert DXF files? especialy how they get if it is G02 or G03?

thank you in advance. Michal Tresner

Reply to
SpiNa
Loading thread data ...

Reply to
JR North

I really don't know how to calculate it from the previous steps. But I still believe that it is simply written somewhere in the DXF file.

One man told me that it has something to do with so called Bulge. he said > The dxf has what they call Bulge, If it is negative it is Clockwise or G02. If positive it is G03.

I found that bulge :: "" The bulge is the tangent of 1/4 the included angle for an arc segment, made negative if the arc goes clockwise from the start point to the end point; a bulge of 0 indicates a straight segment, and a bulge of 1 is a semicircle. ""

It seems to me that bulge is ONLY under some enity called VERTEX. unfortunatelly i have not found VERTEX anywhere in any of my DXF files.

he also told me to look into DXF file for #42.

i found a few 42 lines but it seems not to be concerning Bulge.

what am i doing wrong?

Reply to
SpiNa

It's not clear to me what your asking. Why can't your software decide what is the best direction to cut the arc?

In any case, I have (or once had) a few Autolisp programming books that explained .dxf syntax. You may also find some info here:

formatting link
There is at least one group dedicated to Autocad programming and customization on Autodesk's news server:

discussion.autodesk.com

Ned Simmons

Reply to
Ned Simmons

hi, your program can't decide which direction to draw circle it would produce different shape! it must read it from the DXF file same as the autocad do when opening it.

I have a lot of papers about DXF structure and syntax and I know that there is

-------------- Circe - entity X Y Z coordinates of the center R radius ARC XX° starting angle XX° ending angle

----------------- above simplyfied version

but I still don't know where does autocad know whether go CW or CCW form starting angle to the end.

in my DXF I have only circles and lines and so called Bulge is only available for the polyline entity.

There must be something for the circles!!!!

Reply to
SpiNa

Have you ever guys drawned anything in autocad?

if i want to make some model it consis for example of semicircles and lines.

if you wrae a circle form 90° to 180° CW it will be different result than if you draw it CCW!!

Reply to
SpiNa

Yeah, but that isn't a circle. It is an *arc*. Autocad draws arcs following polar notation conventions. In other words, CCW from the start point to the end point. OTOH circles are closed forms,

360 degrees, and have neither a start nor end point. So the direction in which they are drawn is moot.

Gary

Reply to
Gary Coffman

My apologies to everyone!

I simply exchanged words Circle and ARC !

So again i need to know direction of every arc the tol will cut.

Reply to
SpiNa

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.