几何尺寸与公差论坛

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

【转帖】need vb code for dimension override value

[复制链接]
发表于 2009-4-12 21:53:19 | 显示全部楼层 |阅读模式
need vb code for dimension override value
i am in need of some code that gets a specific dimension and sets the override value of that dimension to any number i choose.
here is all i could find:
dim instance as idisplaydimension
dim override as boolean
dim value as double
dim value as boolean
value = instance.setoverride(override, value)
this is probably easier than i am making it out to be lol. i don't know what to put to get d1@sketch3 to be an override value of 50. thank you for any help!
-solidworks 2009 sp1
--dell precision m6300-
---intel core2 duo t9300------------------------
----nvidia quadro fx 3600m - 4gb ram----------
hi,
this works for me. have a drawing as the active document and edit the select statement to name a dimension in a view.
dim swapp as sldworks.sldworks
dim part as modeldoc2
dim selmgr as selectionmgr
dim dispdim as displaydimension
dim theval as double
sub main()
set swapp = application.sldworks
set part = swapp.activedoc
set selmgr = part.selectionmanager
boolstatus = part.extension.selectbyid2("rd1@drawing view1", "dimension", 0, 0, 0, false, 0, nothing, 0)
set dispdim = selmgr.getselectedobject6(1, 0)
theval = (50 * 25.4) / 1000 'in meters
dispdim.setoverride true, theval
end sub
scott
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 14:16 , Processed in 0.034540 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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