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


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-06, 11:31 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】problem with reading block reference

problem with reading block reference...
problem with reading block reference...
hello
i have a problem with reading a block reference in a dwg - ac1015 file.
in fact, i can get the original block referenced by the br, wich seems to have valid components and wich is positionned in (0,0,0).
but for the br, the position is set to (803336;261621;0) while would be (60.1039;60.8258;0) (values obtained in acad), and the rotation is 79.7189° while would be 159.4332
to dump all of this, i've made my own library based on the odreadex example (wich also get the same values).
any idea?
please... help !
......added after more tests......
i tried to do more tests, and the problem doesn't seem to be linked to block references, because i have many false coordinates.
i answer your question : yesfff">, i have tested another files of the same format (but with less entities), and i can read them without any problem...
last edited by zed; 2nd june 2004 at 09:13 amfff">.
does "obtained in autocad" mean values got in arx or displayed in property palette?
coordinates in property palette are displayed in current ucs not in wcs.
you can check the real values stored in file using arxdbg sample application (from objectarx)
or having saved the file from autocad to dxf.
if this does not help, post or e-mail me the problem file, please.
sergey slezkin
hello sergey, and thank you for the answer.
i'm almost good with c++, but i'm afraid that i don't know acad very much... so, i don't have any idea of what arx can be.
the only thing i can say for the obtained values in acad is that they apear after typing "list" or a thing like that, and they are not editables.
but what i m sure with is that even if there is a wcs to ucs transformation applied, the obtained values are too diferent from original ones...
objectarx is autocad's c++ interface (headers, import libs and docs) for customizing it (implementing custom objects, commands etc.) it can be downloaded for free from autodesk's site.
the values which are actually stored in file can be examined if you save the file to dxf (autocad's text format).
since the problem occurs with specific file i can't help you without having the file.
sergey slezkin
thanks for all.
i tried to export the file to dxf, and coordinates seem to be correct...?
i join the file with this post. an exemple of my bug can be found in layer 'fp_equipements' entities wich are block refs (such as 'bib-arch-01a0003-pp1').
hope you'll find something
attached files (74.5 kb, 5 views)

coordinates of model space entities in dxf file i saved are around (803330,261500)
acive ucs has origin near this point and it's a bit rotated.
coordinates you get in autocad (properties palette) are in active ucs.
if you set one of standard view in acad (view/3d views/top for example) you'll see coordinates in wcs as they are stored in file.
sergey slezkin

quote:
originally posted by sergey slezkin
coordinates of model space entities in dxf file i saved are around (803330,261500)
acive ucs has origin near this point and it's a bit rotated.
coordinates you get in autocad (properties palette) are in active ucs.
if you set one of standard view in acad (view/3d views/top for example) you'll see coordinates in wcs as they are stored in file.
so, if i understand all, my wanted coordinates are in active ucs. but the ones found with dwgdirect are in wcs...
is there a way to make dd transform coordinates in active ucs automatically (or even manually)? like a global function that would make entities available for dumping in desired cs...
i very thank you for all. this forum is very well managed (and fast!).

after several tries, i've finally found this method wich apparently works :
code:
odresult getucscopy(const oddbentityptr &src, oddbentityptr &dest)
{
odgepoint3d orig;
odgevector3d xaxis, yaxis;
oddbdatabaseptr pdb = src->database();
if(pdb->gettilemode())
{ orig = pdb->getucsorg();
xaxis = pdb->getucsxdir();
yaxis = pdb->getucsydir();
} else
{ orig = pdb->getpucsorg();
xaxis = pdb->getpucsxdir();
yaxis = pdb->getpucsydir();
}
odgematrix3d wcs2ucs;
wcs2ucs.setcoordsystem(orig, xaxis, yaxis, odgevector3d(0,0,1));
wcs2ucs.invert();
return src->gettransformedcopy(wcs2ucs,dest);
}
any comment ???
but i have (yes,... again) a last question. in fact, i've read in the forum that some entities are given in wcs, anothers in ucs, and anothers in ocs... how can i know wich is the one? are them pre-defined (is there a doc?) or is there an accessor (like entity->wichcs())
thanks for all
comment:
ucs z axis may not coincide with world's z.
it would be better to use x.crossproduct(y) for z, not (0,0,1).
i don't know your task so i can't comment if gettransformedcopy() is required.
"actual" geometry is in wcs and ucs only reflects user's view (direction, origin offset)
no entity accessors return coordinates in ucs. entities "do not know nothing" about ucs. user coordinate system is only for interacting with user - to display coordinates and to input them (from console or some editing tool).
most entities return coordinates in world coordinate system (wcs). usually it is said in header file. for example from dbcircle.h
/** description:
returns the center of the circle in wcs (dxf 10).
*/
odgepoint3d center() const;
oddbpolyline for example have accesors returning points in both wcs and ocs. 3d geometry (points, line/arc segments) is returned in wcs. 2d geometry - in ocs.
oddbmtext::direction() returns 3d vector. it's direction in wcs. oddbmtext::rotation() returning double is rotation angle around ocs z axis.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】numerous link errors on macosx 9xcode 2.50 yang686526 DirectDWG 0 2009-05-06 06:43 PM
【转帖】memory leak issue yang686526 DirectDWG 0 2009-05-06 05:37 PM
【转帖】grouping in svg based on block hierarchy yang686526 DirectDWG 0 2009-05-05 11:41 AM
【转帖】color problem with hatch while vectorization yang686526 DirectDWG 0 2009-05-04 05:55 PM
【转帖】cloning a block yang686526 DirectDWG 0 2009-05-04 05:50 PM


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


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多