几何尺寸与公差论坛

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

【转帖】not able to get active document using api

[复制链接]
发表于 2009-4-13 13:10:23 | 显示全部楼层 |阅读模式
not able to get active document using api
i have made an application in vc++. in this application you can choose a part or assembly in a browse dialog and then it will launch solidworks(using shellexecute) with the part or assembly chosen.
then i get an instance pointer of solidworks using 揅ocreateinstance?
then i get the active document using 揼et_iactivedoc2?

now here is where the issue comes in case i loaded an assembly.
if it is a part then i am able to get the active document pointer instantly. but incase it was a large assembly that requires time loading all the parts that comprise it; then i get a null in the active document pointer.

on the other hand if i introduce some 揹elay?using sleep, it gives solidworks enough time to load the assembly; and then i can get the active document using get_iactivedoc2.

this is fixed only because i entered some delay. is  there any cleaner or more efficient way to get the active document from solidworks only when it is fully loaded and not before? or is there any event by which i can know that the active document is fully loaded in solidworks? or that solidworks is ready for using the api on it to get information ?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 13:42 , Processed in 0.033998 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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