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

use brep.set(const void* pacisfile)
use brep.set(const void* pacisfile)
now i am using visual studio2005(c++).
void createentity( oddb3dsolid* pent)
{
odbrbrep brep;
odbrbrepfacetraverser bft;
odstreambufptr pstreambuf = odmemorystream::createnew();
odresult result = pent->acisout( pstreambuf, kaf_binary_any );
pstreambuf->rewind();
if ( !( pstreambuf->length() ) )
return;
odbinarydata data;
data.resize( safe_cast<unsigned int>( pstreambuf->length() ) );
pstreambuf->seek( 0, oddb::kseekfromstart );
pstreambuf->getbytes( data.asarrayptr(), safe_cast<odint32>( pstreambuf->length() ) );
brep.set( (const char*)data.asarrayptr() );
if( brep.isvalid() )
bft.setbrep( brep );
}
has error at red line,
because possible to destroy other memory spaces, so cannot read.
how should i do?
set() expects not char* pointing to sat data but pointer to acis file object.
btw, having pointer to 3dsolid you can get brep directly from it:
code:
odbrbrep br;
p3dsolid->brep(br);
see odbrex sample from examples folder.
sergey slezkin
thank you very much.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)