高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】obtain single sat file for all proxy enitites
obtain single sat file for all proxy enitites
obtain single sat file for all proxy enitites
is there a way to get a single sat file for all the acadpart's (proxy enitites)?
(like the createsat function which does it for solids, body and regions to get a single file)
if not, how do i manually merge the sat files into a single file?
thanks.
hi,
createsat has two versions
createsat(const oddbentityptrarray
createsat(const odarray<odmodelergeometryptr>
try something like next :
odarray<odmodelergeometryptr> m_bodies
....
oddbproxyentityptr pproxy(pobject);
odstring classname = pproxy->originalclassname();
if (classname == "acadpart")
{
odgetsatfromproxy(pproxy, *m_bodies.append());
}
....
createsat(m_bodies, ..... );
it used in mfcapp cacissavedialog.cpp cacissavedialog::cacissavedialog.
btw : manually merging of sat is not trivial task
last edited by sslezkin; 22nd november 2004 at 02:41 amfff">.
thanks, it worked.
but on many occasions createsat fails on converting modelergeometry to sat file, where modelergeometryptr has geometry from more than 10 or 15 acadparts, i have included one such file on which it fails, could you look it?
the zipped file is 1.9mb in size..., i am unable to upload the file.. could i email the file to you?
thanks,
vijay
yes... my email , icq 104 533 729
it is possible our bug.
i sent in the email this morning.
thanks,
vijay
hi,
thanks for file, i have tested it. did you use
odmodelergeometryptr pmodelergeometry;
if (odgetsatfromproxy(pproxy, pmodelergeometry))
{
m_bodies.push_back(pmodelergeometry);
}
or
odgetsatfromproxy(pproxy, *m_bodies.append()) ?
i need to known your sat out version from createsat also.
// createsat(m_bodies, tempfilebuffer, kaftypeascii|kaftypeindexed|kafver700, true);
last edited by sslezkin; 22nd november 2004 at 03:08 amfff">.
alternative worked
the alternative method from your reply worked.
before, i used odgetsatfromproxy(pproxy, *m_bodies.append())
and kafverany - so that i get the version depending on the version in the dwg file...
createsat(m_bodies, tempfilebuffer, kaftypeascii|kaftypeindexed|kafverany, true);
**************************************************
from your reply, i used
odmodelergeometryptr pmodelergeometry;
if (odgetsatfromproxy(pproxy, pmodelergeometry))
{
m_bodies.push_back(pmodelergeometry);
}
and it worked, (does it mean not all acadpart can be converted to sat or modelergeometry?)
thanks.
createsat was crashed on null modelergeometry, i have fixed it already. the alternative method prevent null situation.
odgetsatfromproxy return false in error case, or if sat data stored in proxy is null (1.9 mb file situation ).
in the assembly.dwg file i had emailed you, i have trouble viewing the geometry from the 3dsolids and regions in it after writing them out as a sat file.
i am successfully able to write out the information as a sat file(for 3dsolids and regions only), but when i load it back in, it loads up an empty scene on a couple of sat viewers. (i set the version to kafverany and it writes out as ver 4.00 from the original file)
i am also emailing you the sat file i obtained for the solids and regions only.
thanks.
hi vijay,
i cannot reproduce your problem with viewing of sat file. i have tested it with hoops viewer v7 and it show all geometry normaly. also you can call autocad acisin command to insert sat to autocad drawing and autocad also shows sat geometry.
btw : mfcapp has "acis edit" menu command. you can load sat and make solid objects with it.
i think that problem is in extents. there are two groups of objects, which are very far one from other. possibly, you need call transformby with block transformation matrix or something like this, if you need truth placement.
about kafverany: it is unsafe to use it, autocad 2005 uses modified sat format 20800. standard sat viewers are not work with. so if you call createsat with kafverany on autocad 2005 files, it can generate sat v20800.
last edited by sslezkin; 24th november 2004 at 01:04 amfff">.
placement of acadparts in the sat file
regarding the block transform:
to render i am using dd rendering as in odvectorizeex example, so i get the entities in the right position. i get the model rendered correct, but for proxyentities (acadparts) when i write them out as a sat file, i dont get the entities in the correct location when i load the sat file.
i tried the following:
1st try:
i applied the blocktransform for the acadparts alone (looks like i get the right transformation matrix, in one example its only translation, so even failure due to non-uniform transformby may be avoided). but i dont see any difference in the placement of entities in the sat file. (i also take into consideration the block origin, before transforming)
2nd try:
as i convert the proxtentites(acadparts) into modelergeometry before writing them to a sat file, i obtained the transformation of the modelergeometry and transformed it with the obtained transformation. still the entities are not in the proper location.
as i need to write all the acadparts into one sat file, i convet them into modelergeometry then to sat file.
could you let me know what i am missing?
thank you.
try next, i have tested it with 1.12.
oddbdatabase* pdb = getdocument();
oddbblocktablerecordptr pms = pdb->getmodelspaceid().openobject();
odarray<odmodelergeometryptr> m_bodies;
oddbobjectiteratorptr pentiter = pms->newiterator();
while(!pentiter->done())
{
oddbentityptr pent = pentiter->entity(oddb::kforread);
pentiter->step();
if (!pent.isnull() && pent->iskindof(oddbblockreference::desc()))
{
oddbblockreferenceptr pblock(pent);
odgematrix3d mx = pblock->blocktransform(); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
oddbblocktablerecordptr pbtr = pblock->blocktablerecord().safeopenobject();
oddbobjectiteratorptr pit = pbtr->newiterator();
while (!pit->done())
{
oddbentityptr pentity = pit->entity();
pit->step();
if (!pentity.isnull() && pentity->iskindof(oddbproxyentity::desc()))
{
oddbproxyentityptr pproxy(pentity);
odstring classname = pproxy->originalclassname();
if (classname == "acadpart")
{
odmodelergeometryptr pmodelergeometry;
if (odgetsatfromproxy(pproxy, pmodelergeometry))
{
m_bodies.push_back(pmodelergeometry);
m_bodies.last()->transformby(mx); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
}
}
}
}
}
odstreambufptr tempfilebuffer
= odsystemservices()->createfile("c:\\tmp.sat", oda::kfilewrite, oda::ksharedenyno, oda::kcreatealways);
odrxclassptr pservice = odrxgetmodelergeometrycreatorservice();
odmodelergeometrycreatorptr pcreator( pservice->create() );
if (pcreator->createsat(m_bodies, tempfilebuffer, kaftypeascii|kaftypeindexed|kafver700, true) != eok)
{
}
|