本文整理汇总了C++中DL_Dxf类的典型用法代码示例。如果您正苦于以下问题:C++ DL_Dxf类的具体用法?C++ DL_Dxf怎么用?C++ DL_Dxf使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DL_Dxf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImportDXFFile
BOOL __stdcall ImportDXFFile(const TCHAR* lpszFileName, Painter* painter, Layers* layers, Blocks* blocks)
{
layers->clearLayers();
blocks->clear();
Draw_Dxf* creationClass = CreateDraw_Dxf(painter,layers,blocks);
DL_Dxf* dxf = CreateDL_Dxf();
#ifdef UNICODE
char str[MAX_PATH];
WideCharToMultiByte(CP_ACP,0,(TCHAR*)lpszFileName,-1,str,MAX_PATH,NULL,NULL);
std::string strFileName(str);
#else
std::string strFileName(lpszFileName);
#endif
if (!dxf->in(strFileName.c_str(), creationClass))
{ // if file open failed
DestroyDL_Dxf(dxf);
DestroyDraw_Dxf(creationClass);
return false;
}
blocks->regen();
layers->regen();
DestroyDL_Dxf(dxf);
DestroyDraw_Dxf(creationClass);
return true;
}
示例2: TEST_F
TEST_F(TestDrawing, TestFromParsedDrawing) {
ParseDXF parser;
DL_Dxf dxf;
dxf.in("test_shape.dxf", &parser);
Drawing const& drawing(parser.GetDrawing());
drawing.Print(std::cout);
std::cout << std::endl;
double yCenter = (2.51892L-0.518918L)/2+0.518918L;
double xCenter = (3.35231L-1.35231L)/2+1.35231L;
std::list<double> collissions;
Line line1(xCenter, 0, xCenter, 10);
drawing.GetCollissions(line1, collissions);
collissions.sort();
ASSERT_EQ(2u, collissions.size());
pt center = drawing.GetCenter();
EXPECT_TRUE(center.y<=(yCenter+0.001)) << "Expected=" << yCenter << " Actual =" << center.y;
EXPECT_TRUE(center.y>=(yCenter-0.001)) << "Expected=" << yCenter << " Actual =" << center.y;
EXPECT_TRUE(center.x<=(xCenter+0.001)) << "Expected=" << xCenter << " Actual =" << center.x;
EXPECT_TRUE(center.x>=(xCenter-0.001)) << "Expected=" << xCenter << " Actual =" << center.x;
}
示例3: DL_Dxf
void InputFormatDXF::readFeaturesInto(OutputFormat * outputHandler) {
// Pull in actual data now...
this->output = outputHandler;
DL_Dxf * getData = new DL_Dxf();
if (!getData->in(this->filename, this)) {
fprintf(stderr, "Could not retrieve data from input file.\n");
delete getData;
exit(1);
}
// Clean up any hanging polylines:
this->finishPendingPolyline();
if (this->filename) {
delete this->filename;
this->filename = NULL;
}
if (this->insertionReceiver) {
delete this->insertionReceiver;
this->insertionReceiver = NULL;
}
// Don't delete output format - caller can do that
this->output = NULL;
delete getData;
}
示例4: input
void input(std::string filename)
{
DL_Dxf dxf;
if (!dxf.in(filename, this)) {
std::cerr << "Unable to open input file '" << filename << "'\n";
exit(1);
}
}
示例5: testWriting
void testWriting() {
DL_Dxf* dxf = new DL_Dxf();
DL_Codes::version exportVersion = DL_Codes::AC1015;
DL_WriterA* dw = dxf->out("myfile.dxf", exportVersion);
if (dw==NULL) {
printf("Cannot open file 'myfile.dxf' \
for writing.");
// abort function e.g. with return
}
示例6: testReading
void testReading(char* file) {
// Load DXF file into memory:
std::cout << "Reading file " << file << "...\n";
Test_CreationClass* creationClass = new Test_CreationClass();
DL_Dxf* dxf = new DL_Dxf();
if (!dxf->in(file, creationClass)) { // if file open failed
std::cerr << file << " could not be opened.\n";
return;
}
delete dxf;
delete creationClass;
}
示例7: model
DXFReader::DXFReader(tModel *m, QString fileName)
: model(m)
{
DL_Dxf dxf;
activeElement = NULL;
subLayer = NULL;
if (!dxf.in(fileName.toStdString(), this)) {
// std::cerr << "drawing.dxf could not be opened.\n";
}
}
示例8: strcpy
dxfbezier2linesClass::dxfbezier2linesClass(string file_name, int st, double textLengte)
{
n=0;
res = 50000;
text_lengte = textLengte;
//strcpy(file,file_name);
aantal_punten = st;
char *cstr = new char[file_name.length() + 1];
strcpy(cstr, file_name .c_str());
DL_Dxf* dxf = new DL_Dxf();
if (!dxf->in(cstr, this)) // if file open failed
{
std::cerr << file_name << " could not be opened.\n";
exit(1);
}
delete dxf;
calcLine();
Scale();
// char* file="twee.dxf"
}
示例9: main
/*
* @brief Main function for DXFLib test program.
*
* @param argc Number of delimited items on command line,
* including program name.
* @param argv Pointer to array of command line items
*
* @retval 0 if missing input file argument or
* file couldn't be opened
* @retval 1 if file opened
*/
int main(int argc, char** argv) {
// Check given arguments:
if (argc<2) {
usage();
return 0;
}
//DL_Dxf::test();
// Load DXF file into memory:
std::cout << "Reading file " << argv[1] << "...\n";
Test_CreationClass creationClass;
DL_Dxf dxf;
if (!dxf.in(argv[1], &creationClass)) { // if file open failed
std::cerr << argv[1] << " could not be opened.\n";
return 0;
}
return 1; // file could be opened
}
示例10: CDxfParserEx
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct_)
{
#ifdef _TEST_CODE
CDxfParserEx* creationClass = new CDxfParserEx();
DL_Dxf* dxf = new DL_Dxf();
if (!dxf->in("C:\\1.dxf", creationClass))
{
return 0;
}
#endif
if (CFrameWnd::OnCreate(lpCreateStruct_) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("未能创建工具栏\n");
return -1; // 未能创建
}
if (!m_wndEditToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_LEFT
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndEditToolBar.LoadToolBar(IDR_EDIT))
{
TRACE0("未能创建工具栏\n");
return -1; // 未能创建
}
if (!CreateComboBox(ID_COMBOBOX))
{
TRACE0("Failed to create combo box\n");
return -1;
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("未能创建状态栏\n");
return -1; // 未能创建
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
// m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
// EnableDocking(CBRS_ALIGN_ANY);
// DockControlBar(&m_wndToolBar);
////////////////////////////////////////////
if( !m_wndCoolBar.Create(_T("控制栏"),this, CSize( 250, 400 ), TRUE, 123 ) )
{
TRACE0("Failed to create mybar\n");
return -1;
}
//设置样式
m_wndCoolBar.SetBarStyle( m_wndCoolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY |
CBRS_SIZE_DYNAMIC );
//设置停靠
m_wndCoolBar.EnableDocking( CBRS_ALIGN_ANY );
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar( &m_wndCoolBar, AFX_IDW_DOCKBAR_RIGHT);///停靠
//////
m_wndTabCtrl.Create( TCS_DOWN | WS_CHILD | WS_VISIBLE, CRect( 0, 0, 200, 200),
&m_wndCoolBar, 125);
//生成TOC对话框,并加入m_wndTabCtrl中
if( m_formDlg.Create( IDD_FORMVIEW, &m_wndTabCtrl ) )
m_wndTabCtrl.AddPage( &m_formDlg ,_T("控制"));
m_formDlg.ShowWindow( SW_SHOW );
m_wndTabCtrl.UpdateWindow();
////////////////////////////////////////////
if( !m_wndBotmCoolBar.Create(_T("CNC控制栏"),this, CSize( 250, 165 ), TRUE, 123 ) )
{
TRACE0("Failed to create mybar\n");
return -1;
}
//设置样式
m_wndBotmCoolBar.SetBarStyle( m_wndBotmCoolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY |
CBRS_SIZE_DYNAMIC );
//设置停靠
m_wndBotmCoolBar.EnableDocking( CBRS_ALIGN_ANY );
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar( &m_wndBotmCoolBar, AFX_IDW_DOCKBAR_BOTTOM);///停靠
//////
//.........这里部分代码省略.........
示例11: Parameters
//---------------------------------------------------------
bool CDXF_Import::On_Execute(void)
{
CSG_String fName = Parameters("FILE")->asString();
Parameters("TABLES")->asTableList() ->Del_Items();
Parameters("SHAPES")->asShapesList()->Del_Items();
m_Filter = Parameters("FILTER") ->asInt();
m_dArc = Parameters("DCIRCLE") ->asDouble() * M_DEG_TO_RAD;
//-----------------------------------------------------
if( SG_File_Exists(fName) )
{
m_pLayers = SG_Create_Table();
m_pLayers ->Set_Name(CSG_String::Format(SG_T("%s [%s]"), SG_File_Get_Name(fName, false).c_str(), _TL("Layers")));
m_pLayers ->Add_Field("LAYER" , SG_DATATYPE_String);
m_pLayers ->Add_Field("FLAGS" , SG_DATATYPE_Int);
m_pBlocks = SG_Create_Table();
m_pBlocks ->Set_Name(CSG_String::Format(SG_T("%s [%s]"), SG_File_Get_Name(fName, false).c_str(), _TL("Blocks")));
m_pBlocks ->Add_Field("BLOCK" , SG_DATATYPE_String);
m_pBlocks ->Add_Field("FLAGS" , SG_DATATYPE_Int);
m_pBlocks ->Add_Field("X" , SG_DATATYPE_Double);
m_pBlocks ->Add_Field("Y" , SG_DATATYPE_Double);
m_pBlocks ->Add_Field("Z" , SG_DATATYPE_Double);
m_pPoints = SG_Create_Shapes(SHAPE_TYPE_Point , CSG_String::Format(SG_T("%s [%s]"), SG_File_Get_Name(fName, false).c_str(), _TL("Points")));
m_pPoints ->Add_Field("LAYER" , SG_DATATYPE_String);
m_pPoints ->Add_Field("Z" , SG_DATATYPE_Double);
m_pLines = SG_Create_Shapes(SHAPE_TYPE_Line , CSG_String::Format(SG_T("%s [%s]"), SG_File_Get_Name(fName, false).c_str(), _TL("Lines")));
m_pLines ->Add_Field("LAYER" , SG_DATATYPE_String);
m_pLines ->Add_Field("Z1" , SG_DATATYPE_Double);
m_pLines ->Add_Field("Z2" , SG_DATATYPE_Double);
m_pPolyLines = SG_Create_Shapes(SHAPE_TYPE_Line , CSG_String::Format(SG_T("%s [%s]"), SG_File_Get_Name(fName, false).c_str(), _TL("Polylines")));
m_pPolyLines ->Add_Field("LAYER" , SG_DATATYPE_String);
m_pPolyLines ->Add_Field("FLAGS" , SG_DATATYPE_Int);
m_pPolygons = SG_Create_Shapes(SHAPE_TYPE_Polygon , CSG_String::Format(SG_T("%s [%s]"), SG_File_Get_Name(fName, false).c_str(), _TL("Polygons")));
m_pPolygons ->Add_Field("LAYER" , SG_DATATYPE_String);
m_pPolygons ->Add_Field("FLAGS" , SG_DATATYPE_Int);
m_pCircles = SG_Create_Shapes(SHAPE_TYPE_Line , CSG_String::Format(SG_T("%s [%s]"), SG_File_Get_Name(fName, false).c_str(), _TL("Circles")));
m_pCircles ->Add_Field("LAYER" , SG_DATATYPE_String);
m_pCircles ->Add_Field("FLAGS" , SG_DATATYPE_Int);
m_pTriangles = SG_Create_Shapes(SHAPE_TYPE_Polygon , CSG_String::Format(SG_T("%s [%s]"), SG_File_Get_Name(fName, false).c_str(), _TL("Triangles")));
m_pTriangles ->Add_Field("LAYER" , SG_DATATYPE_String);
m_pTriangles ->Add_Field("THICK" , SG_DATATYPE_Int);
m_pTriangles ->Add_Field("Z1" , SG_DATATYPE_Double);
m_pTriangles ->Add_Field("Z2" , SG_DATATYPE_Double);
m_pTriangles ->Add_Field("Z3" , SG_DATATYPE_Double);
m_pText = SG_Create_Shapes(SHAPE_TYPE_Point , CSG_String::Format(SG_T("%s [%s]"), SG_File_Get_Name(fName, false).c_str(), _TL("Text")));
m_pText ->Add_Field("LAYER" , SG_DATATYPE_String);
m_pText ->Add_Field("Z" , SG_DATATYPE_Double);
m_pText ->Add_Field("TEXT" , SG_DATATYPE_String);
m_pText ->Add_Field("HEIGHT", SG_DATATYPE_Int);
m_pText ->Add_Field("ANGLE" , SG_DATATYPE_Double);
m_pText ->Add_Field("APX" , SG_DATATYPE_Double);
m_pText ->Add_Field("APY" , SG_DATATYPE_Double);
m_pText ->Add_Field("APZ" , SG_DATATYPE_Double);
m_pText ->Add_Field("SCALE" , SG_DATATYPE_Double);
m_pText ->Add_Field("HJUST" , SG_DATATYPE_Int);
m_pText ->Add_Field("VJUST" , SG_DATATYPE_Int);
m_pText ->Add_Field("STYLE" , SG_DATATYPE_String);
m_pText ->Add_Field("FLAGS" , SG_DATATYPE_Int);
//-------------------------------------------------
m_Offset.x = 0.0;
m_Offset.y = 0.0;
m_Offset.z = 0.0;
m_pPolyLine = NULL;
DL_Dxf *pDXF = new DL_Dxf();
pDXF->in(fName.b_str(), this);
delete(pDXF);
//-------------------------------------------------
ADD_RESULT("TABLES", m_pLayers);
ADD_RESULT("TABLES", m_pBlocks);
ADD_RESULT("SHAPES", m_pPoints);
ADD_RESULT("SHAPES", m_pLines);
ADD_RESULT("SHAPES", m_pPolyLines);
ADD_RESULT("SHAPES", m_pPolygons);
ADD_RESULT("SHAPES", m_pCircles);
ADD_RESULT("SHAPES", m_pTriangles);
ADD_RESULT("SHAPES", m_pText);
}
//-----------------------------------------------------
return( Parameters("SHAPES")->asShapesList()->Get_Count() > 0 );
}
示例12: writeLineTypes
void writeLineTypes(DL_Dxf &output, DL_WriterA *writer)
{
writer->tableLineTypes(25);
output.writeLineType(*writer, DL_LineTypeData("BYBLOCK", 0));
output.writeLineType(*writer, DL_LineTypeData("BYLAYER", 0));
output.writeLineType(*writer, DL_LineTypeData("CONTINUOUS", 0));
output.writeLineType(*writer, DL_LineTypeData("ACAD_ISO02W100", 0));
output.writeLineType(*writer, DL_LineTypeData("ACAD_ISO03W100", 0));
output.writeLineType(*writer, DL_LineTypeData("ACAD_ISO04W100", 0));
output.writeLineType(*writer, DL_LineTypeData("ACAD_ISO05W100", 0));
output.writeLineType(*writer, DL_LineTypeData("BORDER", 0));
output.writeLineType(*writer, DL_LineTypeData("BORDER2", 0));
output.writeLineType(*writer, DL_LineTypeData("BORDERX2", 0));
output.writeLineType(*writer, DL_LineTypeData("CENTER", 0));
output.writeLineType(*writer, DL_LineTypeData("CENTER2", 0));
output.writeLineType(*writer, DL_LineTypeData("CENTERX2", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHDOT", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHDOT2", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHDOTX2", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHED", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHED2", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHEDX2", 0));
output.writeLineType(*writer, DL_LineTypeData("DIVIDE", 0));
output.writeLineType(*writer, DL_LineTypeData("DIVIDE2", 0));
output.writeLineType(*writer, DL_LineTypeData("DIVIDEX2", 0));
output.writeLineType(*writer, DL_LineTypeData("DOT", 0));
output.writeLineType(*writer, DL_LineTypeData("DOT2", 0));
output.writeLineType(*writer, DL_LineTypeData("DOTX2", 0));
writer->tableEnd();
}
示例13: main
int main(int argc, char **argv)
{
if (argc < 5) {
std::cerr << "Usage: dxf-import <main input file> <overlay input file> <overlay layer name prefix> <output file>\n";
return 1;
}
std::string mainInput = argv[1];
std::string overlayInput = argv[2];
std::string layerPrefix = argv[3];
LayerCounter mainLayerCounter(layerPrefix, false);
mainLayerCounter.input(mainInput);
LayerCounter overlayLayerCounter(layerPrefix, true);
overlayLayerCounter.input(overlayInput);
DL_Dxf output;
DL_WriterA *writer = output.out(argv[4]);
if (!writer) {
std::cerr << "Unable to open output file '" << argv[4] << "'\n";
return 1;
}
output.writeHeader(*writer);
VariableWriter(&output, writer).input(mainInput);
writer->sectionEnd();
writer->sectionTables();
output.writeVPort(*writer);
writeLineTypes(output, writer);
writer->tableLayers(mainLayerCounter.layers() + overlayLayerCounter.layers());
LayerWriter(layerPrefix, false, &output, writer).input(mainInput);
LayerWriter(layerPrefix, true, &output, writer).input(overlayInput);
writer->tableEnd();
output.writeStyle(*writer);
output.writeView(*writer);
output.writeUcs(*writer);
writer->tableAppid(1);
writer->tableAppidEntry(0x12);
writer->dxfString(2, "ACAD");
writer->dxfInt(70, 0);
writer->tableEnd();
output.writeDimStyle(*writer, 3.0, 3.0, 1.5, 2.0, 3.0);
output.writeBlockRecord(*writer);
BlockRecordWriter(layerPrefix, false, &output, writer).input(mainInput);
BlockRecordWriter(layerPrefix, true, &output, writer).input(overlayInput);
writer->tableEnd();
writer->sectionEnd();
std::map<std::string, ImageHandle> images;
writer->sectionBlocks();
output.writeBlock(*writer, DL_BlockData("*Model_Space", 0, 0.0, 0.0, 0.0));
output.writeEndBlock(*writer, "*Model_Space");
output.writeBlock(*writer, DL_BlockData("*Paper_Space", 0, 0.0, 0.0, 0.0));
output.writeEndBlock(*writer, "*Paper_Space");
output.writeBlock(*writer, DL_BlockData("*Paper_Space0", 0, 0.0, 0.0, 0.0));
output.writeEndBlock(*writer, "*Paper_Space0");
EntityWriter(layerPrefix, false, &output, writer, true, &images).input(mainInput);
EntityWriter(layerPrefix, true, &output, writer, true, &images).input(overlayInput);
writer->sectionEnd();
writer->sectionEntities();
EntityWriter(layerPrefix, false, &output, writer, false, &images).input(mainInput);
EntityWriter(layerPrefix, true, &output, writer, false, &images).input(overlayInput);
writer->sectionEnd();
output.writeObjects(*writer);
ObjectWriter(&output, writer, &images).input(mainInput);
ObjectWriter(&output, writer, &images).input(overlayInput);
output.writeObjectsEnd(*writer);
writer->dxfEOF();
writer->close();
delete writer;
return 0;
}
示例14: saveToFile
CC_FILE_ERROR DxfFilter::saveToFile(ccHObject* root, const char* filename)
{
#ifndef CC_DXF_SUPPORT
ccLog::Error("[DXF] DXF format not supported! Check compilation parameters!");
return CC_FERR_CONSOLE_ERROR;
#else
if (!root || !filename)
return CC_FERR_BAD_ARGUMENT;
ccHObject::Container polylines;
root->filterChildren(polylines,true,CC_POLY_LINE);
//only polylines are handled for now
size_t polyCount = polylines.size();
if (!polyCount)
return CC_FERR_NO_SAVE;
//get global bounding box
ccBBox box;
for (size_t i=0; i<polyCount; ++i)
{
ccBBox polyBox = polylines[i]->getBB();
if (i)
{
box += polyBox;
}
else
{
box = polyBox;
}
}
CCVector3 diag = box.getDiagVec();
double baseSize = static_cast<double>(std::max(diag.x,diag.y));
double lineWidth = baseSize / 40.0;
double pageMargin = baseSize / 20.0;
DL_Dxf dxf;
DL_WriterA* dw = dxf.out(qPrintable(filename), DL_VERSION_R12);
if (!dw)
{
return CC_FERR_WRITING;
}
//write header
dxf.writeHeader(*dw);
//add dimensions
dw->dxfString(9, "$INSBASE");
dw->dxfReal(10,0.0);
dw->dxfReal(20,0.0);
dw->dxfReal(30,0.0);
dw->dxfString(9, "$EXTMIN");
dw->dxfReal(10,static_cast<double>(box.minCorner().x)-pageMargin);
dw->dxfReal(20,static_cast<double>(box.minCorner().y)-pageMargin);
dw->dxfReal(30,static_cast<double>(box.minCorner().z)-pageMargin);
dw->dxfString(9, "$EXTMAX");
dw->dxfReal(10,static_cast<double>(box.maxCorner().x)+pageMargin);
dw->dxfReal(20,static_cast<double>(box.maxCorner().y)+pageMargin);
dw->dxfReal(30,static_cast<double>(box.maxCorner().z)+pageMargin);
dw->dxfString(9, "$LIMMIN");
dw->dxfReal(10,static_cast<double>(box.minCorner().x)-pageMargin);
dw->dxfReal(20,static_cast<double>(box.minCorner().y)-pageMargin);
dw->dxfString(9, "$LIMMAX");
dw->dxfReal(10,static_cast<double>(box.maxCorner().x)+pageMargin);
dw->dxfReal(20,static_cast<double>(box.maxCorner().y)+pageMargin);
//close header
dw->sectionEnd();
//Opening the Tables Section
dw->sectionTables();
//Writing the Viewports
dxf.writeVPort(*dw);
//Writing the Linetypes (all by default)
{
dw->tableLineTypes(25);
dxf.writeLineType(*dw, DL_LineTypeData("BYBLOCK", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BYLAYER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CONTINUOUS", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO02W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO03W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO04W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO05W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDER2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDERX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTER2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTERX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHDOT", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHDOT2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHDOTX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHED", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHED2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHEDX2", 0));
//.........这里部分代码省略.........
示例15: main
int main() {
DL_Dxf dxf;
DL_WriterA* dw = dxf.out("dimension.dxf", DL_Codes::AC1015);
// section header:
dxf.writeHeader(*dw);
dw->sectionEnd();
// section tables:
dw->sectionTables();
// VPORT:
dxf.writeVPort(*dw);
// LTYPE:
dw->tableLinetypes(1);
dxf.writeLinetype(*dw, DL_LinetypeData("CONTINUOUS", "Continuous", 0, 0, 0.0));
dxf.writeLinetype(*dw, DL_LinetypeData("BYLAYER", "", 0, 0, 0.0));
dxf.writeLinetype(*dw, DL_LinetypeData("BYBLOCK", "", 0, 0, 0.0));
dw->tableEnd();
// LAYER:
dw->tableLayers(1);
dxf.writeLayer(
*dw,
DL_LayerData("0", 0),
DL_Attributes("", 1, 0x00ff0000, 15, "CONTINUOUS")
);
dw->tableEnd();
// STYLE:
dw->tableStyle(1);
DL_StyleData style("Standard", 0, 0.0, 1.0, 0.0, 0, 2.5, "txt", "");
style.bold = false;
style.italic = false;
dxf.writeStyle(*dw, style);
dw->tableEnd();
// VIEW:
dxf.writeView(*dw);
// UCS:
dxf.writeUcs(*dw);
// APPID:
dw->tableAppid(1);
dxf.writeAppid(*dw, "ACAD");
dw->tableEnd();
// DIMSTYLE:
dxf.writeDimStyle(*dw, 2.5, 0.625, 0.625, 0.625, 2.5);
// BLOCK_RECORD:
dxf.writeBlockRecord(*dw);
dw->tableEnd();
dw->sectionEnd();
// BLOCK:
dw->sectionBlocks();
dxf.writeBlock(*dw, DL_BlockData("*Model_Space", 0, 0.0, 0.0, 0.0));
dxf.writeEndBlock(*dw, "*Model_Space");
dxf.writeBlock(*dw, DL_BlockData("*Paper_Space", 0, 0.0, 0.0, 0.0));
dxf.writeEndBlock(*dw, "*Paper_Space");
dxf.writeBlock(*dw, DL_BlockData("*Paper_Space0", 0, 0.0, 0.0, 0.0));
dxf.writeEndBlock(*dw, "*Paper_Space0");
dw->sectionEnd();
// ENTITIES:
dw->sectionEntities();
DL_Attributes attributes("0", 256, -1, -1, "BYLAYER");
// LINE:
DL_LineData lineData(10, 5, 0, 30, 5, 0);
dxf.writeLine(*dw, lineData, attributes);
// DIMENSION:
DL_DimensionData dimData(10.0, // def point (dimension line pos)
50.0,
0.0,
0, // text pos (irrelevant if flag 0x80 (128) set for type
0,
0.0,
0x1, // type: aligned with auto text pos (0x80 NOT set)
8, // attachment point: bottom center
2, // line spacing: exact
1.0, // line spacing factor
"", // text
"Standard", // style
0.0, // text angle
1.0, // linear factor
1.0); // dim scale
DL_DimAlignedData dimAlignedData(10.0, // extension point 1
5.0,
0.0,
30.0, // extension point 2
5.0,
0.0);
//.........这里部分代码省略.........