polyline with dimension
associate dimensions with polyline segments??
hi all,
i am creating dxf drawing using oddbpolyline entities. now i want to associate different dimensions like oddbrotateddimension, oddbradialdimension etc. with polyline.
how can i associate dimensions with polyline segments? attached herewith code. it is not associating segments with dimensions.
please help.
================================================== ========
if (pdb.isnull()) {
return false;
}
oddbblocktablerecordptr bbtr = getblockobjectid(blockid);
if (bbtr.isnull()) {
return false;
}
oddbpolylineptr ppolyline = objarr.at(polylineid).safeopenobject(oddb::kforwri te);
if (ppolyline.isnull()) {
return false;
}
int polylinesegments = getpolylinesegments(ppolyline);
if(segmentindex < 0 || segmentindex > polylinesegments) {
return false;
}
odgecircarc2d arc2d;
ppolyline->getarcsegat(segmentindex,arc2d);
oddbradialdimensionptr pdimension = oddbradialdimension::createobject();
oddbobjectid dimensionid = bbtr->appendoddbentity(pdimension);
odgepoint3d centerpoint;
centerpoint.x = centerpointx;
centerpoint.y = centerpointy;
odgevector3d chordvector(radius, 0.0, 0.0);
chordvector.rotateby(odatoradian(chordrotationangl e), odgevector3d::kzaxis);
// set dimension and text properties
pdimension->setdatabasedefaults(pdb);
pdimension->setlayer(objarr.at(layerid), false);
pdimension->setcenter(centerpoint);
pdimension->setchordpoint(centerpoint + chordvector);
pdimension->setleaderlength(leaderlength);
pdimension->setdimjust(textdimposition);
pdimension->setdimtad(textbaseposition);
pdimension->setdimdec(2);
pdimension->setdimasz(3.0);
pdimension->setdimcen(0);
pdimension->setdimtoh(false);
pdimension->setdimtih(false);
pdimension->setlayer(objarr.at(layerid));
if(txtsize > 0.0) {
pdimension->setdimtxt(txtsize);
}
if(isdefaultdimtxtposition == false) {
setdimensiontextposition(pdimension, txtpositionx, txtpositiony);
}
pdimension->settextrotation(odatoradian(txtrotation));
pdimension->createextensiondictionary();
oddbdimassocptr pdimassoc = oddbdimassoc::createobject();
// associate the associative dimension with the rotated dimension by
// adding it to the extension dictionary of the rotated dimension
oddbdictionaryptr pdict = pdimension->extensiondictionary().safeopenobject(oddb::kforwr ite);
// associate the rotated dimension with the associative dimension
pdimassoc->setdimension(dimensionid);
pdimassoc->setrotateddimtype(oddbdimassoc::kparallel);
oddbobjectid dimassid = pdict->setat("acad_dimassoc", pdimassoc);
oddbosnappointrefptr pointref = addsnappointref (centerpoint, oddb::kosmodecen, ppolyline->id(), oddb::kvertexsubenttype);
pdimassoc->setosnappointref(oddbdimassoc::ksecondpoint, pointref);
pointref = addsnappointref (pdimension->chordpoint(), oddb::kosmodestart, ppolyline->id(), oddb::kvertexsubenttype);
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);
pdimension->recomputedimblock();
objarr.append(dimensionid);
return true;
================================================== =
please help.
last edited by ravindra_ghetia; 3rd april 2007 at 03:23 amfff">.
more details
i want to associate segments of polyline with dimensions.
like line, arc segments.
it is easy to retrieve details of segments using methods getarcsegat, getlinesegat etc.
but how can i specify snap points for segments? added herewith code
about snappointref. but snap pointer accept oddbobjectid only where segments of polyline is not an entity. so problem in association of polyline segments and different dimensions like rotated, radial & diametric.
oddbosnappointrefptr addsnappointref (odgepoint3d dimensionpoint,oddb:

snapmode snapmode,oddbobjectid id,oddb::subenttype subenttype ) {
oddbosnappointrefptr pointref;
pointref = oddbosnappointref::createobject();
pointref->osnappoint() = dimensionpoint;
pointref->setosnapmode(snapmode);
pointref->setnearosnap(0.0);
pointref->mainentity().objectids().append(id);
pointref->mainentity().subentid().settype(subenttype);
return pointref;
}
try to set
pointref->mainentity().subentid().setindex(vertexindex).
best regards,
sergey z.
still not working
i added the code you specified. it is still not working.
for testing purpose i created one dxf file with polyline & different dimensions. added herewith for your reference. i added here with related code also.
i tested it with acad14 and found that dimensions are not associated with drawings.
attached files (49.7 kb, 1 views)
(4.9 kb, 3 views)
please help
added herewith few more dxf files.
dimensions are not associated with subentities of polyline.
is any library needs to be added?
attached files (20.7 kb, 1 views)
(26.7 kb, 1 views)
(26.7 kb, 1 views)
hi
quote:
originally posted by ravindra_ghetia
i tested it with acad14 and found that dimensions are not associated with drawings.
acad14 does't support associated dimensions (acad2000 too). acad2002 supports it and your dimensions are associated.
best regards,
sergey z.
but i found in help of acad14
thanks,
but still i have a doubt..
acad14 help says..
------------------------------
associative dimensions are dimensions in which all the lines, arrowheads, arcs, and text are drawn as a single-dimension object. the dimaso system variable controls associative dimensioning and is on by default. if dimaso is off, the dimension line, extension lines, arrowheads, leaders, and dimension text are drawn as separate objects. you can create a nonassociative dimension if you need to alter the dimension in ways that are not controlled by variables. in general, however, associative dimensions are easier to maintain because they can be modified as a single object.
------------------------------
so, is there any way to achieve associative dimensions with compatibility of acad14?
regards,
ravindra ghetia.
acad2002 help says...
----------------------------
what's new in autocad 2002
new features in autocad 2002 include
associative dimensioning
autocad 2002 now includes true associative dimensioning, which automatically updates dimensions when the associated geometry is modified. this feature increases productivity and enhances usability by eliminating the dependency upon definition points (defpoints).
-----------------------------
if dimaso is off, the dimension line, extension lines, arrowheads, leaders, and dimension text are drawn as separate objects.
i think it was supposed in early version about notion "associativity".
best regards,
sergey z.
i am still confused..
so you said that associative dimensioning is not supported in acad 14. then what about the documentation of acad 14?
can you please elaborate it in more detail?
can you create associative dimension in acad 14 (manually)?
vladimir
any autocad expert around?
hi,
well, i am not autocad expert so i don't know that it is possible or not. i checked in version 2007 and found reassociative option. i am not sure about acad 14. any autocad expert around to help us, please?
regards,
ravindra ghetia
please confirm..
hi,
is dwgdirect does not support associative dimensions for acad14 or acad14 itself not support associative dimensions?
regards,
ravindra ghetia
quote:
originally posted by ravindra_ghetia
hi,
is dwgdirect does not support associative dimensions for acad14 or acad14 itself not support associative dimensions?
regards,
ravindra ghetia
hello ravindra ghetia,
you can create in dwgdirect associative dimensions and write file in r14 dwg/dxf file. your files contain information about associativity (files are r14) but only start acad2002 support it and you can see this. there is no way to create associative dimensions in previous versions acad.
best regards,
sergey z.