几何尺寸与公差论坛

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

【转帖】selection filters are turned off after inserting bom

[复制链接]
发表于 2009-4-13 14:12:15 | 显示全部楼层 |阅读模式
selection filters are turned off after inserting bom
all of the selection filters are turned off after inserting the bom. i can't seam to get it turned back on. has anyone else seen this problem? if i manualy insert the bom everything is fine.
thanks,
set swapp = application.sldworks
set part = swapp.activedoc
set selmgr = part.selectionmanager
boolstatus = part.activateview("drawing view1")
boolstatus = part.extension.selectbyid2("drawing view1", "drawingview", 0, 0, 0, false, 0, nothing, 0)
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swselmgr = swmodel.selectionmanager
set swfeatmgr = swmodel.featuremanager
' select view
set swview = swselmgr.getselectedobject6(1, 0)
anchortype = swconst.swbomconfigurationanchortype_e.swbomconfigurationanchor_topright
bomtype = swconst.swbomtype_e.swbomtype_toplevelonly
configuration = ""
tabletemplate = "t:\templates\boms\part_single_item.sldbomtbt"
' insert bom table
set swbomann = swview.insertbomtable2(true, 0.4, 0.3, anchortype, bomtype, configuration, tabletemplate)
for one you define part and swmodel, and swselmgr and selmgr. you also redeclare swapp, so cleaning that up and doing this works fine for me:
dim swapp as sldworks.sldworks
dim swmodel as drawingdoc
dim selmgr as selectionmgr
dim swbomann as bomtableannotation
sub main()
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swselmgr = swmodel.selectionmanager
set swfeatmgr = swmodel.featuremanager
boolstatus = swmodel.activateview("drawing view1")
boolstatus = swmodel.extension.selectbyid2("drawing view1", "drawingview", 0, 0, 0, false, 0, nothing, 0)
' select view
set swview = swselmgr.getselectedobject6(1, 0)
anchortype = swconst.swbomconfigurationanchortype_e.swbomconfigurationanchor_topright
luke, i get the same results with your code. attached is before and after i ran the macro. you can see the filters are all turned off after the bom is inserted.
any other ideas?
thanks.
click for full image
they are not turned off, they are disabled, probably because you have the bom still selected and you are in 2007.
try swmodel.clearselection2 true after the insert
actually were still using 2006. was this a bug in 2006 and 2007? the swmodel.clearselection2 true did nothing.
other ideas?
thanks
danl
once you have run the macro, manually click an empty part of the drawing sheet
yep tried that.
and... did it enable the selection once you clicked it?
basically try to manually enable the selection filter again after running the macro and let me know how you managed it, then we can do that but programmatically
no it did not enable the filters. i have not been able to re-enable them. if i insert some dimensions i get some filters back, but as soon as i'm done there all disabled again. i'm stumped.
danl
sounds either like a bug in sw 06 or your code does more than just insert a bom and locks the document in an edible state of some form, which sounds exactly like what it is doing because selection filters are disabled in some edible states. post your full code and i will take a look
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 05:40 , Processed in 0.036801 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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