几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】position of text is not correct when reading the attached d (http://www.dimcax.com/hust/showthread.php?t=17951)

yang686526 2009-05-06 10:18 PM

【转帖】position of text is not correct when reading the attached d
 
position of text is not correct when reading the attached dx
position of text is not correct when reading the attached dxf-file.
dear all,
the texts are not shown correct when opening the attached dxf-file with odamfcappdll.exe.
they are shown correct when opening it with autocad.
if i only open this dxf-file and don't do any operation whit autocad and save it again. then opening it with odamacappdll.exe again , they are shown correct.
please have a look at the acctached file. thanks!
attached file:
alk.suelfeld.dxf ---- primordial file
alk.suelfeld2.dxf ---- open alk.suelfeld.dxf and don't do any operation with autocad and save it again.
untitled.jpg ---- show in odamfcappdll.exe
untitled2.jpg ---- show in autocad
attached files
hello,
odamfcapp has command ( edit\registred commands \drxdebug\adjusttext ) which call adjustalignment() for all text in database. try to use it. acad do it evry time after load dxf file.
see also dwgdirect help topic "when i load a dxf file and save it as dwg, why does the position of various text strings in the dwg file look incorrect when viewed in autocad? " in faq.
best regards,
sergey z.
last edited by sergey z.; 14th november 2008 at 08:01 amfff">.
quote:
originally posted by sergey z.
hello,
odamfcapp has command ( edit\registred commands \drxdebug\adjusttext ) which call adjustalignment() for all text in database. try to use it. acad do it evry time after load dxf file.
see also dwgdirect help topic "when i load a dxf file and save it as dwg, why does the position of various text strings in the dwg file look incorrect when viewed in autocad? " in faq.
need i call adjustalignment() for all text when i load dwf\dwg file?
and class oddbmtext have not this member function.
i am sorry to tell you that it will throw a exception when i call this function. i don't know why?
last edited by dud@rib.de; 16th november 2008 at 07:11 pmfff">.
quote:
originally posted by dud@rib.de
need i call adjustalignment() for all text when i load dwf\dwg file?
you make a decision for your application.
quote:
originally posted by dud@rib.de
and class oddbmtext have not this member function.
you are right. such function is no sense for oddbmtext.
quote:
originally posted by dud@rib.de
i am sorry to tell you that it will throw a exception when i call this function. i don't know why?
could you explain more detail. sample dwg/dxf file or/and piece of your code will be appreciable.
best regards,
sergey z.
simple flow of our program:
1.read the dxf file which attached above.
2.get blocks from databace
3.get entitys from blcok.
4.if the type of this entity is single text, i will call the function adjustalignment(), then get other attributes of this text, such as text position, text height, and so on. but it will throw a exception when the program run to the function adjustalignment(). by the way, i use the default parameter when i call this function.because i don't know the databace when i call this function in my program.
last edited by dud@rib.de; 17th november 2008 at 05:45 pmfff">.
if you catch oderror you can get it's text description using oderror::description() method.
maybe you open the text entity for read?
sergey slezkin
quote:
originally posted by sslezkin
if you catch oderror you can get it's text description using oderror::description() method.
maybe you open the text entity for read?
the text description of this exception is that "not opened for write".
but i still can't understand.
what's meaning of the comment "this function is called by dwgdirect when a text entity is closed" for the function adjustalignment() in dbtext.h?
i have understood you. the text must be opened for wrtite when i call the function adjustalignment().
so my source code as below:
--------------------------
if (pentity->iskindof(oddbtext::desc()))
oddbtextptr ptext = pentity;
ptext->upgradeopen();
ptext->adjustalignment();
ptext->downgradeopen();
ptext->position();
ptext->height()
......
......
------------------------------
now, the position of the attached file is correct.
do you agree with this solution? i don't know whether it bring other problems after i call this function when i reading the dwg/dwf file or the position of text needn't adjust.
last edited by dud@rib.de; 18th november 2008 at 06:04 pmfff">.
the potential problem is that if required font is missing than position will be recalculated incorrectly because font substituted for missing one has different metrics. this will take place for correct files too (where position is saved to dxf correctly).
sergey slezkin


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