查看单个帖子
旧 2009-05-07, 12:32 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】reading dimension arrows

reading dimension arrows
reading dimension arrows
hello,
i have a problem at reading dimension arrows with following code:
oddmutil::arrowname(pdimensionent->dimblk1());
this returns arrow name, if autocad r14 file is loaded, otherwise no name is returned.
why it does not work also for autocad2000 and 2004 files?
here i have another example, which does not work in any case:
pdimensionent->getdimstyledata(&dimstyle);
oddmutil::arrowname(dimstyle->dimblk1());
dwgdirect reference says, that method getdimstyledata fills dimension style with the style, which is used in the dimension. but this example never returns any name of dimension arrow.
while i could not find similar thread on this forum, i suppose, that i am doing something wrong here. can anybody help me at this problem?
regards, tomaz
have you tried this with different arrow heads? according to autocad's help empty name is default - "closed filled".
btw, note that dimblk1 and dimblk2 are used only if dimsah is on. else dimblk is used for both arrows.
sergey slezkin

hello sergey,
apparently this was my mistake. my application first removes all blocks from the drawing, which are not inserted by insert entity. among those blocks were also blocks of dimension arrows.
this also clarifies, why r14 worked correctly
thanks for a good advice and quick help.
regards, tomaz

hello,
according to autocad's help empty name is default - "closed filled".
btw, note that dimblk1 and dimblk2 are used only if dimsah is on. else dimblk is used for both arrows.
i have a drawing with dimension. left arrow is "open30", right one is "dot"
but when i load it with dwgdirect library, it returns:
dimblk1 = ""
dimblk2 = "dot"
dimblk = "open30"
dimsah = 1
according to previous posts, if dimsah is 1, dimblk1 and dimbl2 are used, otherwise dimblk is used.
so in this case i assume, that something is wrong. is this a bug, or am i missing something?
regards, tomaz
i forgot the file
attached files (37.6 kb, 16 views)

dimension references dimstyle there dimension variables are stored. but it also can have some variables overridden. overrides are stored in dimension entity's xdata.
in your example dimension have dimblk1 override as zero handle.
zero arrow handle in dimstyle data is treated by autocad as closed filled. zero arrow handle in xdata override is ignored by autocad and arrow from dimstyle is used.
dd does not ignore zero arrow handle override in xdata. this is dd bug.
for now it can be bypassed by avoiding setting zero arrow handle to dimension entity.
sergey slezkin

hello sergey,
i have reproduced this problem also with new dwgdirect 1.10 (update 1) library.
is it possible to fix it for the next maintenance release?
best regards, tomaz
this bug will be fixed in 1.11 release. i put some explanations below to clarify it.
for attached drawing (dim123.dwg) ddt returns correct values:
dimblk1() = ""
dimblk2() = "dot"
dimblk() = "open30"
dimsah() = 1
acad arx methods return the same values. but acad has a feature... dbdimension::getdimstyledata(dbdimstyletablerecord *prec) fills prec with the effective style settings currently in use by this dimension. the acad has method prec->arrowid(dimarrowflags) which for "dim123.dwg" returns:
prec->arrowid(db::kfirstarrow) = "open30"
prec->arrowid(db::ksecondarrow) = "dot"
whereas
prec->dimblk1() = ""
prec->dimblk2() = "dot"
prec->dimblk() = "open30"
prec->dimsah() = 1
ddt will have the same method and use it for recomputing dimension. as workaround until 1.11, you can use own function to get first and second arrows:
code:
oddbobjectid blkid;
if (dimsah())
{
blkid = (arrowtype==oddb::kfirstarrow) ? dimblk1() : dimblk2();
}
if (blkid.isnull()) blkid = dimblk();
regards,
sergey vishnevetsky
sergey,
thanks for the reply. i will try to wait for the next release, to get the proper solution. if the release date will be too late, i will implement your workaround.
thanks again.
best regards, tomaz
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)