几何尺寸与公差论坛

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

【转帖】hide all dimensions

[复制链接]
发表于 2009-4-12 21:06:22 | 显示全部楼层 |阅读模式
hide all dimensions
hi,
is it possible to hide all dimensions in a sketch by using a macro?
feroz mahomed
windows xp professional sp2
sworks 2009 sp2
nvidia quadro fx1500
try imodeldoc2::hidedimension for your macros
here attached a help example using annotation visibility.
solidworks api help
show dimensions in drawing sheet example (vb6)
this example shows how to show all of the dimensions in a drawing sheet whether or not the dimensions are hidden or shown.
'--------
'
' problem:
' in the solidworks user interface, you can hide a dimension in a
' drawing view through the shortcut menu. the corresponding
' api to do this is imodeldoc2::hidedimension.
'
' however, in the use interface, there is no ready to show
' a hidden dimension because it must be selected.
'
' this example shows how to traverse all display dimensions
' on a drawing sheet and show them.
'
' preconditions: drawing is open and dimensions are marked for drawing.
'
' postconditions: none
'
' note: dimension is not shown if it is on a layer that
' is hidden.
'
'--------
option explicit
public enum swannotationvisibilitystate_e
swannotationvisibilityunknown = 0
swannotationvisible = 1
swannotationhalfhidden = 2
swannotationhidden = 3
end enum
public enum swannotationtype_e
swcthread = 1
swdatumtag = 2
swdatumtargetsym = 3
swdisplaydimension = 4
swgtol = 5
swnote = 6
swsfsymbol = 7
swweldsymbol = 8
swcustomsymbol = 9
swdowelsym = 10
swleader = 11
swblock = 12
swcentermarksym = 13
swtableannotation = 14
swcenterline = 15
swdatumorigin = 16
end enum
sub processdrawing _
( _
swapp as sldworks.sldworks, _
swmodel as sldworks.modeldoc2, _
swview as sldworks.view _
)
dim swann as sldworks.annotation
debug.print " " & swview.name
set swann = swview.getfirstannotation2
do while not nothing is swann
if swdisplaydimension = swann.gettype then
debug.print " " & swann.getname
swann.visible = swannotationvisible
end if
set swann = swann.getnext2
loop
end sub
sub main()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim swdraw as sldworks.drawingdoc
dim swview as sldworks.view
dim bret as boolean
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swdraw = swmodel
debug.print "file = " & swmodel.getpathname
set swview = swdraw.getfirstview
do while not nothing is swview
processdrawing swapp, swdraw, swview
set swview = swview.getnextview
loop
swmodel.graphicsredraw2
end sub
'----------------------
vb2008.net express
c#,asp.net,xml
solidworks 2009,driveworks
sql server 2005 express
mastercam x2,fanuc
ansys,cosmos
------------
edmonton,ab
canada
t6j 2n8
qinghai,
i was looking for a macro to hide dimensions in a sketch not a drawing.
thank you
feroz mahomed
windows xp professional sp2
sworks 2009 sp2
nvidia quadro fx1500
please define your question a bit further. what result do you want? do you want the same result as right-click on annotations folder in the tree and un-check "show feature dimensions?" or do you want to have "show feature dimensions" checked but hide all dimensions for a certain sketch? note that i can't find a way to un-hide them after they've been hidden.
i'll get you eh steve, if it's the last thing i dooooo!
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 11:21 , Processed in 0.034799 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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