Macro in the PDM Vault

Programming and macros
User avatar
christian chu
Posts: 64
Joined: Wed Mar 31, 2021 3:00 pm
Answers: 0
x 31
x 39

Macro in the PDM Vault

Unread post by christian chu »

Any of you here have tried to save macro in the PDM Vault so other users can use?
Thanks
User avatar
gupta9665
Posts: 420
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 438
x 459

Re: Macro in the PDM Vault

Unread post by gupta9665 »

This should work but I prefer to keep it local on user machine as sometimes when more than one user is trying to use a commonly placed macro, the results are weird. I have recently experienced this, so moved the macros to induvial machines and they are working good.

Further I would advise to create an add-in if possible.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
User avatar
SPerman
Posts: 2080
Joined: Wed Mar 17, 2021 4:24 pm
Answers: 14
x 2256
x 1902
Contact:

Re: Macro in the PDM Vault

Unread post by SPerman »

All of my macros live in the vault, but I'm a one man show so there wouldn't be any access conflicts.
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
User avatar
bnemec
Posts: 1954
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2562
x 1411

Re: Macro in the PDM Vault

Unread post by bnemec »

Very much agreed to prefer add-in over macro.

As for running the macro from local disk. Wouldn't that be the case if the macros are in the vault? There is no file sharing with vaulted files, everyone works from local cache.

Well, I guess there are plenty of times where two processes on the same host might be trying to access the same local file...
User avatar
christian chu
Posts: 64
Joined: Wed Mar 31, 2021 3:00 pm
Answers: 0
x 31
x 39

Re: Macro in the PDM Vault

Unread post by christian chu »

gupta9665 wrote: Wed Jul 19, 2023 10:28 am This should work but I prefer to keep it local on user machine as sometimes when more than one user is trying to use a commonly placed macro, the results are weird. I have recently experienced this, so moved the macros to induvial machines and they are working good.

Further I would advise to create an add-in if possible.
I have some macro which I've changed frequently so I don't want to add to the addin. I saved on the server so other uses can use without updating to the local drive for each change I made. it's been yrs without issue
I'm thinking of putting macro in the Vault for 2 reasons:
1. Macro can be updated for all users
2. The users can use the macro while being offline from local catch
User avatar
loeb
Posts: 70
Joined: Sun Jan 16, 2022 5:55 pm
Answers: 1
x 39
x 10

Re: Macro in the PDM Vault

Unread post by loeb »

What are you guys talking about an "add-in" instead of a macro?
User avatar
bnemec
Posts: 1954
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2562
x 1411

Re: Macro in the PDM Vault

Unread post by bnemec »

loeb wrote: Wed Jul 19, 2023 9:33 pm What are you guys talking about an "add-in" instead of a macro?
Add-ins use the Application Programing Interface (API), a set of classes exposed by the software company that allows 3rd parties programmatically control the running application. Add-ins are most typically written now-a-days in a .NET language such as C# or VB.net (not VBA) and commonly written using a Integrated Development Environment such as Visual Studio, but can be simply typed in notepad and compiled from the command line if one really wanted to. There are many third party add-ins for example the Solidworks PDM Add-in is written by the PDM folks using the Solidworks API. There are "Task Add-ins" for PDM. Even the Outlook add-in for MS office or the MS office add-in for Outlook.

Macros are, in my over simplified terms, recordings of actions that are replayed. Typically it's some form of VBA that is "compiled" or interpreted by the application often at runtime. Where an add-in is compiled and built into .dll(s) that are registered by the Windows OS and loaded by the application either at startup or when needed. Macros are often written and edited in some editor that is part of the host application and debugging is typically very limited in comparison to add-in developed in a IDE.

There are many differences once we start getting into the details.
User avatar
SPerman
Posts: 2080
Joined: Wed Mar 17, 2021 4:24 pm
Answers: 14
x 2256
x 1902
Contact:

Re: Macro in the PDM Vault

Unread post by SPerman »

I would argue that each have their place. Spending the time to turn my "Save as PDF" macro into a add-in would not be a good investment of my time. (Although I guess if you have hundreds of users there may be good reason to invest the time even for something simple.)
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
User avatar
AlexB
Posts: 508
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 29
x 274
x 462

Re: Macro in the PDM Vault

Unread post by AlexB »

Keeping a macro in the PDM vault should be no different than having it individually on each user's PC outside of the vault. The function of PDM is to eliminate the network from the picture when a user is interacting with solidworks files in the PDM vault. To do this, it caches files locally to your C: drive and accesses those directly in order to read/write depending on the permissions that PDM allows for the specific file state.

Macros are typically simple but can be very complicated and the VBA editor is sometimes preferable for some applications of the API. It's best suited for scenarios where you always want to do the same thing to a file with minimal customization for the user to apply. For example, there's a macro floating around to hide all reference objects (sketches, helixes, planes, origins, etc.) and it has a checkbox next to each type the user can choose to hide. In the end, it does one thing which is to hide the things you want to hide.

Add-ins are typically highly customized in the sense that it can do many things to many different types of files. For example, we have one we use internally that acts as a custom property editor but also can update our old formats to new templates and batch export different file types to a specified network location based on project. These require a good understanding of c# or vb.net as well as API programming in general which makes them a no-go for your average SW user.

There are pros and cons of both, but add-ins are a lot more complicated to create than a macro.
User avatar
jcapriotti
Posts: 1897
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 32
Location: The south
x 1236
x 2029

Re: Macro in the PDM Vault

Unread post by jcapriotti »

We keep most of macros in PDM with the folder set to cache latest on login. Generally works pretty well. The only catch is if you check-in a new version, we have to tell everyone to cache the latest, or logout and back in as the auto caching only triggers on login. Be nice to have a push function.
Jason
User avatar
bnemec
Posts: 1954
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2562
x 1411

Re: Macro in the PDM Vault

Unread post by bnemec »

jcapriotti wrote: Thu Jul 20, 2023 1:10 pm We keep most of macros in PDM with the folder set to cache latest on login. Generally works pretty well. The only catch is if you check-in a new version, we have to tell everyone to cache the latest, or logout and back in as the auto caching only triggers on login. Be nice to have a push function.
I think a "push" function could be done using PDM add-in but would be hack. It would be it's own add-in because it would need to run once on each machine and each machine would need to be set as a task host for that add-in. Problem is I don't know how to control which host runs the task without manually changing it in the admin tool for each machine.

Alternatively and even more hack would be an add-in that is triggered by some probably not related thing and do the get latest in the OnTaskLaunch. Problem with that is what to use as a trigger?

Last one that I can think of is a stand alone exe that uses PDM API to get latest of the macro (entire folder probably) and that exe is called from a one-shot scheduled task that is pushed out to all the clients, similar to how the admin image can be started.

I don't know that any of those options are worth while or better than just telling everyone to go get latest of the macro.

Edit: There are several places where the Solidworks PDM Add-in could have some finishing touches applied. Caching some of these other file types that the Solidworks process reads/writes would be helpful. Templates, formats, macros, hole wizard tool file, etc. Not just caching, but the add-in should make Solidworks aware that those files are in a local vault, not just a file on local disk. When SW tries to touch those files PDM add-in should kick in and get cache or ask to get cache as well as if user wants to check them out or change state if needed. I think I have this in my PDM TTL.
User avatar
jcapriotti
Posts: 1897
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 32
Location: The south
x 1236
x 2029

Re: Macro in the PDM Vault

Unread post by jcapriotti »

@bnemec Some these we considered in the past. I can't see Dassault adding much more to PDM when they'd rather move everyone to their cloud PLM platform.

Since we are moving to Windchill, we will no longer be able to store the SolidWorks configuration files in a vault. WC has some ability to do this but it doesn't work well and has performance issues. Likely we go back to storing the files in a folder on the user's c drive and push out updates using InTune.
Jason
User avatar
mp3-250
Posts: 654
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 735
x 357

Re: Macro in the PDM Vault

Unread post by mp3-250 »

macro in the vault and no problem so far. that folder is set to get latest version on login.
andrmollo
Posts: 12
Joined: Fri Oct 14, 2022 11:39 am
Answers: 1
x 5
x 9

Re: Macro in the PDM Vault

Unread post by andrmollo »

We store our macros in a PDM folder set to get the latest version on login. Works fine with 35 or so macro in a 10 users environment.

This also allow me to have the macro files permanently checked-out so the other users can't mess with them; I can also experiment new features in my local cache and then check-in the macro when it is stable for my colleagues to use.
User avatar
christian chu
Posts: 64
Joined: Wed Mar 31, 2021 3:00 pm
Answers: 0
x 31
x 39

Re: Macro in the PDM Vault

Unread post by christian chu »

andrmollo wrote: Fri Jul 21, 2023 3:20 am We store our macros in a PDM folder set to get the latest version on login. Works fine with 35 or so macro in a 10 users environment.

This also allow me to have the macro files permanently checked-out so the other users can't mess with them; I can also experiment new features in my local cache and then check-in the macro when it is stable for my colleagues to use.
Thanks for the info.
User avatar
christian chu
Posts: 64
Joined: Wed Mar 31, 2021 3:00 pm
Answers: 0
x 31
x 39

Re: Macro in the PDM Vault

Unread post by christian chu »

SPerman wrote: Thu Jul 20, 2023 10:10 am I would argue that each have their place. Spending the time to turn my "Save as PDF" macro into a add-in would not be a good investment of my time. (Although I guess if you have hundreds of users there may be good reason to invest the time even for something simple.)
I think the idea here is not developing an add-in just for "Save As PDF" but adding this feature "Save as PDF" to an existing Add-in - see att. image - I have one add-in for all features in 3D and 2D
By the way, you can use add-in to load the macro as I believe you are aware of it
Attachments
Macro-Addin.jpg
User avatar
DanPihlaja
Posts: 862
Joined: Thu Mar 11, 2021 9:33 am
Answers: 25
Location: Traverse City, MI
x 815
x 993

Re: Macro in the PDM Vault

Unread post by DanPihlaja »

SPerman wrote: Thu Jul 20, 2023 10:10 am I would argue that each have their place. Spending the time to turn my "Save as PDF" macro into a add-in would not be a good investment of my time. (Although I guess if you have hundreds of users there may be good reason to invest the time even for something simple.)
It may not be a "turn this macro into an add-in", but instead be a "create an add-in that accesses all the macros and runs the one you select"
-Dan Pihlaja
Solidworks 2022 SP4

2 Corinthians 13:14
User avatar
AlexB
Posts: 508
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 29
x 274
x 462

Re: Macro in the PDM Vault

Unread post by AlexB »

DanPihlaja wrote: Fri Jul 21, 2023 1:25 pm It may not be a "turn this macro into an add-in", but instead be a "create an add-in that accesses all the macros and runs the one you select"
Artem has already developed and add-in that does this. I believe it's free, but I could be wrong.
https://cadplus.xarial.com/toolbar/
Post Reply