8 Replies Latest reply on Aug 3, 2016 5:23 AM by Towab Muhammad Yusuf

    Drawing Custom Properties Find & Replace

    Ashley Turk

      Hi,

       

      I'm new to using macro's / API in solidworks and I've not done any coding for many years.

       

      We have about 600 drawings which have an incorrect digit within the FileName & CustomProperties.  We're tried modifying some code which we found on this forum (https://forum.solidworks.com/thread/55477#291437).  But it seems to have rebuild even before we started chaning it on "Set swModelDocExt = swModel.Extension", is this becuase we're trying to use swModel on a slddrw? Or because things have changed on soldiworks in the last 4 years?

       

      We are using Premium 2015 SP5

       

      Custom Properties

      We're trying to create a macro to find (“-1-“) and replace
      (“-X-“) within the customer properties (GE_DrawingNumber & GE_Parent) of a
      drawing set.

      Example

                     
      Before Macro

           GE_DrawingNumber = “-1-01-017”

           GE_Parent = “-1-01-005”

                    
      After Marco

           GE_DrawingNumber = “-X-01-017”

           GE_Parent = “-X-01-005”

       

      The 017 & 005 will change from drawing to drawing.

       

      I've attached my attemp at moifying the above code but I am struggling as I can't run the base code.  Do I need to install anything extra to run macros / API
      properly

       

      Files Name

       

      We need to update all the drawings to find (“-1-“) and
      replace (“-X-“) within the file name of our drawing set, then save as the new
      number.

                     
      Before Macro

           Files Name = “SSP41848-1-01-017”

                     
      After Macro

           Files Name = “SSP41848-X-01-017”

       

      The 017 will change from drawing to drawing.

       

      We're currently not looked into this one.

       

      Any assistance you could offer would be greatly appreciated.