几何尺寸与公差论坛

 找回密码
 注册
查看: 597|回复: 0

【转帖】doc change event question

[复制链接]
发表于 2009-4-13 10:27:50 | 显示全部楼层 |阅读模式
doc change event question ?
here is the code in .net
what i want here is to close all forms if the currentdoc is a dwg and open forms if the currentdoc is a part or assembly
this function works fine except when i close all the documents, all forms are supposed to close because the statement "currentdoc is nothing"; howver, the forms are still open
thx for any help
chris
function sldworks_activemodeldocchangenotify() as integer
dim currentdoc as modeldoc2 = iswapp.activedoc
if currentdoc is nothing or currentdoc.gettype = swdocumenttypes_e.swdocdrawing then
closedforms()
else
openforms()
end if
end function
solidworks 2007 (office pro.) sp5.0
testing solidworks 2009 (pro) sp0.0
dell precision t3400
2 cpu (8500) 3.16 ghz, 3.25 gb of ram
window xp pro sp2
nvidia fx 570 6.14.11.6262
add a message box in the change function so you can tell when your code is running. i'm guessing it doesn't get called when the last document changes as it probably doesn't class it as a document change unless another document is becoming active
luke is right, you need to be sure the event is being triggered. perhaps closing all docs does not trigger the event.
you can also try using "debug.print" to send data to the immediate window. something like:
debug.print currentdoc.getpathname & " " & now
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-24 02:04 , Processed in 0.034969 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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