Page 1 of 1

Conversion tasks

Posted: Thu May 18, 2023 1:40 am
by SolidKeke
Hello,

Our company has a convert task in workflow. More specific, we convert drawings to pdf, dwg and dxf files. Dxf only when there is a sheet named "dxf".

What is grinding my gears here is that when we accept the drawing, it runs all those mentioned 3 tasks. Everytime task runs, it opens a new Solidworks session for that specific task and after running it, closes that session. Then open a new session for next task, and once more after that. To make file conversions for 1 file, Solidworks is opened and closed 3 times, even if I already had the original session open, and even if the drawing even doesn't include dxf-sheet, it still opens new session for that dxf-task. It even opens the drawing just to notice that "hey we don't need to convert this drawing". Guess what happens when I accept 10 drawings same time? Yeah, you guessed right. 30 times Solidworks opens, runs a task and closes itself. Can you imagine the irritation when I accept that main-layout drawing that keeps opening for 5-10 minutes? Then multiply that with 3.

What I would really really like to happen when I accept any amount of drawings is that it uses currently open session to run ALL the tasks at one sit. No new sessions, no closings, only opening the files (if not already opened) and then task-running.

I know this is probably too high hopes to ever be possible in Solidworks PDM, but as in previous job-place we had another PDM and Inventor which could do exactly what I just described so in THEORY this actually could be done.

If anyone has any suggestions, please help me out!

Re: Conversion tasks

Posted: Thu May 18, 2023 7:40 am
by AlexLachance
SolidKeke wrote: Thu May 18, 2023 1:40 am Hello,

Our company has a convert task in workflow. More specific, we convert drawings to pdf, dwg and dxf files. Dxf only when there is a sheet named "dxf".

What is grinding my gears here is that when we accept the drawing, it runs all those mentioned 3 tasks. Everytime task runs, it opens a new Solidworks session for that specific task and after running it, closes that session. Then open a new session for next task, and once more after that. To make file conversions for 1 file, Solidworks is opened and closed 3 times, even if I already had the original session open, and even if the drawing even doesn't include dxf-sheet, it still opens new session for that dxf-task. It even opens the drawing just to notice that "hey we don't need to convert this drawing". Guess what happens when I accept 10 drawings same time? Yeah, you guessed right. 30 times Solidworks opens, runs a task and closes itself. Can you imagine the irritation when I accept that main-layout drawing that keeps opening for 5-10 minutes? Then multiply that with 3.

What I would really really like to happen when I accept any amount of drawings is that it uses currently open session to run ALL the tasks at one sit. No new sessions, no closings, only opening the files (if not already opened) and then task-running.

I know this is probably too high hopes to ever be possible in Solidworks PDM, but as in previous job-place we had another PDM and Inventor which could do exactly what I just described so in THEORY this actually could be done.

If anyone has any suggestions, please help me out!
This is EXACTLY how we do it with CustomTools so I'm sure it isn't that hard to accomplish.

Batch processing
image.png

Re: Conversion tasks

Posted: Thu May 18, 2023 8:28 am
by AlexB
I was going to say the same thing as @AlexLachance that it would take a customized API task add-in to accomplish this all in one go.

Another option, which we utilize at my company, is to have a dedicated task computer that all of those time consuming conversions are offloaded to. This way, our engineers aren't waiting to use their personal computer while the conversion runs. They will just get a notification when it's completed and I will get a notification when a failure occurs so I can investigate.

Re: Conversion tasks

Posted: Thu May 18, 2023 10:10 am
by jcapriotti
@SolidKeke Pretty sure this is by design as you have 3 separate tasks and the system is just playing it "safe" by opening and closing each time. Seems redundant being that its 3 similar tasks on the same file but it doesn't know that. We do something similar for our in-house automation, we restart SolidWorks after each operation to prevent running into errors due to memory leaks and bugs.

You could probably do this with the Advance Scripting option and just have it output all 3 formats in one task. Not something I've tried, maybe others here have.

Re: Conversion tasks

Posted: Thu May 18, 2023 12:58 pm
by bnemec
We built our own custom task add-in when we started. Several reasons why we didn't use the out of box SW task add-in that I won't bother with now. When I wrote it I thought the same thing you did, tasks take a LONG time with the SW task add-in and it's mostly due to starting and closing a SW process for each >task instance<. So I decided to leave SW open on the task host machine and just attach to that process in my task add-in (just like I had already been doing with some SE automations pre-PDM).

Three years later I wish I had not done that or done it differently. SW is a memory leaking slob that crashes a LOT. I searched for way too long how to implement a "watchdog" to deal with hung, crashed, not responding or whatever all else the soldiworks process will do on a task host machine. I came to the conclusion there is no good way to do it from the task add-in. The task add-in process life/scope is too short for that job and managing a SW instance is out of scope for a PDM Task Add-in IMO. So now I watch the task list in the admin tool and when it gets a back log I remote into the task host machine to click the ok button on the "Solidworks needs to close" dialog or whatever it is. It's dumb and I need to get back into our task add-in and just close SW before returning from the on task run routine.

One thing to note is a task instance can do more than one action, but the out of box behavior is to do one transition action per task instance so that's of limited help. Honestly I haven't figured out why sometimes several files will be in one task instance and sometimes only one. I wrote our task add-in to handle multiples so it doesn't matter much.

I had started writing a windows service that manages the Solidworks and Solid Edge processes running on the machine, it would be the watch dog and it's job was to keep a process of each up and running and available. The idea was that the task add-in would then ask the service for the handle of SW or SE instead of getting the handle itself. I think it could be done but I was in discovery mode learning how to do it and decided it wasn't worth the time investment. Especially since I didn't know if it could be done in a robust manner.

Oh, I tried the time-out functionality that's part of PDM task which will at least force the hung task instance to fail but that doesn't kill the hung SW process so other tasks just keep failing instead of waiting. If the time-out event in the PDM task thing would fire an event that I could add a hook to then I could just kill SW in that routine which would clean the task host machine up for the next task.

Re: Conversion tasks

Posted: Thu May 18, 2023 3:43 pm
by JSculley
If the people kicking off the things that are causing tasks to be created have SOLIDWORKS installed, you are better off skipping tasks altogether. I just have a PDM add-in watching for state changes and then initiate PDF generation on their machine, using the running SW instance or starting one if SW isn't running. So, if they release or revise one or more part/assembly drawings, creating or replacing the PDF happens at the same time.

Re: Conversion tasks

Posted: Thu May 18, 2023 4:21 pm
by bnemec
JSculley wrote: Thu May 18, 2023 3:43 pm If the people kicking off the things that are causing tasks to be created have SOLIDWORKS installed, you are better off skipping tasks altogether. I just have a PDM add-in watching for state changes and then initiate PDF generation on their machine, using the running SW instance or starting one if SW isn't running. So, if they release or revise one or more part/assembly drawings, creating or replacing the PDF happens at the same time.
Um, do you mean for that to also apply when the pdf task is run when drawing is approved and the approvers are peers who are working in SW?

Re: Conversion tasks

Posted: Thu May 18, 2023 4:29 pm
by jcapriotti
JSculley wrote: Thu May 18, 2023 3:43 pm If the people kicking off the things that are causing tasks to be created have SOLIDWORKS installed, you are better off skipping tasks altogether. I just have a PDM add-in watching for state changes and then initiate PDF generation on their machine, using the running SW instance or starting one if SW isn't running. So, if they release or revise one or more part/assembly drawings, creating or replacing the PDF happens at the same time.
How does that work.....while they are working? Or do they just know on transition, to sit back and wait?

Re: Conversion tasks

Posted: Thu May 18, 2023 5:00 pm
by JSculley
jcapriotti wrote: Thu May 18, 2023 4:29 pm How does that work.....while they are working? Or do they just know on transition, to sit back and wait?
They know to wait. It's often the last step of a multi-step process: create item number in ERP, move and rename model and drawing to match item number, generate PDF. For revisions, it pretty much happens right away since the ERP/rename/move stuff only happens on first release. A progress dialog lets them know what's happening.

Re: Conversion tasks

Posted: Thu May 18, 2023 5:07 pm
by JSculley
bnemec wrote: Thu May 18, 2023 4:21 pm Um, do you mean for that to also apply when the pdf task is run when drawing is approved and the approvers are peers who are working in SW?
If a drawing requires approvals, our QA procedures require actual pen and ink signatures. So, the PDF is generated, printed and sent around for signatures. It's a hassle especially if changes are required. Luckily, less than 5% of our work falls in that category. We have the luxury of self-approving most of our drawings.

In the event that things change and we start electronic approvals, my plan would be to add a 'Publish' transition to the Approved drawing state. When the final approval is made, the drawing creator would be notified and they can then publish the PDF in its final form.

Re: Conversion tasks

Posted: Thu May 18, 2023 6:35 pm
by bnemec
JSculley wrote: Thu May 18, 2023 5:07 pm If a drawing requires approvals, our QA procedures require actual pen and ink signatures. So, the PDF is generated, printed and sent around for signatures. It's a hassle especially if changes are required. Luckily, less than 5% of our work falls in that category. We have the luxury of self-approving most of our drawings.

In the event that things change and we start electronic approvals, my plan would be to add a 'Publish' transition to the Approved drawing state. When the final approval is made, the drawing creator would be notified and they can then publish the PDF in its final form.
That makes sense. Our current situation is quite different where peers are reviewing files before the release transition that has task action. So the approver would likely have SW open working on whatever and decide to catch up on a couple reviews and probably follow the link in the notification email which opens in Vault View. The PDF task would take over their SW session and try to cache versions of all the components. Since we reuse so many parts it's very likely that PDM in the explorer.exe process would try to cache files that are already open in Solidworks process before it calls SW to open them. There are so many ways it would just be a huge mess quickly. Having a separate machine for pdfs and dxfs is very helpful in our case.

Re: Conversion tasks

Posted: Mon May 22, 2023 5:25 am
by SolidKeke
Thank you all for responses.
AlexLachance wrote: Thu May 18, 2023 7:40 am This is EXACTLY how we do it with CustomTools so I'm sure it isn't that hard to accomplish.

Batch processing
image.png
Our company has a similar tool as CustomTools, just from our VAR's own production. Before ERP integration we used to create file conversions with that tool. It just has a one big flaw: It converts ALL files, even those that are already approved and it again makes the process very time consuming. It is faster for converting small assemblies, but as the assembly unique component quantity increases, so does the time for the conversion.

Some of you said about Task-host machine that could run the tasks, but doesn't that require are a new license? My employer is too cheap for that kind of luxury. This has been in my mind for a long time but I have been very sure that it needs extra license to do that.

I already have a self-made macro that handles the file states correctly so that only the new or edited files are getting converted. I use this macro to check drawings in PDF-format but with little tweaks it has capability to do all company-required file conversions. I would like to integrate that to PDM conversion task, but I have no idea how to do that.

Re: Conversion tasks

Posted: Mon May 22, 2023 11:31 am
by bnemec
SolidKeke wrote: Mon May 22, 2023 5:25 am Some of you said about Task-host machine that could run the tasks, but doesn't that require are a new license? My employer is too cheap for that kind of luxury. This has been in my mind for a long time but I have been very sure that it needs extra license to do that.
It does require a license. It is less costly to have another license running on a machine without a user than to have a user blocked waiting for task(s) to complete. But if your employer thinks they're saving money by paying people to watch automation happen that's up to them.

Re: Conversion tasks

Posted: Mon May 22, 2023 12:01 pm
by AlexB
SolidKeke wrote: Mon May 22, 2023 5:25 am
Some of you said about Task-host machine that could run the tasks, but doesn't that require are a new license? My employer is too cheap for that kind of luxury. This has been in my mind for a long time but I have been very sure that it needs extra license to do that.
If you're on a network license like us, not all licenses are consumed at any given time. We've also set up a 15 minute timeout on licenses with no ill-effects to our local users in order to keep licenses available as needed. The task-host might use a license for a total of 30-45 minutes of the day depending on how many times the required workflows are run.