![]() |
【转帖】problem writing polylines
problem writing polylines
problem writing polylines hello, i'm having a problem writing polylines with the dwgdirect library v1.09. when i write more than one polyline to a file using the code below, i think there is a problem with files written as .dwg. maybe somebody can point out a mistake i'm making. i can write the same three plines to .dxf ( only change is kdwg to kdxf in the call to writefile()) and the dxf files are fine. as for the .dwg files, autocad can read them, but programs written using the old odt libraries, including the invisio viewer and rhino can't. if i write them as acad2000 files, rhino and invisio both skip all but one pline. if i write them as r13 files, rhino skips all but one pline and invisio crashes. however, all combinations using dxf files work correctly. here's how i make the plines. this function is called for each curve to write as a pline: bool cconverttodwg::converttopolyline( on_curve* pc, const crhinoobject* pobj) { ... check if its a planar curve make curve into a polyline ... oddb2dpolylineptr ppl = oddb2dpolyline::createobject(); setentityattributes( ppl, pobj); oddbblocktablerecordptr pblock = m_currentblockid.safeopenobject( oddb::kforwrite); oddbobjectid id = pblock->appendoddbentity( pentity); if( !id.isnull()) for( i = 0; i < polyline.pointcount() && m_vertex_count < 32767; i++) { oddb2dvertexptr pv = oddb2dvertex::createobject(); p2dpl->appendvertex(pv); pv->setposition( odgepoint3d( polyline.m_pline[i].x, polyline.m_pline[i].y, polyline.m_pline[i].z)); } ... } when i watch the file being read in to rhino in the debugger, i see entities come in like this: -lwpline header -blob with the correct coordinate points for one pline -vertex that should start the next pline -next vertex, etc there are no pline headers after the first one thanks, lowell oddbblocktablerecordptr pblock = m_currentblockid.safeopenobject( oddb::kforwrite); oddbobjectid id = pblock->appendoddbentity( pplfff"> ); thanks, laurent thanks - you're right, but unfortunately that is a typo in posting here, and not in the code as it it in the program. lowell does autocad see any problem with dwg file containing your 3 polylines? if not it seems to be a problem of legacy c toolkit. be sure to check the latest c toolkit version. sergey slezkin yes, autocad reads the files ok. but if the odt library doesn't read them that's still a big problem for people trying to use them. lowell |
所有的时间均为北京时间。 现在的时间是 02:37 PM. |