高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】missing attributes
missing attributes
missing attributes
hello
i am trying to copy all of the model space entities of sourcedatabase into the model space of m_pdatabase.
the following function achieves this except that it fails to
put attributes onto any of the block inserts that are copied. the
block definition created does however contain the attribute definitions.
what am i doing wrong?
bool copyentities( oddbdatabaseptr sourcedatabase, odgevector3d inspt )
{
try {
odgematrix3d transformation;
transformation.settranslation( inspt ) );
m_pdatabase->insert( transformation, sourcedatabase );
}
catch( oderror e )
{
return displayerror( e.code() );
}
}
thanks in advance
what you are doing is correct. i just tested it out in the distributed version with success.
perhaps you can send me the drawing that you are attempting to insert? i might be a missing font in the tables - hard to say. but i was successful with inserting a drawing which contained a block with attributes.
hello
i have determined that the insert command mentioned in my previous post seems unable to deal with complex entities such as attributes and 3d polylines.
to observe this behaviour please do the following:
make a new drawing file using autocad 2004
construct a 3d polyline entity using the 3dpoly command in autocad.
use the autocad insert command to insert a block with attributes into the same drawing file. fill in the attributes with something
so they are visible.
finally make a simple line entity and a text entity in the drawing.
now if you run the function mentioned in my previous post on this drawing file you will see that the text entity and line entity will have copied correctly. however the 3d polyline and the attributes on the block
will be missing.
i would be very grateful if you could try this as it is causing me a lot of trouble.
thankyou
ashman
since you've gone through the trouble of creating that a very specific drawing - could you post it here?
hello
here are some drawing files as requested.
there are three files as described below:
"block.dwg"
this is a block with a text entity and two attribute definitions
"drawing to insert.dwg"
this is a drawing with block.dwg inserted into it using the autocad insert command. this drawing also contains a text entity, line entity and a 3d polyline entity.
"drawing inserted.dwg"
this drawing is produced when dwgdirect is used to insert "drawing to insert.dwg" into a new drawing file.
note that the attributes of the block and the 3d polyline entity are missing.
i hope this helps.
kind regards
ashman
attached files (19.7 kb, 4 views)
i just used the odwriteex example and the drawing you gave me "drawing to insert.dwg" -
i've attached the resultant drawing as well as my modified odwriteex example that you can paste into your examples folder for verification.
attached files (16.1 kb, 4 views)
i have compiled your code in the odwriteex example using vc6 and run it to produce the attached drawing. unforuntately it has exactly the same problem as i had before. why it works on your computer is a mystery. perhaps you are running a different version. i am using version 1.09 of dwgdirect and visual studio 6 sp5.
thanks for your help
regards
ashman
attached files (107.8 kb, 2 views)
i appears that the reason for my trouble is that the version of the library i am using is not the same as the one currently available. i have downloaded it again and compared the files and there are significant differences. it was called 1.09 when i downloaded maybe it is not actually the same 1.09 currently available?
anyway it all seems to work fine now.
happy are we!!
hi
sad are we!!
unforuntately i have discovered a problem that is not fixed by my previous discovery. if a block is inserted 'n' times into a drawing file the block definition will contain 'n' copies of all the entities that make up the block. to observe this behaviour you could use the obwriteex that you sent me previously and substitute the following version of copyentities which will insert the drawing "drawing to insert" in three places.
bool copyentities( myservices &svs, oddbdatabaseptr &pdb )
{
try {
odgematrix3d transformation;
odgevector3d inspt(0.0 , 0.0 , 0.0);
transformation.settranslation( inspt ) ;
oddbdatabaseptr sourcedatabase = svs.readfile( "c:\\opendwg2004\\examples\\odwriteex\\drawing to insert.dwg" );
pdb->insert( transformation, sourcedatabase );
inspt.x = 10;
transformation.settranslation( inspt ) ;
pdb->insert( transformation, sourcedatabase );
inspt.x = 20;
transformation.settranslation( inspt ) ;
pdb->insert( transformation, sourcedatabase );
}
catch( oderror e )
{
}
return true;
}
once you have run this go to the odamfcapp and open the drawing that is produced. go to the <block> key in the tree and you will see that there are three copies of every entity in the block definition of the inserted block.
apparently this is a bug. i'll forward this on to the engineers as this one looks complex to deal with.
hi again
i see that the 18-11-2003 release has not fixed the bug. any idea of when it may be fixed?
ashman
circle getgeomextents incorrect
hello
the getgeomextents function fails to correctly calculate the bounding box for a circle entity. it returns a box that is the top half of the circle. this is a big problem when trying to calculate the overall extents of a block containing circles.
regards
ashman
thanks for finding it out. circle extents will be fixed in next release.
sergey slezkin
|