几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-04-13, 09:36 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】change a drawing views display state

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


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】can you modelize a drawing view yang686526 SolidWorks二次开发 0 2009-04-13 09:31 AM
【转帖】arget sheet drawing from excel yang686526 SolidWorks二次开发 0 2009-04-12 10:37 PM
【转帖】see what partassembly a drawing points to yang686526 SolidWorks二次开发 0 2009-04-12 10:19 PM
【转帖】how to save to dxf in active drawing file location yang686526 SolidWorks二次开发 0 2009-04-12 09:23 PM
【转帖】how to save to dxf in active drawing file location yang686526 SolidWorks二次开发 0 2009-04-12 06:38 PM


所有的时间均为北京时间。 现在的时间是 08:49 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多