Dispatch - Comment code, manage/save versions.

Discuss SolidWorks PDM
User avatar
Hansjoerg
Posts: 115
Joined: Thu Apr 01, 2021 4:17 pm
Answers: 3
x 71
x 60

Dispatch - Comment code, manage/save versions.

Unread post by Hansjoerg »

Is it possible to insert comment lines in Dispatch to make the code easier to understand?
So far I have only found the possibility to use the Label command for this, but this is actually intended for jump instructions.
I have also tried to copy paste the code to Notepad to insert comments and notes, but the code can be marked in the Dispatch Editor, but not copied.

I would also like to describe the basic function of the dispatch in a few lines at the beginning of the code, just as you normally do with macros.

It would also be very nice if you could open the ACN file with an editor to quickly use parts of a code as a reference for a new dispatch as a template.

How do you manage different versions of a dispatch when you introduce improvements or extensions? A comment function would also be helpful here to document the changes in the code.

Which SWX version is the editor from? Reminds me of when I was young and had my first experiences with Basic on the Commodore C64.
All the "good" news about SWX makes me feel like I'm driving a truck with two trailers straight into a dead end.
User avatar
bnemec
Posts: 1954
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2562
x 1410

Re: Dispatch - Comment code, manage/save versions.

Unread post by bnemec »

I tried dispatch for a while. Now I distain it and would like to keep it out of the vault. AFAIK there's no good way to find all the things dispatch scripts may be mingling with. It's just another place to need to go when it's time for trouble shooting. With enough variables a computer can get pretty close to random behavior. Just my opinion, but in the long run you'll be better served just figuring out Visual Studio and using the PDM APIs directly. Much better commenting, source control, and debugging ability.

Just my $0.02
User avatar
jcapriotti
Posts: 1897
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 32
Location: The south
x 1236
x 2029

Re: Dispatch - Comment code, manage/save versions.

Unread post by jcapriotti »

Hansjoerg wrote: Fri Jul 12, 2024 5:57 am Is it possible to insert comment lines in Dispatch to make the code easier to understand?
So far I have only found the possibility to use the Label command for this, but this is actually intended for jump instructions.
I have also tried to copy paste the code to Notepad to insert comments and notes, but the code can be marked in the Dispatch Editor, but not copied.

I would also like to describe the basic function of the dispatch in a few lines at the beginning of the code, just as you normally do with macros.

It would also be very nice if you could open the ACN file with an editor to quickly use parts of a code as a reference for a new dispatch as a template.

How do you manage different versions of a dispatch when you introduce improvements or extensions? A comment function would also be helpful here to document the changes in the code.

Which SWX version is the editor from? Reminds me of when I was young and had my first experiences with Basic on the Commodore C64.
LABEL is the only option., and as you mentioned....its meant for the JUMP command so it kind of muddies the water. Dispatch needs work and enhancements (notepad edit is a good one), but as @bnemec mentioned, its better to go to the API if that's an option for you. That said, we use both Dispatch and the API as I don't have the resources to code something as an add-in. Too many Add-ins have performance issues as well.....or did in the past.

I would document the dispatch code changes in a Word document in your vault rather than try and shoe horn it into the code. I think the Dispatch UI is custom built....its old and been in the software for as long as I can remember....probably before SolidWorks purchased it. It's just an add-in itself, someone could create something similar and better if there were a market for it.
Jason
User avatar
bnemec
Posts: 1954
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2562
x 1410

Re: Dispatch - Comment code, manage/save versions.

Unread post by bnemec »

jcapriotti wrote: Fri Jul 12, 2024 11:26 am LABEL is the only option., and as you mentioned....its meant for the JUMP command so it kind of muddies the water. Dispatch needs work and enhancements (notepad edit is a good one), but as @bnemec mentioned, its better to go to the API if that's an option for you. That said, we use both Dispatch and the API as I don't have the resources to code something as an add-in. Too many Add-ins have performance issues as well.....or did in the past.

I would document the dispatch code changes in a Word document in your vault rather than try and shoe horn it into the code. I think the Dispatch UI is custom built....its old and been in the software for as long as I can remember....probably before SolidWorks purchased it. It's just an add-in itself, someone could create something similar and better if there were a market for it.
Good point on too many add-ins causing issues, lots of hooks to lots of events and loading of libs at runtime.

Also a neat idea about using a text doc for comments (and version history) of the dispatch script. However, code in Word kinda gives me the heebie-jeebies. Please consider using notepad++ for text docs. Its pretty good at interpreting many languages for colorful syntax.
User avatar
SPerman
Posts: 2080
Joined: Wed Mar 17, 2021 4:24 pm
Answers: 14
x 2256
x 1902
Contact:

Re: Dispatch - Comment code, manage/save versions.

Unread post by SPerman »

VSCode is another good option.
-
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
JSculley
Posts: 648
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 888

Re: Dispatch - Comment code, manage/save versions.

Unread post by JSculley »

Hansjoerg wrote: Fri Jul 12, 2024 5:57 am Is it possible to insert comment lines in Dispatch to make the code easier to understand?
SPR573110 - Dispatch: functionality to add comments

The SPR is about 6 years old.
Post Reply