几何尺寸与公差论坛

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

【转帖】get drawingview properties

[复制链接]
发表于 2009-4-13 11:01:23 | 显示全部楼层 |阅读模式
get drawingview properties
i have a drawing document open. the drawing has multiple sheets. on sheet1, i have the drawing view selected. this is a sheet metal flat. how can i extract the model name of the part in the view? i have tried some of the examples and can't get them to work. i am looking for a vba solution/idea this time. this is going to be a simple macro.
any help is appreciated!
tony szuta
cswa, cswp, cswp-smtl
getreferencedmodelname
view.getreferencedmodelname() works nicely.
kevin kenny, cswp
sw 2009 sp3.0
hp xw4300
answer got it.
sub main()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim swselmgr as sldworks.selectionmgr
dim swview as sldworks.view
dim swdrawmodel as sldworks.modeldoc2
dim sheet as object
dim x as integer
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swselmgr = swmodel.selectionmanager
set swview = swselmgr.getselectedobject5(1)
set swdrawmodel = swview.referenceddocument
set sheet = swapp.activedoc.getcurrentsheet
smodelname = swview.getreferencedmodelname
x = len(swdrawmodel.gettitle)
sheet.setname left(swdrawmodel.gettitle, x - 7)
end sub
thanks guys!
tony szuta
cswa, cswp, cswp-smtl
intel core2 quad (q6600 @ 2.40 ghz)
nvidia quadro fx 4600 sdi
solidworks 2008 sp 4.0 (x32 & x64)
solidworks 2009 sp 2.0 (x32 & x64)
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 17:55 , Processed in 0.034787 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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