几何尺寸与公差论坛

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

【转帖】converting dimensions

[复制链接]
发表于 2009-4-13 09:53:30 | 显示全部楼层 |阅读模式
converting dimensions
in
euans,
the simplest way to do that is to switch the sheet format.
so... you only want to increment/decrement dimensions that are not set to use document precision, right?   
-handleman, cswp (the new, easy test)
in my case i select a bunch of dimensions and press alt+1 to set them to one decimal, alt+2 for two decimals, alt+3 for three decimals or alt+0 for no decimals. obviously i have macros associated with these keys. is that what you are looking for.
another scenario would be for you to preselect a number of dimensions and press (as an example) alt+d to bring up a window with radio buttons for 0, 1, 2 or 3 decimals which you can select.

give this one a try.  run it after you run the other macro you use.  it will increment or decrement precision on all dimensions that are not set to the document precision.
code
dim swapp as sldworks.sldworks
dim swdoc as sldworks.modeldoc2
dim swdwg as sldworks.drawingdoc
dim swview as sldworks.view
dim swdispdim as sldworks.displaydimension
dim killflag as integer
dim smsg as string
sub incdecprecision()
set swapp = application.sldworks
set swdoc = swapp.activedoc
if swdoc.gettype <> swdocdrawing then
    msgbox "this macro only works for drawing files."
    exit sub
end if
smsg = "click ""yes"" to increment, ""no"" to decrement, or ""cancel"" to quit."
killflag = msgbox(smsg, vbyesnocancel, "dimension precision +/-")
if killflag = vbcancel then
    exit sub
end if
set swdwg = swdoc
set swview = swdwg.getfirstview
while not (swview is nothing)
    set swdispdim = swview.getfirstdisplaydimension5
    while not swdispdim is nothing
        if not (swprecisionfollowsdocumentsetting = swdispdim.getprimaryprecision2) then
            if vbyes = killflag then
                swdispdim.setprecision2 swdispdim.getprimaryprecision2 + 1, -1, -1, -1
            else
                swdispdim.setprecision2 swdispdim.getprimaryprecision2 - 1, -1, -1, -1
            end if
        end if
        set swdispdim = swdispdim.getnext5
    wend
    set swview = swview.getnextview
wend
end sub
-handleman, cswp (the new, easy test)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-24 09:31 , Processed in 0.035491 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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