几何尺寸与公差论坛------致力于产品几何量公差标准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, 10:29 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】solidworks wont run invisible

solidworks won't run invisible
i am using the following code in vb 2008 to output flat sheetmetal parts as dxf files. i would like to do it without solidworks being visible. am i missing something?
private sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.click
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc
dim stpath as string
dim part as sldworks.modeldoc2
dim longwarnings as long
dim boolstatus as boolean
stpath = "c:\test\"
swapp = createobject("sldworks.application")
swapp.usercontrol = false
swmodel = swapp.opendoc6(stpath & "mbc-3.sldasm", 2, 0, "default", 0, longwarnings)
swmodel.forcerebuild3(true)
part = swapp.opendoc6(stpath & "mbc-3-rearwall.sldprt", 1, 0, "default", 0, longwarnings)
part.extension.selectbyid2("flat-pattern1", "bodyfeature", 0, 0, 0, false, 0, nothing, 0)
boolstatus = part.exportflatpatternview(stpath & "dxf & pdf\" & stsize & " - mbc-3-rearwall.dxf", 0)
swapp.quitdoc("mbc-3-rearwall.sldprt")
swapp.quitdoc("mbc-3.sldasm")
swapp.quitdoc("mbc-3-layoutsketches.sldprt")
swapp.closealldocuments(false)
swapp.exitapp()
part = nothing
swmodel = nothing
swapp = nothing
end sub
danny brown
rcs
swapp.visible = false
i tried swapp.visible = false. it is still visible, i also tried swapp.usercontrol = false. none of these switches seem to work.
danny brown
rcs
i have found if i have a document open in sw's that isn't saved and it will not go to the background, or in some cases if there is anything open in sws it will not run in the background.
in both cases you need the
usercontrol = false
visable = false
to make it work correctly...
this is what i have right after setting swapp.it doesn't work. i am opening an assembly and then a part. i even tried to just open the assembly and closing it without doing anything else and it still shows visible. this is frustrating and i would appreciate any help i can get.
swapp = createobject("sldworks.application")
swapp.usercontrol = false
swapp.documentvisible(false, 1)
swapp.documentvisible(false, 2)
swapp.visible = false
danny brown
rcs
danny,
just a guess: could it be that you have several sw sessions running?
jorn bjarning
cswp
cad & plm consultant
sw2008 sp5 / sw2009 sp2
i thought that too, but i tried it only opening the assembly doing nothing and closing it. it still runs visible. i have a sketch layout that drives the assembly and i noticed since i change to a linked excel file that the sketch layout opens when i open the assembly. is that normal? could that be the problem?
danny brown
rcs
danny,
it does sound a little weird but without having seen it i am not able to say if it could be part of the explanation. is the sketch layout in a seperate part file or how is it organized?
jorn bjarning
cswp
cad & plm consultant
sw2008 sp5 / sw2009 sp2
the sketch layout.sldprt is the main component in the assembly and it also contains the linked design table. there are about 20 parts driven by the sketch layout (the flat parts being generated). i believe they call it a top down design.
danny brown
rcs
i am having the same problem as danny i am not able to open the parts invisble. would somebody have an example that they would be will to share that would maybe just open a part and do something simple to it save it and close it, to compare code and hopefully see what is missing ?
thanks.
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
danny and ben,
i assume you have already studied the example for sldworks::visible?
jorn bjarning
cswp
cad & plm consultant
sw2008 sp5 / sw2009 sp2
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】solidworks wont run invisible yang686526 SolidWorks二次开发 0 2009-04-12 07:40 PM
【转帖】run macro when saving yang686526 SolidWorks二次开发 0 2009-04-12 07:29 PM
i have this roblem, when i run this rogram listed bellow after it icks u the lane it huangyhg PC-DMIS 0 2009-04-06 07:39 PM
【转帖】feature run timer - c-dmis user forum.txt huangyhg PC-DMIS 0 2009-04-06 07:16 PM


所有的时间均为北京时间。 现在的时间是 12:01 PM.


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