|
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 |
|