高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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
|