几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-04-12, 07:48 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】he object invoked has disconnected from its clients

?the object invoked has disconnected from its clients?.
we have a add-in module build with visual basic .net 2008, and are using it with sw 2009 64bit on winxp 64 bit.
our users keep getting the "the object invoked has disconnected from its clients?. (?exception from ?hresult?: ?0?x?80010108 ?(?rpc_e_disconnected?))" error.
it is hard to pin down because it does not occur all the time and does not occur in the same spot in the code. it appears to happen randomly.
is there any way to prevent this from happening?
is there any way to detect this situation?
is there any way to recover once this happens in the application?
below is some example code that sometimes produces the error(not always).
public function renamecomp(byval oldname as string, byval newname as string, optional byval swapplication as sldworks.sldworks = nothing) as string
try
if isnothing(swapplication) = true then swapplication = swapp
'select the comp by its old name
dim swmodel as sldworks.modeldoc2
swmodel = swapp.iactivedoc2
if swmodel is nothing then
throw new exception("active document is nothing. cannot select cabinet")
end if
dim cname(0) as string
cname(0) = oldname
selectcomponents(cname, false, swapp)
dim selmgr as sldworks.selectionmgr
selmgr = swmodel.selectionmanager()
dim selcomp as sldworks.component2 = selmgr.getselectedobject6(1, -1)
if selcomp is nothing then
dim this as new exception("could not select cabinet")
throw this
end if
'change the name to the new name
swapp.setuserpreferencetoggle(swconst.swuserpreferencetoggle_e.swextrefupdatecompnames, false)
selcomp.name2 = newname
return selcomp.name2
catch ex as exception
throw new exception("failed renamecomp. oldname[" & oldname & "] newname[" & newname & "]" & ex.message)
end try
end function
what line does the error occur at?
the rpc disconnected error means that the pointer to the com object is no longer valid, usually a modeldoc2 object that no longer exists (model closed) or a solidworks variable that has been lost (solidworks closed or error in solidworks com functionality, try re-installing sw).
i'm not sure if it occurs on any one line or not, since i can't replicate the problem on demand.
the problem occurs on all our workstations, and all those were just recently built, so i don't think a reinstall would help.
i'm not familiar with the inner workings of com. are there any 'gotchas' or things i could check my code for to prevent com related problems?
if you want to email me your code i will find the bug for you. contact@angelsix.com
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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



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


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