高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】regression on entity colour in ver 1.14
regression on entity colour in ver 1.14 ?
regression on entity colour in ver 1.14 ?
there appears to be a regression in returning the entity colour in 14.1 compared with ver 13. the attached file contains a single dimension where all the dimension entities have a defined colour. however the function
bool isbyaci = entitycolortype.isbyaci ();
returns false in ver 1.14 and true in ver 1.13
when applied to the dimension entities.
regards
gerry
attached files
it's not a regression.
dimension color is "by layer".
objectarx function isbyaci(); returns false for color of this dimension too.
because color method is "by layer", not "by aci".
sincerely yours,
george udov
apologies in advance. i am not an expert in the interpretation of dxf files. to clarify matters (for me) i attach an even simpler file that consists of one dimension in layer '0' with a single line and one text. the line and text entities belong to layer1, and have aci colours 1 and 2 respectively. when i load this file into autocad 2004, the dimension created is in layer1, and the elements have colours 1 and 2.
using the same source code on versions 1.13 and 1.14 i receive different results. when i enquire the layer of the line entity (layername = pentity->layer ()) in 1.13 the function returns layer1. when i enquire entitycolortype.isbyaci () it returns true. these results appear to be consistent with the result i am getting in autocad.
using ver 1.14 pentity->layer() returns '0', and entitycolortype.isbyaci () is false.
when you say "dimension color is by layer", where in the file is this indicated or marked. as layers '0' and 'layer1' both have an aci colour of 7, then it seems that autocad itseld does not consider that this statement is true.
on a more general note if the dimension has a layer ( layer '0' say) and the dimension entities have different layers then how does one whether the layer of the parent is used by its children, or if the children use their own layer.
regards
gerry
attached files (16.1 kb, 3 views)
quote:
using the same source code on versions 1.13 and 1.14 i receive different results. when i enquire the layer of the line entity (layername = pentity->layer ()) in 1.13 the function returns layer1. when i enquire entitycolortype.isbyaci () it returns true. these results appear to be consistent with the result i am getting in autocad.
using ver 1.14 pentity->layer() returns '0', and entitycolortype.isbyaci () is false.
it is strange. pentity->layer() returns 'layer1' for both line and text. dwgdirect 1.14. my code for reproducing issue is
code:
oddbentityptr pent;
pent = pdb->getoddbobjectid(oddbhandle("33")).openobject();
odstring layer = pent->layer();
pent = pdb->getoddbobjectid(oddbhandle("34")).openobject();
layer = pent->layer();
of course, pentity->layer() returns '0' for dimension. it is because dimension lies on layer '0'.
isbyaci is true for line and text, because they colors are assigned by index. isbyaci is false for dimension, because its color is "by layer". when in file it is marked that dimension color is "by layer"? these lines:
code:
0
section
2
entities
0
dimension
5
35
330
1f
100
acdbentity
8
0
100
acdbdimension
dimension's color isn't explicitly indicated, it means that it uses default color. default color is "by layer". you can see it in autocad - open attached file, select the dimension, and you'll see that its layer is '0' and its color is "bylayer".
quote:
on a more general note if the dimension has a layer ( layer '0' say) and the dimension entities have different layers then how does one whether the layer of the parent is used by its children, or if the children use their own layer.
each entity has its own layer. entity properties are handled separately. for example, color are handled this way:
1) if color method is by color or by aci, then entity color is used.
2) if color method is by layer, then layer color is used.
3) if color method is by block, then parent's color is used.
so, for example, if some entity has "byblock" color, and its parent (block reference, dimension, etc) has "bylayer" color, then entity is drawn by color of parent's layer.
sincerely yours,
george udov
the files that i used in 1.13 and 1.14 are not identical. in 1.14 i am also using recomputedimblock () to obtain the measurement. using the arguement of true for this function, then in the code below the layer changes from 'layer1' to '0'. with an arguement of false, the layer remains the same, and the pdim->measurement () returns the correct value.
thanks for your help.
gerry
//line with handle 33
pent = pdb->getoddbobjectid(oddbhandle("33")).openobject();
layer = pent->layer(); //its 'layer1'
//dimension with handle 35
pent = pdb->getoddbobjectid(oddbhandle("35")).openobject();
pent->upgradeopen (); //open for read & write to allow recomputedimblock
pdim = (oddbdimensionptr)pent;
pdim->recomputedimblock (true);
//line with handle 33 again
pent = pdb->getoddbobjectid(oddbhandle("33")).openobject();
layer = pent->layer(); //its now '0'
if you call recomputedimblock with "true". the block is recreated. new line inside dimension block has layer "0"
sergey slezkin
|