几何尺寸与公差论坛------致力于产品几何量公差标准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-12, 10:11 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】rel revision macro

rel revision macro
i recorded a macro to do the following.
add a revision
change revision to "rel"
in describtion type "released"
in approved type "mdj"
this macro does all of that but it also changes the row height. how would i write a macro that does all of the above and doesn't change the row height.
dim swapp as object
dim part as object
dim boolstatus as boolean
dim longstatus as long, longwarnings as long
sub main()
set swapp = application.sldworks
set part = swapp.activedoc
dim mymodelview as object
set mymodelview = part.activeview
mymodelview.framestate = swwindowstate_e.swwindowmaximized
boolstatus = part.extension.selectbyid2("detailitem351@sheet1", "revisiontable", 0.3065965048768, 0.2655622007571, 0, false, 0, nothing, 0)
dim currentsheet as object
dim myrevisiontable as object
set currentsheet = part.getcurrentsheet()
set myrevisiontable = currentsheet.revisiontable
longstatus = myrevisiontable.addrevision("")
boolstatus = part.extension.selectbyid2("detailitem351@sheet1", "revisiontable", 0.2982784283223, 0.2616111143937, 0, false, 0, nothing, 0)
dim mytable as object
set mytable = part.selectionmanager.getselectedobject5(1)
mytable.text(2, 0) = "rel"
boolstatus = part.extension.selectbyid2("detailitem351@sheet1", "revisiontable", 0.3203213311917, 0.2620270182214, 0, false, 0, nothing, 0)
boolstatus = part.extension.selectbyid2("detailitem351@sheet1", "revisiontable", 0.3203213311917, 0.2620270182214, 0, false, 0, nothing, 0)
set mytable = part.selectionmanager.getselectedobject5(1)
mytable.text(2, 1) = "released"
boolstatus = part.extension.selectbyid2("detailitem351@sheet1", "revisiontable", 0.404333904392, 0.2614031624799, 0, false, 0, nothing, 0)
set mytable = part.selectionmanager.getselectedobject5(1)
mytable.text(2, 3) = "mdj"
end sub
edited: 02/25/2009 at 05:26 pm by matt jacobs
click for full image
'try these codes, these work fine on my machine. also have a look at
i have experienced this before. i use tableannotation.getrowheight to get the original value before changes. then, after the changes, i use tableannotation.setrowheight to set it back.
kevin
kevin kenny, cswp
sw 2009 sp3.0
hp xw4300
thanks for the input guys,
deepak, i tried both of the codes you posted and they both increase the row height.
kevin, can you give some detail on the tableannotation.getrowheight, and tableannotation.setrowheight. i'm very green at writing macro, i looked the help and i still don't get it. could you give an example.
thanks again for the help
dim swapp as sldworks.sldworks
dim part as modeldoc2
dim currentsheet as sheet
dim myrevisiontable as revisiontableannotation
dim rowheight as double
sub main()
set swapp = application.sldworks
set part = swapp.activedoc
set currentsheet = part.getcurrentsheet()
set myrevisiontable = currentsheet.revisiontable
rowheight = myrevisiontable.getrowheight
myrevisiontable.addrevision ""
myrevisiontable.text(2, 0) = "rel"
myrevisiontable.text(2, 1) = "released"
myrevisiontable.text(2, 3) = "mdj"
myrevisiontable.setrowheight 2, rowheight, swtablerowcolchange_tablesizecanchange
end sub
luke,
i tried your code and it gave me a run time error 449 on rowheight = myrevisiontable.getrowheight
rowheight = myrevisiontable.getrowheight 2
answer thanks for the help guys,
i ended up just manually setting the value. i couldn't done it with out you help!
dim swapp as sldworks.sldworks
dim part as modeldoc2
dim currentsheet as sheet
dim myrevisiontable as revisiontableannotation
dim rowheight as double
sub main()
set swapp = application.sldworks
set part = swapp.activedoc
set currentsheet = part.getcurrentsheet()
set myrevisiontable = currentsheet.revisiontable
myrevisiontable.addrevision ""
myrevisiontable.text(2, 0) = "rel"
myrevisiontable.text(2, 1) = "released"
myrevisiontable.text(2, 3) = "mdj"
myrevisiontable.setrowheight 2, 0.00381, swtablerowcolchange_tablesizecanchange
end sub
quick
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】macro for inserting and mating a new part in an assembly yang686526 SolidWorks二次开发 0 2009-04-12 09:38 PM
【转帖】how do i slow a macro down yang686526 SolidWorks二次开发 0 2009-04-12 09:10 PM
【转帖】copy an existent sketch into a macro yang686526 SolidWorks二次开发 0 2009-04-12 08:31 PM
【转帖】batch w user input macro yang686526 SolidWorks二次开发 0 2009-04-12 08:17 PM


所有的时间均为北京时间。 现在的时间是 02:53 AM.


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