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

regenerating associated hatches
regenerating associated hatches
the subject application converts (e.g. units change) an entire drawing, and successfully (with your help) converts non-associated hatch objects by converting the loop(s) and "evaluating the loop(s)".
how do i get the associated hatches to be regenerated using the newly converted entities to which is it associated?
i have tried delaying conversion of all hatches until after all other entities have been converted, and then "evaluating the loop" on all associated hatches. no luck. any help would be appreciated.
note: i am not viewing or displaying the converted file. so, a fix which will simply cause autocad to regenerate the hatch next time the drawing file is opened/loaded would be acceptable.
norm olsen
you may use exevalwatcher module - it does what you need.
or you may do it manually:
assuming that
oddbhatch* phatch - hatch to eval
oddbobjectidarray& assocobjids - associated objects
call
oddbhatchwatcherpeptr eval(phatch)->evaluate(phatch, assocobjids);
vladimir
i'm not the sharpest pencil in the box. i'm having difficulty understanding:
"call oddbhatchwatcherpeptr eval(phatch)->evaluate(phatch, assocobjids);"
oddbhatchwatcherpe has an evaluate function; i can understand that part. i don't understand the
"call oddbhatchwatcherpeptr eval(phatch)"
portion.
i don't see an "eval" function anywhere?
to what object does the "eval" function belong?
does "eval(phatch)" return a oddbhatchwatcherpeptr ?
how does one obtain a pointer to an oddbhatchwatcherpe object?
clearly, i'm missing something obvious here. any help wwould be greatly appreciated.
norm olsen
quote:
originally posted by olsennt
"call oddbhatchwatcherpeptr eval(phatch)->evaluate(phatch, assocobjids);"
sorry, for the unclear reply - 'eval' should be erased there (or statement split in two: cast && call)
the statement means - cast phatch to oddbhatchwatcherpeptr and call oddbhatchwatcherpe::eval
make sure exevalwatcher module is available.
vladimir

hello, it's me again. please understand that despite several hours of searching the help file, andstudying the example, i have no clue as to what an extension protocol is, how they work, and (most omportantly) how to use them. if that makes me stupid, i plead guilty.
i have implemented the exevalwatcher module. how does one use it?
1> does it have to be registered (the help file says it is registered by the initialization)?
2> do you have to close it?
i have arranged for my application to do hatches after everything else is done. i have tried the following code to get the associated hatches evaluated; but none of several different methods of casting seem to work. some compile, but throw a run-time error.
bool tuacadconverter::convert (oddbhatch& object)
{
bool ok (true);
if (object.associative ())
{
oddbobjectidarray dbobjids;
object.getassocobjids(dbobjids);
oddbhatchwatcherpeptr phatchpe = (oddbhatchwatcherpeptr)(&object);
phatchpe->evaluate (&object,dbobjids);
ok = true;
}
else
{
// this stuff works, thanks for your help!!
}
}
it would be most helpful if i had a clue as to what protocol extensions are and how they work. i could probably figure this out if i did. the help file simply makes a very vague statement, and then offers a very confusing example that i can't figure out.
thanks for putting up with my stupidity.
norm olsen
you can find example of using/registering/unregistering protocol extensions in odreadex sample.
in this sample the protocol extension is used for dumping entities.
sergey slezkin
and the answer is . . .
thanks for all your help. i'm not a c++ guru, so it took me a while; but i have finally figured this out.
for others who may encounter this problem:
the help file is somewhat misleading in that the oddbhatchwatcherpe object is not registered by the odinitialize function. it is only registered by the exevalwatcher module. the exevalwatcher is one of those things that needs to be loaded using the dynamic loader business, and this means your application is dependent upon an external .dll (renamed to drx, but still a .dll). thus, using this technique you become subject to dll hell issues.
i have found that you can bypass all of that by registering the oddbhatchwatcherpe object directly in your application. this requires declaring an object using the odstaticrxobject template, defining an instance of this object, and then registering the type and the instance with the target entity, oddbhatch in this case. that is:
odstaticrxobject<oddbhatchwatcherpe> kuhatchwatcher;
oddbhatch::desc()->addx(oddbevalwatcherpe::desc(),&kuhatchwatcher) ;
once this is accomplished, the casting referenced in the previous posts will work and you can get access to the oddbhatchwatcherpe::evaluate () function. this function works fabulously.
best to do this registering business immediately after the odinitialize () call to maintain multi-thread safety, i would presume.
note that the standard distribution includes pre-built exevalwatchers modules for vc8 and vc2003 only. if you're using something else, you'll have to figure out how to build one of these things yourself. the above is a simple way to avoid all of the problems associated with this, providing your application is capable of determining on its own which hatches need to be updated (as my application is).
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】how to build hatches yang686526 DirectDWG 0 2009-05-06 02:18 PM
【转帖】hatching entities yang686526 DirectDWG 0 2009-05-05 12:01 PM
【转帖】hatches again yang686526 DirectDWG 0 2009-05-05 11:59 AM
【转帖】gradient in hatches yang686526 DirectDWG 0 2009-05-05 11:39 AM
【转帖】standard drafting symbols or hatches yang686526 American standards 0 2009-05-04 10:27 AM


所有的时间均为北京时间。 现在的时间是 05:09 PM.


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