:2003-12-16:(1975),,,,AutoCADDXF刘传亮,陆建德(苏州大学计算机学院,江苏苏州215006):DXF,DXFDXF,DXF,DXFDXFDXF,,DXF,:AutoCAD;DXF;;:TP311.1:A:1005-3751(2004)09-0101-04AnalysisonAutoCADDXFFileFormatandthe2ndDevelopmentGraphicsSoftwareProgrammingLIUChuanliang,LUJiande(SchoolofComputerScienceandTechnology,SuzhouUniv.,Suzhou215006,China)Abstract:TheDXFformatisoneofthewidelyusedgraphicsexchangeformatsinthetraditionalgraphicsapplicationdevelopment.Thelotsof3rdparty-developedgraphicssoftwarehavesupportedDXFformat.ToresolvetheDXFformats2nddevelopmentproblem,thispaperhasintroducedthestructureoftheDXFformatexchangeablefileinbriefandhascomparedthecontentsandevolutionbetweenthedifferentversionsofDXFfileformat.ThepaperhasdiscussedandanalyzedindetailtheprogrammingmethodstoDXFfileformatinthe2nddevelopment.Finally,withanapplicationinaspecificproject,thepapergivesacommonandversion-compatiblesolutionforthesamekindsofapplicationdevelopment.Keywords:AutoCAD;DXFfile;version;graphicssoftware0DXF(DrawingInterchangeFormat,)AutoCAD,AutoCADASCII[1],AutoCADAutoCAD,DXFAutoCAD,DXFAutoCADR12,R13,R14,AutoCAD2000,2000i,AutoCAD2002,,DXF,DXFDXFDXF,DXFAutoCADYH,AutoCAD,,AutoCADYH,DXFAutoCADDXFDXF,DXF1DXFAutoCADDXFASCII,ASCII,!DXF∀ASCIIDXFDXF(),14920049MicrocomputerDevelopmentVol.14No.9Sep.2004,DXF,,DXF,DXF,(),,(),255(AutoCAD20000~91000~1009255,2049),DXF(SECTION)0SECTION,2(HEADER)0ENDSEC,0EOF:*HEADER,AutoCAD*CLASSES,BLOCKSENTITIESOBJECTS*TABLES,:APPID()BLOCK-RECORD()DIMSTYLE()LAYER()LTYPE()STYLE()UCS()VIEW()VPORT()*BLOCKSAutoCAD*ENTITIES(),()*OBJECTS,*THUMBNAILIMAGE,,XDXF256,SAVE,SAVEASWBLOCK,OPENINSERTDXF,HEADER,HEADER;,TABLES,TABLES,LTYPE,LAYER,BLOCKS,BLOCKSENTITIESENTITIES,LAYER,,7CONTINUOUS,EOFDXF(:#;),Autodesk(1)HEADER:;************************0;HEADERSECTION2HEADER;************************9;$;;;;************************0;HEADERENDSEC(2)ENTITIES:;************************0;ENTITIESSECTION2ENTITIES;************************0;5330100∃102∃14AcDbEntity8layer100AcDb...;************************0;ENTITIESENDSEC2DXF(1)DXFAutodesk1982AutoCADAutoCADR1219927,DOS,R12R12DXFHEADER,TABLES,BLOCKSENTITIESR12,CLASSESOBJECTS19941997R13R14WindowsAutoCAD,,AutoCAD,DXF:CLASSESOBJECTS,ELLIPSE()LWPOLYLINE()SPLINE()AutoCAD2000,2000i2002InternetDXF,,THUMBNAILIMAGEDXFHEADER,9$ACADVER,,11AutoCAD,DXF$ACADVER1表1AutoCAD各版本的DXF版本号$ACADVERAutoCADAC1006AutoCADR10AC1009AutoCADR11R12AC1012AutoCADR13AC1014AutoCADR14AC1015AutoCADR152000AC1015.05AutoCAD2000i(2)DXFR12R14DXF,R12R14AutoCAD,R12R14DXFAutoCADR13,,DXFCLASSESOBJECTS,R12DXF,POLYLINE(),,DXF,129(VERTEX),14,1806R13,VERTEX,POLYLINE,,R12,R13,36,R123DXF,DXF,(,)DXF,AutoCAD[2]AutoCAD,,,,,YH,DXFVC6.0DXF,1VC6.0R12R14DXF,[3]voidCDxf::ReadArc(FILE*fp,CDC*pDC){intgCode;//floatx1,y1,r,start,end,pi=3.1415926;//charstr[80];fscanf(fp,!%s\n∀,str);do{gCode=atoi(str);switch(gCode){∃103∃9:AutoCADDXF图1读取DXF文件流程图case10://!10∀,xfscanf(fp,!%f\n∀,&x1);//xbreak;case20:fscanf(fp,!%f\n∀,&y1);//ybreak;%%//default:fscanf(fp,!%s\n∀,str);break;}fscanf(fp,!%s\n∀,str);//}while(strcmp(str,!0∀)!=0);//!0∀,%%DrawArc(pDC,x1,y1,r,start,end);}4YHDXF,DXF,YH,:[1].AutoCAD2000[M].:,2000.[2].AutoCAD[M].:,2000.[3].AutoCADC[M].:,1995.(上接第100页)表1可重用构件的信息表结构%%%%%%%%%%%%%%:;:;:,;:,,;:,;:,;:ODDPALPAD,,5PDM,PDM,PDM!∀,,,:[1],,.CAD[J],2002,39(4):215-216[2].[J].,1998,9(12):881-883[3],,.PDM[J],2004,26(4):392-395[4].CAD[J].,1998,9(9):651-655[5]./[J],2002,(1):130-132[6]KuokkaR.CommunicationinfrastructureforConcurrentEngineering[J].ArtificialIntelligenceforEngineeringDesign,1995,(9):283-297∃104∃14