几何尺寸与公差论坛

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

【转帖】change a drawing views display state

[复制链接]
发表于 2009-4-13 09:36:39 | 显示全部楼层 |阅读模式
change a drawing view's display state
i'm trying to automate the creation of some drawings, but i've come to a roadblock. i can't seem to find the property that controls the display state shown in a drawing view. i've searched the api help but couldn't find what i wanted. if anyone knows what property can do this or whether or not it can be done at all i'd be very gratefull.
thanks for your help
~craig
would setdisplaymode3 work for you? as long as you access the view in the drawing, i assume this should work.
tony szuta
cswa, cswp, cswp-smtl
here is some quick code that worked for me. hope it helps.
make sure that the drawing view is selected before running this code. a view must be selected or it will bomb.
vba
public enum swdisplaymode_e
swwireframe = 0
swhidden_greyed = 1
swhidden = 2
swshaded = 3
swfaceted_wireframe = 4
swfaceted_hidden_greyed = 5
swfaceted_hidden = 6
end enum
sub main()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim bret as boolean
dim swselmgr as sldworks.selectionmgr
dim swview as sldworks.view
dim swdraw as sldworks.drawingdoc
dim swsheet as sldworks.sheet
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swdraw = swmodel
set swsheet = swdraw.getcurrentsheet
debug.print " " & swsheet.getname
set swselmgr = swmodel.selectionmanager
set swview = swselmgr.getselectedobject5(1)
bret = swview.setdisplaymode3(false, swshaded, false, true)
end sub
tony szuta
cswa, cswp, cswp-smtl
thanks for your input tony,
i don't think setdisplaymode3 will work for me. i'm trying to change the display state of the view, and setdisplaymode3 seems to only deal with the display style. though i'm going to have to use this later in the macro, so thanks for bringing it up.
~craig
sorry i misunderstood your question craig. i will mess around and see what i can come up with.
tony szuta
cswa, cswp, cswp-smtl
hi
are you trying to control whether the view is suppressed or not?
if so try view.suppressstate = true/false.
regards
tom mulder.
compac nw8440
intel core 2 t7400 2.16ghz
ati mobility firegl v5200
solidworks 2008 sp4.0
windows xp professional sp2
craig,
i messed around for a while now and was unable to get anything to work. the api has an example of changing the models display state, but i can't seem to find anything on how to change the display state of a model in a drawing view. i'll keep at it.
thomas,
craig is trying to change the display state in a drawing view. a display state is kind of like a configuration, but this deals with the "view" of the model.
tony szuta
cswa, cswp, cswp-smtl
what you need to do is create the selection string to select the component that you wish to hide, concated with the drawing view name, and then select it using selectbyid2, and call hidecomponent2. for example:
boolstatus = part.extension.selectbyid2("12rc-100-1@drawing view9/12rc-102-1@12rc-100", "component", 0, 0, 0, false, 0, nothing, 0)
part.hidecomponent2
hi thanks tony and also my post didn't make any sense because i got the syntax wrong anyway... should have been view.suppressstate = 0, 1, 2. however not useful anyway as it does not solve the above problem.
regards
tom mulder.
compac nw8440
intel core 2 t7400 2.16ghz
ati mobility firegl v5200
solidworks 2008 sp4.0
windows xp professional sp2
edited: 08/09/2008 at 02:59 am by thomas mulder
my last post gives you the answer, that is the only way to select a model of a view, and from there you can change anything about it
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-24 07:51 , Processed in 0.037783 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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