Improve Your Archery Game with SOLIDWORKS PDM Tasks
If you’re like me, then you like archery. There’s a lot to like about it – the serenity of nature, the simplicity of a bow and arrow, and the cool morning breeze as you line up your shot. While there are many of you out there that are far better at it than I am, we can all agree that practice is the key item that makes good archery possible. Also, a great excuse to do it more.
So how does SOLIDWORKS PDM play into this? As it turns out, there are a number of factors that can get in the way of our precious practice time. One of them being work; specifically tedious and repetitive work. We’ve all dreaded those late nights and weekends where we have to open hundreds or thousands of drawings, check a standard or property, and make a simple adjustment all before release day (or ISO inspection day) – usually Monday morning. If this is a nightmare you’ve experienced, are soon dreading, or simply don’t wish to encounter you’ve come to the right place. Let’s get started.
While I was at SOLIDWORKS World 2018 in Los Angeles, California back in February, I gave this exact presentation. If you weren’t able to attend, this is a summarized process that I hope inspires you.
As it turns out, SOLIDWORKS PDM can be very helpful in regards to making short work out of tedious and repetitive work. The power comes from leveraging VBA macros.
“VBA Macros?! The most heathen and arcane?!”
While having some programming ability is useful, you don’t have to be a wizard at it and with use of the macro recorder tool, you’re most of the way there. The idea is that you record yourself doing the mundane task with the recorder and then from there we make some tweaks to the resulting macro.
Afterward, the macro can be tweaked by replacing specifics (like a certain file name) with a variable token. When a new task is created in SOLIDWORKS PDM you can adjust the macro script and insert tokens to represent user inputs and runtime values.
Example: “<FilePath>” ➔ “C:MyVaultPlank.sldprt”
Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 0, 0, 0.040132, 0.00254, False, False, False, False, 1.74532925199433E-02, 1.74532925199433E-02, False, False, False, False, True, True, True, 0, 0, False)
longstatus = Part.SaveAs3(“C:TaskMonkeyPart1 by Taskmonkey.SLDPRT“, 0, 2)
In the examples above, the two lines of code refer to making an extrusion with certain depth (everything API is MMGS) and saving the file somewhere. This is where my variables would replace runtime variables.
By doing this, you then can use Template cards for some user input at the beginning of the task and then allow for a user to select several to hundreds or thousands of files at a time to run this script on. You can even configure it so that your custom task is run on files every time they go through a workflow transition – you don’t even have to think about it again.
I’ve included the graphic below to describe the architecture that can be leveraged with SOLIDWORKS PDM tasks.
Here is a happy environment where many different users can request a task to be run and then it is run at the earliest available time on an available task host (which can even be a dedicated machine). The tasks go into the queue and are processed one-by-one, per task host.
A couple of useful examples of out-of-the-box tasks are converting files to PDF, DXF, or STEP. Alternatively, you can queue printing to the shop floor.
A few custom tasks are:
- – Create a report of the SOLIDWORKS files and what version they are saved in
- – Create a SOLIDWORKS model based on certain parameters filled out by user
- – Populate my drawing title blocks and properties with information from their models
I hope I’ve peaked your interest by simply introducing the topic and that you now decide to go and learn more. For more SOLIDWORKS PDM tips and tricks view the related articles below.
About the Author
Peer Larson has been using SOLIDWORKS since 2006 and began supporting, implementing, and teaching PDM since 2012. Peer has been in the IT field supporting computer networks since 2004, working on Cisco devices. He has since transitioned into the software environment, where he specializes in software deployment, data migrations, and data automation – frequently leveraging the SOLIDWORKS and PDM APIs.