找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1363|回复: 0

[教学]:用AcDbDistof()函数后要修改系统变量DBMOD,如何解决?

[复制链接]

已领礼包: 145个

财富等级: 日进斗金

发表于 2002-2-26 00:23:34 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
通过该教学,朋友们可以学到如何修改只读的系统变量DBMO,可以欺骗ACAD,告诉它图形并没有编辑修改过.

Acdbdistof() modifies the database (dbmod)  
ID    30563  
Applies to:    AutoCAD 2000

Date    6/22/2000  

This document is part of    Visual Lisp   AcDbDatabase   ObjectARX   System Variable     


Question
Whenever there is a call to acdbDisToF() the DBMOD variable is modified, even
though the drawing is not modified.  Why does this occur?
Answer
The implementation of ads_distof() used in AutoCAD R14 was changed in AutoCAD
2000.

In AutoCAD 2000, an AutoCAD variable does the conversion. After finishing the
conversion, it sets the variable back to the previous value, and the result of
the variable change is that DBMOD gets modified.

To solve this problem you can use these two new functions:

AcApDocument::pushDbmod()
AcApDocument::popDbmod()

pushDbmod() saves the current setting of DBMOD, and popDbmod() restores the
value. Between the two calls you can use functions that modify the database.
These functions should be used only to do the drawing initialization when a new
drawing is created, or when a drawing is opened.

Please note that calls to pushDbmod() must be paired with calls to popDbmod().

To solve the problem with acdbDisToF(), you can capsulate the call between the
new functions:
// Before using acdbDisToF() save the current DBMOD value.
curDoc()->pushDbmod();

// Do the conversion.
double value;
acdbDisToF("1.234", 2, &value);

acutPrintf("\nFloat value: %f", value);

// Restore the previous value of DBMOD.
curDoc()->popDbmod();
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-24 10:26 , Processed in 0.326736 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表