iCAx开思网

标题: 宏打开零件不能显示出来 [打印本页]

作者: api163    时间: 2015-1-20 11:00
标题: 宏打开零件不能显示出来
'当同名工程图处于打开状态时宏打开零件但不能显示出来
'大家看一下下面代码,当同名工程图没有打开时,是可以打开零件并显示出来。
'但当同名的工程图已打开时,就怎么也打不开,这里面是不是还有什么代码要添加的?
Option Explicit
Sub main()

    Dim swApp   As SldWorks.SldWorks
    Dim fileerror   As Long
    Dim filewarning As Long

    Dim Part  As SldWorks.ModelDoc2
    Set swApp = Application.SldWorks

    Set Part = swApp.OpenDoc6("E:\ChenPing\shang3\PRT20150119-02.SLDPRT", swDocPART, swOpenDocOptions_Silent, "", fileerror, filewarning)

End Sub




作者: api163    时间: 2015-1-21 09:55

    '如果已在内存中,但未显示出来,open6结果是 filewarning会=swFileLoadWarning_AlreadyOpen,就要用下两语句把它显示出来。
    Set swModelDoc = swApp.ActivateDoc("E:\ChenPing\shang3\PRT20150119-02.SLDPRT")
    swModelDoc.Visible = True




欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3