2 Replies Latest reply on Feb 24, 2016 8:14 AM by Luke Senerchia

    Macro creation; Pulling word document when adding a part to a certain type of assembly

    Luke Senerchia

      Hello all,

       

      I am trying to figure out how to go about creating a macro. What I would like the macro to do is...

       

      When a part is being added to an assembly of a table or a cart, I want the word document of the part specifications/part specific instructions to pop up after the part has been placed into the assembly.

       

      I think that all of the word documents will likely be stored either in one large folder, or with the corresponding part (whichever this community thinks would be easier)

       

      The main questions I have right now are...

       

      1.) How will Solidworks will know if the assembly the part is being added to is a table or cart assembly? (Should I make a specific template for a table or cart assembly?)

      2.) How will the word document, which will have a different name than the part number, will know to pop up. (is there a form I can edit in the properties of the word doc? or a field in the document itself that Solidworks will be able to read to tie it to this part number?)

       

      If anyone has any kind of idea of how I may be able to achieve this, it would be greatly appreciated. This community is a fantastic resource and I'm sure someone here has done something like this before. Thank you very much!

       

      Luke

        • Re: Macro creation; Pulling word document when adding a part to a certain type of assembly
          Artem Taturevych

          Hi Luke,

           

          I would suggest to mark your cart/table assemblies with some attributes (for example custom property value Type=Cart, Type=Table) or you can mark it with an internal flag (similar it is done for toolbox parts) by placing some tag inside the model's stream via API.

           

          I would suggest to have the instructions inside the files unless they may be the same for different files within the files family. You can either embed them in 3rd party storage or as the design binder attachment.

           

          I do not know of a way within the out-of-the box functionality of SolidWorks to link metadata from MS Word into the SolidWorks file. it is however possible to achieve this via SolidWorks API and MS Office APIs.

           

          I think this application should be also developed as the add-in to constantly monitor the SolidWorks events. It cannot be done well with SolidWorks macros.

           

          Thanks,
          Artem

            • Re: Macro creation; Pulling word document when adding a part to a certain type of assembly
              Luke Senerchia

              Hi Artem,

               

              Thank you for your thoughtful response!

               

              I just talked to my coworker and he clarified the needs a little. While I like the idea of adding a custom attribute for cart or table, we may not need to go that route. We would like to have the info pop up when a part/sub-assembly is added to ANY assembly. I guess we probably don't need the custom attributes. My mistake.

               

              As for putting the instructions in the file, we can probably do it as a binder attachment. We can either put the instructions in or put a link to the MS Word doc into it.

               

              My question now is; How do we get the attachment to pop up immediately after a part is added to an assembly? Or even a warning to pop up that says, "Check binder attachment for instructions" and, preferably, wont go away until you open the attachment? As long as we have some way of making sure they don't forget to check the notes, the function will do its job.

               

              I really appreciate the help with this. Please let me know if you have any further ideas on how to accomplish this. I have never written a macro before so any information you, or anyone else, can provide would be very helpful.

               

              Thanks again,

               

              Luke