![]() |
【转帖】oddbdimassoc example for oddb2lineangulardimension or oddbra
oddbdimassoc example for oddb2lineangulardimension or oddbra
oddbdimassoc example for oddb2lineangulardimension or oddbradialdimension hi, oddbradialdimension does anyone have a c++ example which creates an associated oddbradialdimension? in more detail: - i first create a polyline containing an arc segment (odgecircarc2d) among other line segments. -then i would like to create a oddbradialdimension associated to this arc using oddbdimassoc. i am particualy interested about the part where the oddbdimassoc is created. creating just an unassociated radial dimension worked fine. oddb2lineangulardimension if somebody has an example on how to create an associated oddb2lineangulardimension i would also be very interested on the code creating the oddbdimassoc. help or programming examples would be appreciated. thanks a lot, christoph hello christoph, example project odwriteex contents sample with creating associative dimension (rotated). see "void dbfiller::adddimassoc() method" in dbfiller.cpp. best regards, sergey z. hello sergey, thanks for your answer. i already use the provided example for rotateddimensions since quite a while. but i was not able to make the oddbradial or the oddb2lineangulardimension associative. wouldn't you have any example which shows the parameters needed to make it working. thanks, christoph try this code (it is no complete) code: /**********************************************************************/ /* create an associative dimension */ /**********************************************************************/ oddbdimassocptr pdimassoc = oddbdimassoc::createobject(); /**********************************************************************/ /* associate the associative dimension with the rotated dimension by */ /* adding it to the extension dictionary of the rotated dimension */ /**********************************************************************/ // pdimension - your radial dimension. you need have it created and added to db here pdimension->createextensiondictionary(); oddbdictionaryptr pdict = pdimension->extensiondictionary().safeopenobject(oddb::kforwrite); oddbobjectid dimassid = pdict->setat(dd_t("acad_dimassoc"), pdimassoc); /**********************************************************************/ /* associate the rotated dimension with the associative dimension */ /**********************************************************************/ // dimensionid - your dimension id pdimassoc->setdimension(dimensionid); /**********************************************************************/ /* attach the line to the associative dimension */ /**********************************************************************/ oddbosnappointrefptr pointref; pointref = oddbosnappointref::createobject(); pointref->setosnapmode(oddb::kosmodecen); pointref->setnearosnap(0.0); // plineid - your polyline id. you need have polyline created and added to db here pointref->mainentity().objectids().append(plineid); pointref->mainentity().subentid().settype(oddb::kedgesubenttype); // indexlineseg - segment index start 1 pointref->mainentity().subentid().setindex(indexlineseg); pdimassoc->setosnappointref(oddbdimassoc::ksecondpoint, pointref); /**********************************************************************/ /* add persistent reactors from the rotated dimension and the line */ /* to the associative dimension */ /**********************************************************************/ pdimension->addpersistentreactor(dimassid); ppolyline->addpersistentreactor(dimassid); best regards, sergey z. hello sergey, thanks a lot, now it works! most helpful was your hint: "segmentindex - segment index starts with 1"! the associative dimension for oddb2lineangulardimension works as well! however, there seems to be a problem with oddb2lineangulardimension (is it a bug?): if i want an angular dimension between 2 lines with say 112? it creates a circle with a depiced angular dimension of 68?(360?292?, but the circle goes over 292? see the attached .dxf file, for acad 2004). as soon as you open the drawing in autocad and change a property of the angular dimension, it depicts the correct value of 112? is there a bug in dwgdirect 2.3.1 (the version i am currently using). cheers and thanks a lot attached files (64.8 kb, 3 views) hello, it is realy bug in dwgdirect. we will try to fix it in next release. as work arround try to use oddb2lineangulardimension::setarcpoint(). arcpoint defined sector in lines cross and also radius dimension arc. best regards, sergey z. hi sergey, thank you for your hint. the workaround oddb2lineangulardimension::setarcpoint(point) works. cheers, christoph |
所有的时间均为北京时间。 现在的时间是 04:53 AM. |