Author Topic: BatchWORX  (Read 7503 times)

0 Members and 1 Guest are viewing this topic.

roy_043

  • Water Moccasin
  • Posts: 1721
  • BricsCAD 18
Re: BatchWORX
« Reply #15 on: May 08, 2012, 03:04:13 PM »
Tim,

I was trying out your code in Bricscad. Had do some obvious tweaks of course, but then ran into similar problems as matthewj. The comments below are therefore based on limited tests and I was not using your latest code.

1.
You should consider this scenario: The user selects some drawings for processing and then decides to switch to a different folder. But instead of selecting a new folder the user changes his mind and cancels the folder dialog. Your main dialog now reports: "NO DIRECTORY SET", but the left list_box is not cleared. In fact you can still select items from the list resulting in "nilDrawingName.dwg" entries in the right list_box.

2.
The folder dialog you are using has certain limitations. If you start it in a specified folder the browsing is restricted to that folder and its subfolders. You usually don't want that. On the other hand, always having to start browsing from the "My documents" folder is inefficient. Not many companies use this folder or even the C: drive for their project folders. A solution can be to add a main-project-folder option to your config settings. If such a folder is set the folder dialog can start from that folder saving the user 4-5 clicks every time he uses the program.

3.
The right list_box is sorted alphabetically the left list_box is not.

4.
It would be nice if the dwgs that have already been selected are marked in the left list_box. For example by adding some spaces before the item string.

5.
Since the dwgs in the right list_box can come from different folders it makes sense to display the full path for each dwg. That would perhaps mean having to do away with the symmetry of the dialog.

6.
"Select all" and "Clear all" buttons would be nice.

7.
The bottom button row of your main dialog now has this order:
"Process" "Cancel" "About" *space* "Config"
I would use this order:
"About" "Config" *space* "Process" "Cancel"
That order is more in keeping with the general '"flow" of the dialog.

8.
The separators in your dialogs sometimes have -2 as their background color. I think this should always be -15.

9.
You use a lot of text_part tiles instead of normal text tiles. I don't understand why.

HTH.

Roy.

matthewj

  • Newt
  • Posts: 42
  • Vanilla
Re: BatchWORX
« Reply #16 on: May 08, 2012, 06:08:31 PM »
Try this one and see if this prevents multiple sessions.

I'll try this out at work tomorrow.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: BatchWORX
« Reply #17 on: May 09, 2012, 07:34:32 AM »
@ Roy,

Thanks for the feedback.  I will look over the list today and see what changes can be implemented.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

matthewj

  • Newt
  • Posts: 42
  • Vanilla
Re: BatchWORX
« Reply #18 on: May 10, 2012, 01:10:47 PM »
Quote
Try this one and see if this prevents multiple sessions.

No-go friend.  Everything works well until I hit the process button;  the dialogue closes and nothing happens.  I checked the config locations, and they are the same as in v4.

Edit: I wasn't completely accurate when I said nothing happened.  The routine turned all of the automatic batch running, it just didn't open any of the files I'd specified.  I had to open the Batchworx.dwg to turn off the batch processing.
« Last Edit: May 10, 2012, 01:25:55 PM by matthewj »

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: BatchWORX
« Reply #19 on: May 11, 2012, 09:22:27 AM »
How about this?
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

roy_043

  • Water Moccasin
  • Posts: 1721
  • BricsCAD 18
Re: BatchWORX
« Reply #20 on: May 17, 2012, 05:51:04 PM »
Tim, I have just tried out the latest version of your lisp (from post #19).
Here are some additional comments:

10. (The numbering continues where my previous post has left off)
The "spawning" of multiple CAD sessions now only occurs if there are multiple sessions open when the Batch command is started.

11.
If a single session is active when the routine is run, the program works OK. But for every drawing that is opened by the process I have to click the OK button in a "Processing in progress... Please be patient" alert dialog. So the process can't be left unattended. This maybe a Bricscad thing though.

12.
Another scenario to consider: The batch process fails for whatever reason. The user gets called away, forgets what he has been doing, and start a CAD session by double clicking on a dwg file. This dwg will now be processed by the batch routine, saved and closed. And if the process runs successfully the user cannot open any other dwg to continue working, because that dwg would also be processed. Using a script to open the drawings and start the .batch file would be safer. In Bricscad this is also faster and there are no alert dialogs. But I know your goal is not to use scripts.

13.
And another scenario: The user selects the calling dwg for processing...

14.
Your Batchworx.docx is not entirely clear about the use of the Batch subfolder. After reading the text I put both .batch file examples in that folder and one of them (Batchworx.lsp) was then erased by your program.

Again, HTH.

Roy.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: BatchWORX
« Reply #21 on: May 18, 2012, 08:50:50 AM »
Tim,

I was trying out your code in Bricscad. Had do some obvious tweaks of course, but then ran into similar problems as matthewj. The comments below are therefore based on limited tests and I was not using your latest code.

1.
You should consider this scenario: The user selects some drawings for processing and then decides to switch to a different folder. But instead of selecting a new folder the user changes his mind and cancels the folder dialog. Your main dialog now reports: "NO DIRECTORY SET", but the left list_box is not cleared. In fact you can still select items from the list resulting in "nilDrawingName.dwg" entries in the right list_box.
I found this issue an I think that I have fixed it to retain the current directory is the user cancels.

2.
The folder dialog you are using has certain limitations. If you start it in a specified folder the browsing is restricted to that folder and its subfolders. You usually don't want that. On the other hand, always having to start browsing from the "My documents" folder is inefficient. Not many companies use this folder or even the C: drive for their project folders. A solution can be to add a main-project-folder option to your config settings. If such a folder is set the folder dialog can start from that folder saving the user 4-5 clicks every time he uses the program.
There is not much out there for directory selection unless you roll your own.  Unfortunately this is what we have to work with.

3.
The right list_box is sorted alphabetically the left list_box is not.
Fixed

4.
It would be nice if the dwgs that have already been selected are marked in the left list_box. For example by adding some spaces before the item string.
I am looking at the code, I am thinking of removing the drawings from the list as they are added to the batch list, and vice-versa.

5.
Since the dwgs in the right list_box can come from different folders it makes sense to display the full path for each dwg. That would perhaps mean having to do away with the symmetry of the dialog.
How about adding a description tile below to show the full path of a selected file?  If I enable the full path in the listbox the listboxes could get very wide.

6.
"Select all" and "Clear all" buttons would be nice.
Good Idea

7.
The bottom button row of your main dialog now has this order:
"Process" "Cancel" "About" *space* "Config"
I would use this order:
"About" "Config" *space* "Process" "Cancel"
That order is more in keeping with the general '"flow" of the dialog.
How so?

8.
The separators in your dialogs sometimes have -2 as their background color. I think this should always be -15.
Good catch, fixed.  That's what I get for coping code from other applications.

9.
You use a lot of text_part tiles instead of normal text tiles. I don't understand why.
I have found that text_part is a bit more flexible during design.  It allows text to be moved around <tabbed> by adding other parts to it.  also there are no margins on text_parts so it seems easier to control the space around them.

HTH.

Roy.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

roy_043

  • Water Moccasin
  • Posts: 1721
  • BricsCAD 18
Re: BatchWORX
« Reply #22 on: May 21, 2012, 05:35:42 AM »

5.
Since the dwgs in the right list_box can come from different folders it makes sense to display the full path for each dwg. That would perhaps mean having to do away with the symmetry of the dialog.
How about adding a description tile below to show the full path of a selected file?  If I enable the full path in the listbox the listboxes could get very wide.
That is a good alternative. Most companies would use some unique project number as part of the dwg name anyway.

7.
The bottom button row of your main dialog now has this order:
"Process" "Cancel" "About" *space* "Config"
I would use this order:
"About" "Config" *space* "Process" "Cancel"
That order is more in keeping with the general '"flow" of the dialog.
How so?
See below.

9.
You use a lot of text_part tiles instead of normal text tiles. I don't understand why.
I have found that text_part is a bit more flexible during design.  It allows text to be moved around <tabbed> by adding other parts to it.  also there are no margins on text_parts so it seems easier to control the space around them.
Bricscad does not correctly display these texts with "\t". One of my tweaks was to replace "\t" with "    ".

What do I mean by "flow" of the dialog?

If I look at the top three elements of your main dialog, I notice that "the main action" is focussed on the right side of the elements. That is where the "Browse" buttons and the list of drawings selected for processing are. In the bottom button row this is reversed. Here the buttons that will be used most frequently are on the left.

A couple of days ago I landed on the msdn website. And after a few clicks I found this text:
All things being equal, users first look in the upper left corner of a window, scan across the page, and end their scan in the lower right corner. They tend to ignore the lower left corner.

I don't know if there is any science behind that quote. The statement may well only apply to people with a language that is read from left to right, drive on the right side of the road and are right handed. Who knows? Maybe it all just depends on what you are accustomed to.

Roy.

roy_043

  • Water Moccasin
  • Posts: 1721
  • BricsCAD 18
Re: BatchWORX
« Reply #23 on: May 21, 2012, 05:44:09 AM »
Oops forgot this one:

15.
When reading the first line of your .batch files I would use this code to strip off unwanted characters:
Code: [Select]
(vl-string-trim ";| \t" str)

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: BatchWORX
« Reply #24 on: May 24, 2012, 02:48:14 PM »
Tim, I have just tried out the latest version of your lisp (from post #19).
Here are some additional comments:

10. (The numbering continues where my previous post has left off)
The "spawning" of multiple CAD sessions now only occurs if there are multiple sessions open when the Batch command is started.
Still looking into this.. I have to grab ALL open session then alert the user is there are more than 1

11.
If a single session is active when the routine is run, the program works OK. But for every drawing that is opened by the process I have to click the OK button in a "Processing in progress... Please be patient" alert dialog. So the process can't be left unattended. This maybe a Bricscad thing though.
This is because of the .batch file.  Look in there and remove the alert (or comment it out).  It was only for demo purposes

12.
Another scenario to consider: The batch process fails for whatever reason. The user gets called away, forgets what he has been doing, and start a CAD session by double clicking on a dwg file. This dwg will now be processed by the batch routine, saved and closed. And if the process runs successfully the user cannot open any other dwg to continue working, because that dwg would also be processed. Using a script to open the drawings and start the .batch file would be safer. In Bricscad this is also faster and there are no alert dialogs. But I know your goal is not to use scripts.
Have you had this happen.  If the batchworx fails then AutoCAD should crash.  Thus a new drawing would open resetting batchworx.

13.
And another scenario: The user selects the calling dwg for processing...
I have added a check for this once the "process" button is selected, however it is only if it is called in that dwg.  I'll have to spend some more time with that.

14.
Your Batchworx.docx is not entirely clear about the use of the Batch subfolder. After reading the text I put both .batch file examples in that folder and one of them (Batchworx.lsp) was then erased by your program.
ODD it should only delete file with a .batch ext.  I will try to clear up the documentation a bit.  Essentially there are 2 location (a network) (a user) both can have .batch files or you can just use 1 location (if you are standalone)

Again, HTH.

Roy.

Here is a revised .lsp and .dcl.  I removed the /t characters.  I appreciate your time testing this, it will only make it better.

TIM
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: BatchWORX
« Reply #25 on: May 30, 2012, 07:46:41 AM »
@ matthewj

Did you get this to work with the new changes?
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

roy_043

  • Water Moccasin
  • Posts: 1721
  • BricsCAD 18
Re: BatchWORX
« Reply #26 on: May 31, 2012, 03:31:21 AM »
Upon further testing, this time with the Windows Task Manager open, I find that the lisp program will ALWAYS spawn multiple CAD sessions in Bricscad. My conclusion is therefore that this approach to batch processing will not work for Bricscad.

In Bricscad there are two ways to run a batch process:
A.
You can use a script. This will also work in Autocad.
B.
You can use a SINGLE lisp program to handle the entire process.
In Bricscad you can:
- Start a lisp program in drawing A.
- Open drawing B.
- Perform various tasks in dwg B: execute lisp code, call commands (they will run in dwg B) etc.
- Save and close dwg B.
- Open drawing C.
- ... etc.
This is, apparently, not possible in Autocad.


Some comments (old and new):

4.
It would be nice if the dwgs that have already been selected are marked in the left list_box. For example by adding some spaces before the item string.
T:
I am looking at the code, I am thinking of removing the drawings from the list as they are added to the batch list, and vice-versa.
R:
The vice-versa part has not yet been implemented.

5.
Since the dwgs in the right list_box can come from different folders it makes sense to display the full path for each dwg. That would perhaps mean having to do away with the symmetry of the dialog.
T:
How about adding a description tile below to show the full path of a selected file? If I enable the full path in the listbox the listboxes could get very wide.
R:
That is a good alternative. Most companies would use some unique project number as part of the dwg name anyway.
R:
Very nice work on that one. You are even handling multiple selections!

16.
You use acet-* functions without checking if they can be used. Not everybody wil have the Express Tools installed.

17.
Your dcl somewhere has:
Code: [Select]
alignment = "left";This should be:
Code: [Select]
alignment = left;But this line can also be removed.

18.
The arrow buttons between the list_boxes are left aligned.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: BatchWORX
« Reply #27 on: May 31, 2012, 01:03:00 PM »
Upon further testing, this time with the Windows Task Manager open, I find that the lisp program will ALWAYS spawn multiple CAD sessions in Bricscad. My conclusion is therefore that this approach to batch processing will not work for Bricscad.
I am looking into this a bit more, I can't seem to capture the current session and keep the dwgs in it.

In Bricscad there are two ways to run a batch process:
A.
You can use a script. This will also work in Autocad.
B.
You can use a SINGLE lisp program to handle the entire process.
In Bricscad you can:
- Start a lisp program in drawing A.
- Open drawing B.
- Perform various tasks in dwg B: execute lisp code, call commands (they will run in dwg B) etc.
- Save and close dwg B.
- Open drawing C.
- ... etc.
This is, apparently, not possible in Autocad.
Nope, other wise this would be a lot easier  :roll:


Some comments (old and new):

4.
It would be nice if the dwgs that have already been selected are marked in the left list_box. For example by adding some spaces before the item string.
T:
I am looking at the code, I am thinking of removing the drawings from the list as they are added to the batch list, and vice-versa.
R:
The vice-versa part has not yet been implemented.
Yes it has, however if you try to "unload" dwg's from the right side and they are not from the "current" directory they just get dumped, not added back to the left (they don't belong there)

5.
Since the dwgs in the right list_box can come from different folders it makes sense to display the full path for each dwg. That would perhaps mean having to do away with the symmetry of the dialog.
T:
How about adding a description tile below to show the full path of a selected file? If I enable the full path in the listbox the listboxes could get very wide.
R:
That is a good alternative. Most companies would use some unique project number as part of the dwg name anyway.
R:
Very nice work on that one. You are even handling multiple selections!

16.
You use acet-* functions without checking if they can be used. Not everybody wil have the Express Tools installed.
I noticed this yesterday when I was going through the code, this was from my StdLib which does the checking, I'll be adding the check to this also.

17.
Your dcl somewhere has:
Code: [Select]
alignment = "left";This should be:
Code: [Select]
alignment = left;But this line can also be removed.
Fixed

18.
The arrow buttons between the list_boxes are left aligned.
Yeah, I haven't cleaned up the dialog code yet.  I will add this to the todo list.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

roy_043

  • Water Moccasin
  • Posts: 1721
  • BricsCAD 18
Re: BatchWORX
« Reply #28 on: June 01, 2012, 04:40:06 AM »
4.
It would be nice if the dwgs that have already been selected are marked in the left list_box. For example by adding some spaces before the item string.
T:
I am looking at the code, I am thinking of removing the drawings from the list as they are added to the batch list, and vice-versa.
R:
The vice-versa has not yet been implemented.
T:
Yes it has, however if you try to "unload" dwg's from the right side and they are not from the "current" directory they just get dumped, not added back to the left (they don't belong there).
R:
The code is there but to get it to work 2 lines have to be changed (you are not adding "\\"):
Line 432:
Code: [Select]
(if (equal (strcat (vl-filename-directory SelDwg) "\\") BatchDirectory)Line 464:
Code: [Select]
(if (equal (strcat (vl-filename-directory DwgName) "\\") BatchDirectory)

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: BatchWORX
« Reply #29 on: June 05, 2012, 08:22:57 AM »
4.
It would be nice if the dwgs that have already been selected are marked in the left list_box. For example by adding some spaces before the item string.
T:
I am looking at the code, I am thinking of removing the drawings from the list as they are added to the batch list, and vice-versa.
R:
The vice-versa has not yet been implemented.
T:
Yes it has, however if you try to "unload" dwg's from the right side and they are not from the "current" directory they just get dumped, not added back to the left (they don't belong there).
R:
The code is there but to get it to work 2 lines have to be changed (you are not adding "\\"):
Line 432:
Code: [Select]
(if (equal (strcat (vl-filename-directory SelDwg) "\\") BatchDirectory)Line 464:
Code: [Select]
(if (equal (strcat (vl-filename-directory DwgName) "\\") BatchDirectory)

Well when I tested it originally it worked fine, but I was testing dwg's from directly within a directory, not in folders so mine worked fine.  When I tested dwg's within folders mine failed and your solution worked, but your solution didn't work for dwg's in a directory.  The fix:

Code: [Select]
(if (equal (vl-filename-directory SelDwg) (vl-filename-directory BatchDirectory))

and

(if (equal  (vl-filename-directory DwgName) (vl-filename-directory BatchDirectory))

All seems to work now.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016