![]() |
【转帖】为什么已经切换当前数据库,acedssget还是对老的数据库操作?
为什么已经切换当前数据库,acedssget还是对老的数据库操作?
为什么已经切换当前数据库,acedssget还是对老的数据库操作? bool cblueprintdrawing::createblueprint(long lblueprinttemplateid, int ipageno) { acad::errorstatus es; acdbdatabase *pdb; cstring m_blueprintfilefullname; cstring t_blueprinttemplatefilename; pdb = new acdbdatabase; //获取模板文件名 es = pdb->readdwgfile( t_blueprinttemplatefilename); if( es != acad::eok ) { acutprintf("\n没有发现 %c 文件!\n", t_blueprinttemplatefilename); delete pdb; return false; } acdbdatabase *polddb = acdbhostapplicationservices()->workingdatabase(); acdbhostapplicationservices()->setworkingdatabase(pdb); acdbblocktable *pblocktable; pdb->getsymboltable(pblocktable, acdb::kforread); //acdbhostapplicationservices()->workingdatabase()->getsymboltable(pblocktable, acdb::kforread); acdbblocktablerecord *pblocktablerecord; pblocktable->getat(acdb_model_space, pblocktablerecord, acdb::kforwrite); pblocktable->close(); //---- 绘制图形 cblueprintdrawing::createtablegroup( pblocktablerecord ); //---- 绘制图纸框架 //?????????????? 选择集出现问题 //如果polddb中在选择区域中有实体,就可以;反之不行。 //希望pdb中在选择区域中有实体,就可以;反之不行。 //pdb已经是当前数据库为什么还关联polddb cblueprintdrawing::createframeline( pblocktablerecord ); //---- 关闭块表 pblocktablerecord->close(); //切换回原工作表 acdbhostapplicationservices()->setworkingdatabase(polddb); //保存图纸 pdb->saveas(m_blueprintfilefullname); delete pdb; } bool cblueprintdrawing::createframeline(acdbblocktablerecord *pblocktablerecord) { int stat; long number; ads_name ssname; ads_point t_ptw0, t_ptw1; acgepoint3d ptw0(0, 0, 0), ptw1(0, 297, 0); number = 0; t_ptw0[x] = 210.0; t_ptw0[y] = 0.0; t_ptw0[z] = 0.0; t_ptw1[x] = 420.0; t_ptw1[y] = 297.0; t_ptw1[z] = 0.0; //建一个交叉窗口选择集 stat = acedssget("c", t_ptw0, t_ptw1, null, ssname); if ( stat != rtnorm ) { acedalert("创建交叉选择集不成功!"); } else { acedsslength(ssname, &number); acedalert("创建交叉选择集成功!"); while ( number != 0 ) { ptw0.x = t_ptw0[x]; ptw1.x = t_ptw1[x]; t_ptw0[x] += 210.0; t_ptw1[x] += 210.0; number = 0; acedssfree(ssname); acedssget("c", t_ptw0, t_ptw1, null, ssname); acedsslength(ssname, &number); } } //-- 绘制外框线 acgepoint3d pt0(0, 0, 0), pt1(0, 297, 0), pt2(0, 0, 0), pt3(0, 0, 0); pt2.x = ptw1.x; pt2.y = ptw1.y; pt3.x = ptw1.x; pt3.y = ptw0.y; createline(pblocktablerecord, pt0, pt1); createline(pblocktablerecord, pt1, pt2); createline(pblocktablerecord, pt2, pt3); createline(pblocktablerecord, pt3, pt0); return true; } qq:19154480 msn:freejustinji@hotmail.com e-mail:justin |
所有的时间均为北京时间。 现在的时间是 05:18 PM. |