几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-06, 10:15 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】polyline with dimension

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.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】need dimension advice yang686526 DirectDWG 0 2009-05-06 06:20 PM
【转帖】measurement value 9dxf 420 stored in a dimension entity yang686526 DirectDWG 0 2009-05-06 05:32 PM
【转帖】an angular dimension error yang686526 DirectDWG 0 2009-05-04 03:57 PM
【转帖】a dimension error yang686526 DirectDWG 0 2009-05-04 03:05 PM


所有的时间均为北京时间。 现在的时间是 04:11 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多