![]() |
【转帖】problems with multilines
problems with multilines
problems with multilines hi, i am facing 2 problems with multilines: 1) open the attached drawing in odamfcapp. multilines uses same multiline style but renders differently. is this a bug in oda? how can i render them correctly? 2) open the attached drawing in autocad. multilines are rendered differently than in odamfcapp. what are the properties that control the concave and convex inner arcs? i couldn't find any options in oda. thanks. attached files quote: originally posted by jaisam hi, i am facing 2 problems with multilines: 1) open the attached drawing in odamfcapp. multilines uses same multiline style but renders differently. is this a bug in oda? how can i render them correctly? 2) open the attached drawing in autocad. multilines are rendered differently than in odamfcapp. what are the properties that control the concave and convex inner arcs? i couldn't find any options in oda. thanks. any updates on this bug? such mline styles are not quite valid. e.g. if you edit first mline in the drawing, acad 2008 will crash. second mline seems to be more reasonable, and such behaviour we may simulate. vladimir quote: originally posted by wvk such mline styles are not quite valid. e.g. if you edit first mline in the drawing, acad 2008 will crash. is there any way to avoid such crash? what causes such crash? can i get more information on the issue so that we can handle the situation without getting crash. quote: originally posted by wvk second mline seems to be more reasonable, and such behaviour we may simulate. is this bug fixable on our side or is it only fixable from oda's code? thanks. the strokes in multiline style should be ordered by offset (in descending order) for acad mline code to work correctly. acad does such ordering when loading from dxf, but does not, when loading from dwg. you may fix mline style by editing it (sorting strokes). unfortunately there in no direct way to recalculate mline cache, but you may e.g. call transformby(odgematrix3d::kidentity), that will do the job. vladimir quote: originally posted by wvk unfortunately there in no direct way to recalculate mline cache, but you may e.g. call transformby(odgematrix3d::kidentity), that will do the job. as you have suggested, i added/modified code in cdwgviewer to force transformby(odgematrix3d::kidentity) but it still crashes on drag. to reproduce add submitted code to cdwgviewer.cpp and cdwgviewer.h. 1. start odamfcapp, create and vectorize new drawing. 2. hit "insert" on keyboard to add new multiline and multiline styles. 3. hit "backspace" to edit multiline. 4. select and drag multiline-->crash. is there any work around to avoid this crash and update multiline? thanks. add to cdwgviewer.cpp code: #include "dbmline.h" #include "dbmlinestyle.h" void cdwgviewer::onkeydown(uint nchar, uint nrepcnt, uint nflags) { codamfcappdoc* pdoc; oddblineptr pline; switch( nchar ) { case vk_escape: pdoc = getdocument(); pline = pdoc->m_idsremovethis[0].safeopenobject(oddb::kforwrite); pline->setstartpoint(odgepoint3d(0, 10, 1)); pline = null; pline = pdoc->m_idsremovethis[1].safeopenobject(oddb::kforwrite); pline->setstartpoint(odgepoint3d(10, 10, 1)); pline = null; postmessage(wm_paint); break; case vk_f5: postmessage(wm_paint); break; case vk_delete: ((codamfcappdoc*)getdocument())->deleteselection(false); postmessage(wm_paint); break; case vk_insert: createmlinestylesandmline(); break; case vk_back: changemline(); break; } cview::onkeydown(nchar, nrepcnt, nflags); } void cdwgviewer::createmlinestylesandmline() { oddbobjectid iddict; oddbdatabaseptr pdb = getdocument()->m_pdb; iddict = pdb->getmlstyledictionaryid(); oddbdictionaryptr pdict = iddict.safeopenobject(oddb::kforwrite); //create first mlinestyle oddbmlinestyleptr pmls = oddbmlinestyle::createobject(); pmls->addelement(2.0, pdb->getcecolor(), pdb->getceltype()); pmls->addelement(1.0, pdb->getcecolor(), pdb->getceltype()); m_idmlstyle1 = pdict->setat("mlinestyle1", pmls.get()); pmls = null; //create second mlinestyle pmls = oddbmlinestyle::createobject(); pmls->addelement(2.0, pdb->getcecolor(), pdb->getceltype()); pmls->addelement(1.0, pdb->getcecolor(), pdb->getceltype()); pmls->addelement(-2.0, pdb->getcecolor(), pdb->getceltype()); pmls->addelement(-1.0, pdb->getcecolor(), pdb->getceltype()); m_idmlstyle2 = pdict->setat("mlinestyle2", pmls.get()); pmls = null; //create multiline oddbmlineptr pmline = oddbmline::createobject(); pmline->setstyle(m_idmlstyle1); pmline->appendseg(odgepoint3d(0,0,0)); pmline->appendseg(odgepoint3d(0,10,0)); pmline->appendseg(odgepoint3d(10,10,0)); oddbblocktablerecordptr pspace =pdb->getactivelayoutbtrid().safeopenobject(oddb::kforwrite); m_idmline = pspace->appendoddbentity(pmline); pspace = null; pmline = null; pdict = null; } void cdwgviewer::changemline() { oddbmlineptr pmline = m_idmline.safeopenobject(oddb::kforwrite); pmline->setstyle(m_idmlstyle2); pmline->transformby(odgematrix3d::kidentity); postmessage(wm_paint); pmline = null; } add to class definition in cdwgviewer.h: code: //my code void createmlinestylesandmline(); void changemline(); oddbobjectid m_idmlstyle1, m_idmlstyle2, m_idmline; |
所有的时间均为北京时间。 现在的时间是 06:41 PM. |