// // NAME: cmd() // // REMARKS: Simple routine to exercise acedCommand. While this still works in MDI // it will ALWAYS apply to the active document. You might find // sendStringToExecute to be more modern and robust. // Also, sendStringToExecute allows you to send strings to sub prompts // something not possible from acedCommand where the entire command // sequence must be explicit. // // // // // RETURNS: // void void cmd() { acedCommand (RTSTR, /*NOXLATE*/"_new", RTSTR, "", RTNONE); acedCommand (RTSTR, /*NOXLATE*/"_line", RTSTR, "0,0", RTSTR, "1,1", RTSTR, "", RTNONE); acedCommand (RTSTR, /*NOXLATE*/"_line", RTSTR, "2,0", RTSTR, "3,0", RTSTR, "", RTNONE); acedCommand (RTSTR, /*NOXLATE*/"_line", RTSTR, "2,2", RTSTR, "3,3", RTSTR, "", RTNONE); }
static void drawCube(ads_point p, double dLength) { acedCommand(RTSTR, "_.BOX", RT3DPOINT, p, // postition RTSTR, "_Cube", RTREAL, dLength, // width, height, depth 0); }
void drawLine() { acutPrintf(L"Draw the circle.\n"); double radius = 4000; acedCommand(RTSTR,L"CIRCLE",RTSTR,L"280,150",RTREAL,radius,0); acutPrintf(L"DONE! Circle draw.\n"); }
static void drawText(ads_point position, double dHeight, char *text) { acedCommand(RTSTR, "_.TEXT", RT3DPOINT, position, RTREAL, dHeight, RTREAL, 0.0, // rotation RTSTR, text, 0); }
void PlotByPtMaxAndMin(AcGePoint3d ptMin,AcGePoint3d ptMax) { //获取当前数据库指针 AcDbDatabase *pCurDb=acdbHostApplicationServices()->workingDatabase(); //获取表记录 AcDbBlockTable *pBlockTable=NULL; AcDbBlockTableRecord *pBlkTblRcd=NULL; if(Acad::eOk != pCurDb->getBlockTable(pBlockTable,AcDb::kForRead)) return; if(Acad::eOk != pBlockTable->getAt(ACDB_MODEL_SPACE,pBlkTblRcd,AcDb::kForRead)) { pBlockTable->close(); return; } pBlockTable->close(); //获取样式ID AcDbObjectId LaoutId=pBlkTblRcd->getLayoutId(); pBlkTblRcd->close(); char* plotCfgchar = NULL; AcDbLayout *pSrcLayout = NULL; if(acdbOpenAcDbObject((AcDbObject*&)pSrcLayout,LaoutId,AcDb::kForWrite)!=Acad::eOk) return; Acad::ErrorStatus es; AcDbPlotSettingsValidator *pPltValid = acdbHostApplicationServices()->plotSettingsValidator(); if((es = pPltValid->setPlotWindowArea (pSrcLayout,0,0,100,100)) != Acad::eOk) { pSrcLayout->close(); return; } if((es =pPltValid->setPlotType (pSrcLayout, AcDbPlotSettings::PlotType::kWindow))!=Acad::eOk) { pSrcLayout->close(); return; } if((es =pSrcLayout->getPlotCfgName(plotCfgchar)) != Acad::eOk) { pSrcLayout->close(); return; } pPltValid->refreshLists(pSrcLayout); pSrcLayout->close(); if(acdbOpenAcDbObject((AcDbObject*&)pSrcLayout,LaoutId,AcDb::kForWrite)!=Acad::eOk) return; if((es = pPltValid->setPlotWindowArea (pSrcLayout,ptMin.x,ptMin.y,ptMax.x,ptMax.y)) != Acad::eOk) { pSrcLayout->close(); return; } if((es = pPltValid->setPlotType (pSrcLayout, AcDbPlotSettings::PlotType::kWindow)) != Acad::eOk) { pSrcLayout->close(); return; } if((es = pSrcLayout->getPlotCfgName(plotCfgchar)) != Acad::eOk) { pSrcLayout->close(); return; } pPltValid->refreshLists(pSrcLayout); pSrcLayout->close(); CString plotCfgName(plotCfgchar); //模型Model if(plotCfgName.Find("无")>=0) { acutPrintf("\n请设置打印样式,并置为当前!%s\n",plotCfgchar);return; } acedCommand(RTSTR,"_plot",RTSTR,"N",RTSTR,"模型",RTSTR,"",RTSTR,plotCfgName,RTSTR,"N",RTSTR,"N",RTSTR,"Y",0); }