查看单个帖子
旧 2009-04-12, 09:53 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】need vb code for dimension override value

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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)