Batch drawing processor

Started by jb, August 15, 2008, 09:57:12 AM

Previous topic - Next topic

owenwengerd

I didn't look at your original code, but presumably something like (dcl_SendString "FILEDIA 0 _OPEN \"MyDrawing.dwg\" FILEDIA 1 ").

jb

Thanks Owen - when I have the time I'll give it a try.

Great Job! Sorry I can't be more involved.
James Buzbee
Managing Memeber
Black Horse Development, LLC

cmwade77

Thank you all, I will also have to give it a try, I also think that once I have it all working, that it might now be something that is of some use to everyone on here and will post it, as it is now quite a powerful routine. Right now, I have it switching to SDI mode, but I prefer not to do that for various reasons.

Kerry

Quote from: cmwade77 on May 29, 2009, 04:48:14 PM
< ... > Right now, I have it switching to SDI mode, but I prefer not to do that for various reasons.

yes, There is/was talk of eliminating SDI mode ...
http://through-the-interface.typepad.com/through_the_interface/2009/04/sdi-the-end-is-nigh.html
Perfection is not optional.
My other home is TheSwamp

cmwade77

#19
Quote from: Kerry Brown on May 28, 2009, 03:32:00 AM
Thank goodness for Copernic desktop Search
searched my hardrives for vla-activate
This was from Frank Whaley (fairly elderley :) ):-

Code (autolisp) Select

(defun cmdOpen (name)
  ;;; posted by Frank Whaley
  (vl-load-com)
  (if (= 0 (getvar "SDI"))
    (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) name))
    (vla-sendcommand
        (vla-get-activedocument
            (vlax-get-acad-object))
                (strcat "(command \"_.OPEN\")\n" name "\n") )
  )
)


Unfortunately this does not seem to work, using SDI mode does, but this doesn't. I really want to get rid of SDI mode in my routine, it would help a lot. I have attached here in hopes that someone can help me out, I have tried various versions of the code. Please note that this is related to the Cleanup tab on here. As you can see we use this tool for a lot more than just batch scripting. Please note that as I have this posted, it is using SDI mode. This works and works well, but if SDI mode is to be removed, then it won't work anymore.

Fred Tomke

#20
Hi, cmwade77,

I tried to start, but it doesn't work because some functions are missing: DOS_GETDIR.
BTW, please test your dialog when resizing. The calendar control is very small at my desktop. Can you describe the steps what to do/click?

1. Make sure that your code will be loaded in all newly loaded drawings (for instance using vl-load-all).
2. Make sure that the dialog content or/and the variables are updated when the user switches between the drawings (using the event OnDocActivate).
3. Make sure that the dialog will be closed if all drawings are closed (using the event OnEnteringNoDocState).

ADN made a note towards recover:
QuoteKeep in mind the Recover command cannot be invoked using SendCommand()...

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

cmwade77, I had a log try, but I'll give up now. I will try to built an own example for you to compare, but not now, I'm tired.
I'll be back soon.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Kelie

Quote from: Fred Tomke on June 02, 2009, 01:39:51 PM

I tried to start, but it doesn't work because some functions are missing: DOS_GETDIR.


That's from a free tool DOSLib available at http://download.rhino3d.com/download.asp?id=doslib

cmwade77

Sorry, I forgot to post that DOSLib (which can also be downloaded at: http://www.en.na.mcneel.com/doslib.htm ) is required for a lot of my functions. I am working on removing the dependency for this, but it is convenient.

The routine that I posted shouldn't be using Recover, I just had one set of stubborn files that I needed it for, but should be remarked out now, I will be doing something in the UI for that later.

To use the routine, you need to remark out anything you don't need in the c:rtools_bsr routine, there are a lot of powerful things going on there, but some are company specific of course.

Step by step instructions once you have done that:
Type rtools to open the palette
Make sure you only have one open drawing
Click on the cleanup tab
Select the folder that you have the files in that you want to cleanup
Select the folder that you want to copy the files to once you are done
Click Clean Now

Everything should be done automatically from this point, please note that the rtools_bsr routine does the following:

Converts all xrefs from overlay to attach
Changes all xref paths to relative
Changes the drawing from color based plotting to style based plotting (you may wish to remark out this line)
Changes all items to bylayer for color and plot style
Changes all layers to color 8 and to plot with a shaded plot style (again you may wish to modify this line)
Completely Purges the drawing

There are a few other items as well, but this is the basic overview of what it does as I have it setup now.

Fred Tomke

Hm, I'm just thinking about doing these points by ObjectDBX or by script. RECOVER only works with script.
Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

#25
Hi cmwade77, I send you something to test with MDI interface.
Yes, it is a completely different project to yours but maybe it fences your desires.

1. Selecting a source folder all the drawings in it will be shown in the list below.
2. Not existing folders will be created by Scripting.FileSystemObject object.
3. If no file is selected and you press Clean it up now! all the files will be cleaned.
4. If some files are selected only the selected files will be cleaned up.
5. If you doubleclick a file in the list this files will be cleaned.
6. The grid at the bottom shows the options what to clean or how the file is to be opened or saved.
7. The splitter between grid and listbox shows you how to work with the geometry (compare your settings with the settings of this project).
8. The grid will be replaced by a multiline textbox showing the protocol of current actions. This sample shows how to add line by line and making sure that the last line will be visible.
9. During the progress the button Clean it up now! turns to Stop it now! so the user has the chance to cancel the progress after the active loop. After clicking Stop it now! the button turns to Cancelling... until the progress stops.

The problem was the RECOVER command. In this case you have to work with scripts. But you can call your own cleaning operations from a script, too. You will find such a solution in this project. But to use this it is necessary to load the lisp in all files. One solution could be is calling (vl-load-all "clean.lsp") at the beginning (instead of load). Although the example from ADN shows multiple RECOVER commands within one script file it stops right before the next file will be opened. I took this negative experience to my advantage and created an option to exit the loop manually (as mentioned above at point 9).

My English is not good but I hope you understand my dialog.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

susanruswick

wow you sure know a lot about this stuff jb.

jb

just enough to be extremely dangerous . . . ;)
James Buzbee
Managing Memeber
Black Horse Development, LLC