几何尺寸与公差论坛

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

【转帖】make drawing from active documen

[复制链接]
发表于 2009-4-12 21:43:39 | 显示全部楼层 |阅读模式
make drawing from active document
i need code for the make drawing from assembly command, is this possible? thanks in advance.
adrian velazquez
cswp
cswp-smtl
solidworks x64 2009 sp3.0
nvidia quadro fx 570
hi,
here are two ways i have used to create drawings.
have the assembly or part as the active document.
scott
dim swapp as sldworks.sldworks
dim model as sldworks.modeldoc2
dim part as sldworks.modeldoc2
dim comppathname as string
dim drawview as sldworks.view
sub main()
set swapp = application.sldworks
set model = swapp.activedoc
'version 1
'run the actual solidworks commands********************************
swapp.runcommand swcommands_makedrawingfrompartassembly, "newdrawingfromassembly"
swapp.runcommand swcommands_standard3view, "add3view"
sendkeys "{enter}", 2
exit sub
'end of solidworks commands*********************************
'version 2----
'have full control over views and locations using a known template*******
'get path of assembly or part
comppathname = model.getpathname
'open new drawing with specified template
set part = swapp.newdrawing2(14, "f:\library\templates\universal d size drawing.drwdot", 4, 0, 0)
set part = swapp.activedoc
'add views
set drawview = part.createdrawviewfrommodelview2(comppathname, "*back", 0.25, 0.3, 0)
part.clearselection2 true
boolstatus = part.extension.selectbyid2("drawing view1", "drawingview", 0, 0, 0, false, 0, nothing, 0)
set drawview = part.createunfoldedviewat3(0.5, 0.3, 0, 0)
part.clearselection2 true
boolstatus = part.extension.selectbyid2("drawing view2", "drawingview", 0, 0, 0, false, 0, nothing, 0)
set drawview = part.createunfoldedviewat3(0.7, 0.3, 0, 0)
part.clearselection2 true
end sub
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 10:24 , Processed in 0.036110 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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