几何尺寸与公差论坛------致力于产品几何量公差标准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-07, 03:19 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】sat Data Units Question

sat data units question
sat data units question
the attached dwg file contains a 3dsolid which is, according to autocad, approximately 4 inches x 4 inches square. when i output the .sat file from autocad, i get an sat file which has the same dimensions. when i use dwgdirect and either 1) extract the sat data using a function such as odgetsatfromproxy() or 2) use odamfcapp to view the file's data, the sat data is approximately 4 mm x 4 mm square. i can verify this by looking at the sat data. the header of the sat file reports '1' as the "number of millimeters represented by each unit in model".
has anyone seen this problem and is there anything i can do about it to see that the correct units get put in the sat file? i'm using release 1.13.02.
thanks in advance,
pete rimkus
attached files
hi,
measurement database variable can help you with drawing units (0 inch\1 mm).
odgetsatfromproxy() or mfcapp return internal sat stored in solid. i checked that 3dsolid in your file has next header
1 9.9999999999999995e-007 1e-010 .
if you call acisout command, autocad change header to
25.399999999999999 9.9999999999999995e-007 1e-010
and store in sat. also i saw that if i call saveas, autocad change internal sat header to 25.4, but acisin command ignore this fields there are no differences between drawing of two equal sat file with 1 and 25.4 in header. it will 4x4 inch or 4x4 mm in metric system.
odgetsatfromproxy() or mfcapp doesn't apply 25.4 in imperial drawing
i am not sure that it is bug, it is autocad acisout command extension possibly.
you cannot get/change 1 to 25.4 with 1.13 toolkit, only by parsing the sat string.
alexander,
thanks for the response. to me this seems odd, but it looks like i will have to modify the 1st line of the sat string myself.
i will post my results.
thanks again,
pete rimkus
it looks do-able for solids saved as proxies, since with odgetsatfromproxy() i have access to the sat file character data. it's not easy, but it's possible.
i don't see a similar way to handle this for 3dsolids. i guess my workaround would be to let oddb3dsolid::acisout() write out the (potentially) incorrect units and i would have to edit the .sat file after this.
apparently there is really not a good way of handling this, and i would consider it a bug in dwgdirect.
you can edit it in memory for 3dsolid
odstreambufptr pout = odmemorystream::createnew();
passurf->acisout(pout, kaftypeascii|kaftypeindexed|kafverany);
pout->rewind();
and save it to file after
odwrfilebuf infile(" *** ");
pout.copydatato(infile, 0, end);
we are about to 1.13.5. i have added units functionality to oddbbody::acisout and to modelergeometry interface.
ok - let's see how that works. i'm looking forward to trying it. thanks
i downloaded 1.13.05 from the ftp site and i see that setmmperunit() and getmmperunit() have been added to odmodelergeometry. can i get a brief description of these to see if they solve my sat file 'units' problem?
thanks in advance,
pete
setmmperunit used in
odresult odmodelergeometrycreator::createsat(const oddbentityptrarray &in, ...
and in
static odresult oddbbody::acisout
units will be applied automaticaly if &in has dbr objects.
also you can use code like
code:
if (pdbforunits)
{
oddb::measurementvalue units = pdbforunits->getmeasurement();
if (units == oddb::kenglish)
{
pout->setmmperunit(1.); //pout is odmodelergeometryptr
}
else // if (units == oddb::kmetric)
{
pout->setmmperunit(25.4);
}
alex,
that worked! i found i needed to convert 3dsolids, bodies, and regions to modelergeometry, but that was no big deal to do.
one change i had to make was to flip-flop the scale factors from what you had, as follows...
if (units == oddb::kenglish)
{
pout->setmmperunit(25.4);
}
else // if (units == oddb::kmetric)
{
pout->setmmperunit(1.0);
}
thanks again,
pete
thank you for your membership

how do we set the mm per unit when using
odmodelergeometrycreator::createsat(
const oddbentityptrarray &entities,
odstreambuf* pstreambuf,
aftypever typever,
bool standardsaveflag = true)
odmodelergeometry has a setmmperunit() function which specified the scale. i am not sure how to specify the scale using the function above. is it absolutely necessary to convert the entities to modeler geometry in order to specify scale?
deelip menezes
==========

hello,
createsat method uses pout->setmmperunit call to apply units selected in the database (like in code below). you also can scale the modeler geometry retuned from createsat.
btw : oddbentity has method transformby.

i must be understanding this wrong.
i am refferring to createsat() which uses oddbentityptrarray, not odarray<odmodelergeometryptr>
i have a bunch of oddbentity objects and want to use the createsat() functon, without having to convert them to odmodelergeometry. the createsat() function sets the mm per unit to -1 in the output sat file, which is a problem.
i can scale the individual oddbentity objects using transformby() but that is not the issue. even if i scale the objects, the output sat file will still have a mm per unit of -1.
my question is how do i set mm per unit for the oddbentityptrarray version of createsat()
deelip menezes
==========

it should work automaticaly, if input array containes database resident enitities (it willn't work if all entities are nondbr.). createsat(const oddbentityptrarray has next code :
oddbdatabase *pdbforunits = 0;
...
if (!pdbforunits && (*pentity)->isdbro())
pdbforunits = (*pentity)->database();
....
if (pdbforunits)
{
oddb::measurementvalue units = pdbforunits->getmeasurement();
if (units == oddb::kenglish)
{
poutfile->setmmperunit(1.);
}
else // if (units == oddb::kmetric)
{
poutfile->setmmperunit(25.399999999999999);
}
}
...
poutfile->out(pstreamout, typever, bstandardsaveflag);
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】meshproc and shellproc data yang686526 DirectDWG 0 2009-05-06 05:44 PM
【转帖】memory leak issue yang686526 DirectDWG 0 2009-05-06 05:37 PM
【转帖】export data in different units yang686526 DirectDWG 0 2009-05-05 10:23 AM
【转帖】beginner question - geometry data yang686526 DirectDWG 0 2009-05-04 04:39 PM
【转帖】asme美国机械工程师标准目录2 huangyhg American standards 5 2009-04-26 02:38 PM


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


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