2 Replies Latest reply on Apr 3, 2018 10:31 PM by Ben Richardson

    Macro, scan feature tree of assembly, rename parts

    Ben Richardson

      Ill first preface this post with the following: Ive never used macros. But its now getting to the point where im sick to death of wasting hours doing tedious work that could be done with macros.

       

      I have some assemblies that are imports of Inventor files, during this import its added a lot of unnecessary junk to the file names, which is giving me invalid paths stopping me from saving them into native solidworks files.

       

      I have looked at a few tutorials on creating macros and searched around for a macro that will do what I want, havent found anything yet but I would like to create my own macro so I can learn how to do this myself.

       

      An example filename:

      Copy of TK-380-DT-01-01.ipt^Copy of TK-380-DT-01.iam_Copy of TK-380-DT-00.iam_Copy of TK-380-BOD-00.iam_Copy of TK-380-ASY-00.iam_TK-380-ASY-00-1@TK-380-ASY-00

       

      As you can see lots of junk. What I would like to do in a nutshell:

      • Go through the feature tree and change each file in the following way
        • Delete first instance of "copy of" and delete anything after the . at ".ipt". In the case of the above part name it will reduce it down to "TK-380-DT-01-01"

       

      Is it possible to do this kind of commands in macros? If so where is a good place I can learn how to do these types of commands? Is it also possible to ask for user input during the running of a macro? (like choose a folder for example)

       

      Is there also somewhere I can get explanations on what things mean, for example Part.Extension.SelectByID2