![]() |
【转帖】problem writing a leader
problem writing a leader
problem writing a leader hi, my application is crashing when a leader is written. specifically, when the arrow head size is defined using method 'setdimasz'. if this method isn't called application works. could someone tell what is wrong in the code bellow? thanks in advance, regina. code: oddbleaderptr pleader = oddbleader::createobject(); pleader->setdatabasedefaults(pdb); pblock->appendoddbentity(pleader); point.x += w / 10; point.y -= h / 1.5; pleader->appendvertex(point); point.x += w / 10; point.y += h / 5; pleader->appendvertex(point); // set arrowhead pleader->setdimldrblk("dot"); // set arrowhead size pleader->setdimasz(0.1); i failed to reproduce your problem. are you able to reproduce it in dd samples? your code can be added into odwriteex sample or into odamfcapp (the function defined in debugcommand.h is executed than you invode edit/run debug command. which version do you use and which crash happens? sergey slezkin yes, i reproduced the problem in odwriteex. application simply closes and don't show any message when function is called. i'm using dwgdirect 1.10. code: // adds assorted entities to the passed in block. void dbfiller::addentities1(oddbdatabase* pdb, const oddbobjectid& blockid, const oddbobjectid& blockforinsertid1, const oddbobjectid& blockforinsertid2, const oddbobjectid& layerid, const oddbobjectid& styleid) { // open the block to which new entities will be added. oddbblocktablerecordptr pblock = blockid.safeopenobject(oddb::kforwrite); ... // add leaders. point = m_entityboxes.getbox(0,6); w = m_entityboxes.getwidth(0,6); h = m_entityboxes.getheight(); addtextent( pdb, pblock, odgepoint3d(point.x+w/8.0, point.y-h/8.0, 0), odgepoint3d(point.x+w/8.0, point.y-h/8.0, 0), "leaders", 0.2, oddb::ktextleft, oddb::ktexttop, layerid, styleid ); // leader without annotation oddbleaderptr pleader = oddbleader::createobject(); pleader->setdatabasedefaults(pdb); pblock->appendoddbentity(pleader); point.x += w / 10; point.y -= h / 2.5; pleader->appendvertex(point); point.x += w / 10; point.y += h / 7; pleader->appendvertex(point); point.x += w / 5; pleader->appendvertex(point); // leader with annotation point = m_entityboxes.getbox(0,6); pleader = oddbleader::createobject(); pleader->setdatabasedefaults(pdb); pblock->appendoddbentity(pleader); point.x += w / 10; point.y -= h / 1.5; pleader->appendvertex(point); point.x += w / 10; point.y += h / 5; pleader->appendvertex(point); point.x += w / 10; // set arrowhead pleader->setdimldrblk("dot"); pleader->setdimasz(0.01); // if this line is commented problem doesn't happen. // make annotation pmtxt = oddbmtext::createobject(); pmtxt->setlocation(point); pmtxt->setdirection(odgevector3d(4., 1., 0.)); pmtxt->settextheight(0.15); pmtxt->setwidth(1.5); pmtxt->setattachment(oddbmtext::kbottomleft); pmtxt->setcontents("annotation"); pleader->attachannotation(pblock->appendoddbentity(pmtxt)); // leader with annotation point = m_entityboxes.getbox(0,6); pleader = oddbleader::createobject(); pleader->setdatabasedefaults(pdb); pblock->appendoddbentity(pleader); point.x += w / 10; point.y -= 0.9 * h; pleader->appendvertex(point); odgevector3d vdir(0.15 * w, 0.2 * h, 0.); point += vdir; pleader->appendvertex(point); point.x += 0.08 * w; ... } |
所有的时间均为北京时间。 现在的时间是 02:23 PM. |