![]() |
【转帖】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 |
所有的时间均为北京时间。 现在的时间是 12:14 AM. |