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

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   SolidWorks二次开发 (http://www.dimcax.com/hust/forumdisplay.php?f=111)
-   -   【转帖】drawing dimensions exported to excel or text file (http://www.dimcax.com/hust/showthread.php?t=4696)

yang686526 2009-04-12 08:43 PM

【转帖】drawing dimensions exported to excel or text file
 
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


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