![]() |
【转帖】mline vectorization
mline vectorization
mline vectorization hi all, i am trying to display the mlines in a drawing(budwesier.dwg) that have line types of letters mixed with dashes, and the other mline has a thickness with variables colours. the code i do is the following and all i end up with is a two single white lines. (which is correct in what it is showing in a geometry sense, but i am trying to get the more complex represenatation of the mlines's) is there anything that i would be doing particaluarly wrong. odstaticrxobject<repvectorizer> dv; odstaticrxobject<odgicontextfordbdatabase> gicontext; gicontext.setdatabase(odmlineptr->database()); dv.setdrawcontext(&dv); dv.setcontext(&gicontext); dv.output().setdestgeometry(dv); dv.draw(odmlineptr); to sum up the vectorizing is not taking into consideration the style/line type of the mline. have i made complete sense in my explanation of the above, i hope so, if not, please let me know, and i can attach a simple program and the drawing if necessary. cheers jason hi, there might be many reasons... quote: originally posted by janderssen i can attach a simple program and the drawing if necessary. it will definitely save our time. so please do it. drawing attached, the mlines that are causing the issue are the ones in box pair number 5. to some up my code, it basically iteratates through the oddbdatabase and calls the above code as shown. oh, and thanks in advance for your assistance. cheers jason attached files (228.4 kb, 3 views) hi, i need your code. 1. what is parent of repvectorizer ? (must be odgsbasevectorizeview) ? 2. what value returns odgsbasevectorizeview::linetypegenerationcriteria( ) ? 3. etc... is linetype applied for other entities..? dmitry, thanks for your help, the following is the code that i use to vectorize the entity. total number of points that gets sent to the polyline routine is 2. line thickness's are correctly vectorized, but other line types are not done correctly now that you bring this up. so i must be doing something wrong. double d = linetypegenerationcriteria(); d was equal to 0.00000 for both mlines. polygonout is never called. is there anything else that you need me to tell you. for the record : crepgmtryptr is nothing more than a geometry representation of what the polyline outputs, and this is a node in my scenegraph. copendwgptr is nothing more than the class that loads the drawings with your library, and returns a scenegraph in my format. cheers jason // header class repvectorizer : public odgigeometrysimplifier, public odgibasevectorizer { public: virtual void polylineout(odint32 n, const odgepoint3d* pts); virtual void polygonout(odint32 nbpoints, const odgepoint3d *pvertexlist, const odgevector3d *pnormal = 0); void setrepgmtryent(crepgmtryptr aprepgmtry) { m_aprepgmtry = aprepgmtry;}; void setldr(copendwgptr apldr) { m_apldr = apldr;}; private: crepgmtryptr m_aprepgmtry; copendwgptr m_apldr; }; // cpp void repvectorizer:olylineout(odint32 n, const odgepoint3d* pts) { e3d::cdbug::log(e3d::cdbug::elvl::dldbg, e3d::cdbug::etype::ltlayout, e3d::cdbug::eops:pcrte, dbgdef_ft_function, l"repvectorizer", l"**polylineout** opendwg vectorizer, number points <%d>", n); if( m_apldr.valid() && m_aprepgmtry.valid() ) { m_apldr->bgnaddpnts(m_aprepgmtry); const odgepoint3d *curpnt = pts; for( int i = 0; i < n; i++ ) { m_apldr->addpnt2ent(m_aprepgmtry, odgepoint3d(curpnt->x, curpnt->y, curpnt->z)); curpnt++; } m_apldr->endaddpnts(m_aprepgmtry); } } //--------------------------------------------------------------------------------- void repvectorizer:olygonout(odint32 nbpoints, const odgepoint3d *pvertexlist, const odgevector3d *pnormal) { e3d::cdbug::log(e3d::cdbug::elvl::dldbg, e3d::cdbug::etype::ltlayout, e3d::cdbug::eops:pcrte, dbgdef_ft_function, l"repvectorizer", l"**polygonout** opendwg vectorizer, number points <%d>", nbpoints); if( m_apldr.valid() && m_aprepgmtry.valid() ) { m_apldr->bgnaddpnts(m_aprepgmtry); const odgepoint3d *curpnt = pvertexlist; for( int i = 0; i < nbpoints; i++ ) { m_apldr->addpnt2ent(m_aprepgmtry, odgepoint3d(curpnt->x, curpnt->y, curpnt->z)); curpnt++; } m_apldr->endaddpnts(m_aprepgmtry); } } last edited by janderssen; 5th july 2006 at 04:48 pmfff">. hi jason, geometry conveyor of odgibasevectorizer does not include linetype applier node. you should use odgsbasevectorizeviewfff"> as base class for your repvectorizer. quote: originally posted by dmitry a. novikov hi jason, geometry conveyor of odgibasevectorizer does not include linetype applier node. you should use odgsbasevectorizeviewfff"> as base class for your repvectorizer. now i changed to the new class as the base, i now get an access violation at the following location : opendwgldr.edl!odgilinetyperimpl::setlinetype() + 0x3d c++ opendwgldr.edl!odgsbasevectorizeview::affect2dtrai ts() + 0x139 c++ opendwgldr.edl!odgsbasevectorizeview::affecttraits () + 0x44 c++ opendwgldr.edl!odgibasevectorizer::effectivetraits () + 0x5f c++ opendwgldr.edl!odgibasevectorizer::needdraw() + 0x27 c++ opendwgldr.edl!odgibasevectorizer::draw() + 0x1ab c++ > opendwgldr.edl!e3d::copendwg::getmline(odsmartptr< oddbentity> odentptr={...}, oddbhandle & odhent={...}, e3d::ref_ptr<e3d::clyrmgr> & aplyrmgr={...}) line 2474 c++ so is there anything else i should be doing ? cheers jason last edited by janderssen; 6th july 2006 at 08:44 pmfff">. hi jason, it's probably because of direct odgibasevectorizer::draw() method call (instead of odgsview::add(), odgsdevice::update()). try to insert highlighted lines: odstaticrxobject<repvectorizer> dv; odstaticrxobject<odgicontextfordbdatabase> gicontext; gicontext.setdatabase(odmlineptr->database()); dv.setdrawcontext(&dv); dv.setcontext(&gicontext); dv.output().setdestgeometry(dv); dv.beginviewvectorization(); dv.draw(odmlineptr); dv.endviewvectorization(); that seems to be the way to do it, thanx again for all your help. cheers jason |
所有的时间均为北京时间。 现在的时间是 02:27 AM. |