Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

leeminardi
en respuesta a: Anonymous

A .dwg file is a binary file that has a proprietary format controlled by Autodesk.  It's format can change from version to version.  AutoCAD can also save files in a .dxf format.  DXF is an ASCII file that was originally created to enable 3rd party developers to write software that complements the features of AutoCAD. I think it would make much more sense for you to work from a dxf rather than dwg file. 

 

For example, the dxf code for a lwpolyline looks like this.

 

A portion of the code for a dxf file with a polyline with two straight segments followed by an arc then another straight segment looks like this:

AcDbPolyline
 90
        5
 70
     0
 43
0.0
 10
8.319873837667117
 20
11.99992329523352
 10
19.42205923226548
 20
16.98133090859468
 10
31.08996107392547
 20
11.04603673852302
 42
0.4338377669093521
 10
37.80784396922083
 20
13.48374686732284
 10
46.1521615979551
 20
16.16876090508994

A 10 indicates that an x coordinate follows, a 20 signifies a y coordinate.  Arcs are represented by "bulge factor (dxf code 42) where:

bulge = tan(angle/4), CCW is positive

 

You can search the dxf file for AcDbPolyline then extract the data you need to create the instructions to drive the SCARA.

lee.minardi