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

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】block layer id and its entity layer id (http://www.dimcax.com/hust/showthread.php?t=15236)

yang686526 2009-05-04 04:48 PM

【转帖】block layer id and its entity layer id
 
block layer id and its entity layer id
block layer id and its entity layer id
hi all,
opening it with autocad i see the following data: a block which has layer index 0; inside the block there are entities with layer index 2. when i read the file wiht directdwg and use the method oddbentity::layer() i get "0".
is there any way to know the original layer of the entities within the block?
bye
marco
sorry, of course, the beginning of the post has to be:
"i have a dxf file!"
quote:
opening it with autocad i see the following data: a block which has layer index 0;
do you mean block reference?
quote:
when i read the file wiht directdwg and use the method oddbentity::layer() i get "0".
layer() is called for block reference or for entities inside the block?
sergey slezkin
the block reference has layer 2
the layer method is called on entities inside the block reference
could you post (or e-mail me) a sample?
sergey slezkin
here you are
but at which block and block reference should i look at?
sergey slezkin
sorry,
i sent the wrong file. i attach the right one. anyway, it was a my bug: the method layer() of the block reference gives "0" and the method layer of the inner entities gives "2", but i missed to manage the data.
then, i have another question: is there anywhere an information which gives the way to manage the layer name in that case? is it defined anywhere wether to use the block reference layer name or the entities layer name?
hope i understood your question correctly.
if an entity has layer different from default "0" layer - entity's layer is used to render the entity (linetype and color if they are bylayer and layer visibility).
if an entity inside block has default layer "0" - block reference layer is used.
imagine a block which contains a line on "0" layer and a circle on "layer_1"
block reference is on "layer_2".
line will be visible if "layer_2" is visible.
circle will be visible if "layer_1" is visible irrespective of "layer_2" visibility.
sergey slezkin
correct!
thank you


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