几何尺寸与公差论坛------致力于产品几何量公差标准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, 02:44 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】how to get the color of merged entities

how to get the color of merged entities?
how to get the color of merged entities?
hello,
i cannot figure how to retreive the color of two merged entities (seen as one oddbentity) if they have been colored before the merge.
odreadex gives me the following (partial) log where there is no the expected colors.
thank you a lot in advance for your help
guilhem
<acdbblocktable>
<acdbblocktablerecord>
name. . . . . . . . . . . . . . . *model_space
anonymous . . . . . . . . . . . . false
comments. . . . . . . . . . . . . ""
origin. . . . . . . . . . . . . . [0.0 0.0 0.0]
block insert units. . . . . . . . kunitsundefined
block scaling . . . . . . . . . . kany
explodable. . . . . . . . . . . . true
min extents . . . . . . . . . . . [2.3 -0.4 -1.8]
max extents . . . . . . . . . . . [11.1 5.7 2.1]
layout. . . . . . . . . . . . . . true
has attribute definitions . . . . false
xref status . . . . . . . . . . . kxrfnotanxref
<acdb3dsolid> . . . . . . . . . . [49]
min extents . . . . . . . . . . [3.3 2.8 0.0]
max extents . . . . . . . . . . [5.3 5.7 2.1]
layer . . . . . . . . . . . . . 1
color index . . . . . . . . . . 2
color . . . . . . . . . . . . . aci 2
linetype. . . . . . . . . . . . bylayer
ltscale . . . . . . . . . . . . 1.0
lineweight. . . . . . . . . . . klnwtbylayer
plot style. . . . . . . . . . . bylayer
transparency method . . . . . . 0
visibility. . . . . . . . . . . kvisible
planar. . . . . . . . . . . . . false
planarity . . . . . . . . . . . knonplanar
<acdb3dsolid> . . . . . . . . . . [50]
min extents . . . . . . . . . . [2.3 0.4 -1.8]
max extents . . . . . . . . . . [5.9 4.0 1.8]
layer . . . . . . . . . . . . . 2
color index . . . . . . . . . . 3
color . . . . . . . . . . . . . aci 3
linetype. . . . . . . . . . . . bylayer
ltscale . . . . . . . . . . . . 1.0
lineweight. . . . . . . . . . . klnwtbylayer
plot style. . . . . . . . . . . bylayer
transparency method . . . . . . 0
visibility. . . . . . . . . . . kvisible
planar. . . . . . . . . . . . . false
planarity . . . . . . . . . . . knonplanar
<acdb3dsolid> . . . . . . . . . . [60]
min extents . . . . . . . . . . [7.5 -0.4 -1.8]
max extents . . . . . . . . . . [11.1 4.9 2.1]
layer . . . . . . . . . . . . . 0
color index . . . . . . . . . . 256
color . . . . . . . . . . . . . bylayer
linetype. . . . . . . . . . . . bylayer
ltscale . . . . . . . . . . . . 1.0
lineweight. . . . . . . . . . . klnwtbylayer
plot style. . . . . . . . . . . bylayer
transparency method . . . . . . 0
visibility. . . . . . . . . . . kvisible
planar. . . . . . . . . . . . . false
planarity . . . . . . . . . . . knonplanar
attached images
explode the block?
hello,
you mean that it is possible to retreive the inner components of the merged entity?
probably with odbentity::explode() ?
i am going to test...
thanks a lot for your help
guilhem
guilhem
not efficient to explode!
i have tried to explode the entities.
for example, when the yellow cube is exploded, i get 6 entities, one per cube-face. i am afraid that if i have to do that for every entities, and perhaps also for the sub-entities, my importer will takes a month to read a file...
i only want to detect that the merged entity is made with a red sphere and a blue cube in order to store the correct colors.
is there is a way to know if an entity is built by a union (in autocad) of several other sub-entities? in this case, it will be more efficient to check only those union-made entities...
many thanks for any suggestions
guilhem
guilhem
and more: explosion seems to does not work.
i have tried the following code:
code:
void dwgentity (oddbentityptr dwg_entity,
odstaticrxobject<vectorizer> * vectorizer) {
/* get the sub entities */
odrxobjectptrarray array;
if (dwg_entity->explode (array) == eok) {// && array.length() > 1) {
odcmentitycolor a, b;
for (unsigned i = 0; i < array.length(); i++) {
oddbentityptr dwg_subentity = (oddbentityptr) array[i];

/* get the subentity color */
b = dwg_subentity->entitycolor();

/* store the first color as the reference */
if (i == 0) a = b;
else if (a != b) {
/* if the colors are not the same, process the sub-entities separately */
for (i = 0; i < array.length(); i++) {
dwg_subentity = (oddbentityptr) array[i];
dwgentity (dwg_subentity, vectorizer);
}
return;
}
}
}
}
/* my code that draw the entity in order to get its attributes/geometry */
}
when i process the attached dwg file, i get three entities, one for the yellow cube, one for the green sphere and one for the merged entity built with the blue cube and the red sphere.
the yellow cube is exploded in 6 entities with the same color, the green sphere is exploded in one entity, and the merged entity is exploded in seven entities with all the same color 0xc0000000 (bylayer): i expected here the red and the blue colors... (this is the same with dwg_entity->color() and with dwg_entity->entitycolor())...
all ideas will be greatly appreciated!
thanks in advance
guilhem
guilhem
i also would like to know how do this without explode. don't know why it doesn't find the color of the entity.
mfcoda application reads and display the sample correctely...
but i have checked that the simplifier function shellproc() is called with the correct color by the vectorizer. i think all the magic stuff is done in the vectorizer.
i have tried to implement the shellproc() in order to see of the vertexdata or the facedata brings the entities colors, but no...
i have really no idea at this stage...
the explode function does not seem to be the solution because the exploded entities does not brings the correct colors any more. perhaps i would try explodegeometry()...
if someone anywhere, at anytime, have a idea... i will thanks him a lot!
guilhem
yes! this is explodegeometry() that must be used...
my sample function dwgentity() works fine if explodegeometry() is used in place of explode()... the red sphere is really... red, and the blue cube is really blue.
guilhem
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】hatching entities yang686526 DirectDWG 0 2009-05-05 12:01 PM
【转帖】exploding proxyentities into simple entities yang686526 DirectDWG 0 2009-05-05 10:20 AM
【转帖】exploding block references = invisible entities yang686526 DirectDWG 0 2009-05-05 10:17 AM
【转帖】coping entities yang686526 DirectDWG 0 2009-05-04 06:18 PM
【转帖】block entities are not erased after the block deleting yang686526 DirectDWG 0 2009-05-04 04:46 PM


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


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