![]() |
【转帖】macro for sheetmetal flat pattern
macro for sheetmetal flat pattern
i am new to macros in sw and was trying to make one that would take a part that is intended to be sheetmetal and make it a sheetmetal part, and add the flat pattern as a derived configuration. this would be done once the part is opened an on my screen. attached is one i recorded for a particular part but it only works on that part. how can i make it a general macro that will work on all parts? edited: 08/18/2008 at 12:01 pm by kevin harms recorded macros will always use the selection manager heavily and selectbyid2 which is recorded to select something by its name. since the name of the flat pattern feature could always be different, it doesn't work. however, you can traverse all features in the model and find which one is the flat pattern with the following macro. i've added the unsuppress call as well. ' sub main() dim swapp as sldworks.sldworks set swapp = application.sldworks dim model as sldworks.modeldoc2 set model = swapp.activedoc dim features as variant features = model.featuremanager.getfeatures(true) dim feat as sldworks.feature dim i as integer for i = 0 to ubound(features) set feat = features(i) if feat.gettypename2 = "flatpattern" then feat.select2 false, -1 model.editunsuppress end if next end sub '----------------------- mike spens "automating solidworks using macros" leap frog leap pad x64 quick |
所有的时间均为北京时间。 现在的时间是 04:31 AM. |