几何尺寸与公差论坛

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

【转帖】drawing dimensions exported to excel or text file

[复制链接]
发表于 2009-4-12 20:43:06 | 显示全部楼层 |阅读模式
drawing dimensions exported to excel or text file
anyone have an existing macro or code i could use to accomplish this?
also, is there any way to get the gd&t associated with each dimension as well?
thanks,
don
option explicit
sub main()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim swdraw as sldworks.drawingdoc
dim swview as sldworks.view
dim swdispdim as sldworks.displaydimension
dim swdim as sldworks.dimension
dim swann as sldworks.annotation
dim oxl as excel.application
dim owb as excel.workbook
dim ows as excel.worksheet
set oxl = new excel.application
set owb = oxl.workbooks.add
set ows = owb.worksheets(1)
dim lrow as long
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swdraw = swmodel
set swview = swdraw.getfirstview
do while not swview is nothing
set swdispdim = swview.getfirstdisplaydimension5
do while not swdispdim is nothing
set swann = swdispdim.getannotation
set swdim = swdispdim.getdimension
lrow = lrow + 1
ows.cells(lrow, 1).value = swview.name
ows.cells(lrow, 2).value = swann.getname
ows.cells(lrow, 3).value = swdim.fullname
ows.cells(lrow, 4).value = swdim.name
ows.cells(lrow, 5).value = swdim.getsystemvalue2("")
set swdispdim = swdispdim.getnext3
loop
set swview = swview.getnextview
loop
oxl.visible = true
end sub
do'n forget add reference to microsoft excel
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 10:05 , Processed in 0.034551 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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