TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Guest on February 14, 2008, 03:02:15 PM
-
Now I'll be first to admit that I don't know much about VLisp so please be gentle!!
I'm in the process of creating a proggy that will open files, grab some info, close, then move on to the next file.
I found this...
(vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) "C:\My Path\My File.dwg" :VLAX-TRUE))
I'm running in MDI mode, and when the previous line is called, it opens the file - great, halfway there. However, the following lines (the ones that grab info) aren't called in the read-only drawing. When I switch back to the previous drawing (the one that was open when this whole thing started), then the "info-grabbing" code begins running. Soooo..... What the flip??!?
-
Sorry Matt, I don't have time to pen the response you deserve (I mean that in a nice way) so I'm by-passing all the discussion and going straight to the bottom line as I see it. IF you're intention is to open multiple files via lisp AND you only need 'read-only' access THEN use ObjectDBX to harvest what ya need. Fast, fast, fast and no MDI headaches. Otherwise? Oh look, a bird.
-
Sorry Matt, I don't have time to pen the response you deserve (I mean that in a nice way) so I'm by-passing all the discussion and going straight to the bottom line as I see it. IF you're intention is to open multiple files via lisp AND you only need 'read-only' access THEN use ObjectDBX to harvest what ya need. Fast, fast, fast and no MDI headaches. Otherwise? Oh look, a bird.
I would but (and I forgot to mention this) there may be a need to print a layout tab whilst harvesting aforementioned information. Oops! :oops:
-
I would but (and I forgot to mention this) there may be a need to print a layout tab whilst harvesting aforementioned information. Oops! :oops:
(http://www.theswamp.org/screens/mp/spank.png)
-
So what you actually want is batch plot + data harvesting via LISP when SDI=0?
-
So what you actually want is batch plot + data harvesting via LISP when SDI=0?
Basically.... And I've got most of what I need already... I'm getting hung up on the active document not running the commands.
-
Well.... I'm resorting to this method for the time being until I find out if there's a better way (I have to believe that there is, I just haven't figured it out/seen it yet).
(command "vbastmt" "documents.open .....
Scratch that idea...
-
No real way to do what you want with lisp, unless you change the sdi to 1, and go that way. That is how I had to do it when I did my batch plot routine.
-
Would something like this help?
;batch_anything.lsp
;Created XXXXXXXX
;Date: Sept of 2002
;Description: Batch Process
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;start prog
(DEFUN C:batch_anything ()
;;;;;;;;;;;;;;;;;;;;;;;;;Select directory to be processed
(setq dfil (getfiled "Select A File In The Directory You Want To Batch Process" "p:/" "dwg" 0))
(setq wutdir (vl-filename-directory dfil))
(setq wutfiles (vl-directory-files wutdir "*.dwg"))
(setq scrfile (open "c:\\scrfile.scr" "w"))
(close scrfile)
(setq scrfile (open "c:\\scrfile.scr" "a"))
(foreach n wutfiles
(setq n2 (strcat "\""wutdir "\\" n "\""))
(setq n2 (vl-string-translate "\\" "\\" n2))
(setq scrline (strcat "open" " " n2 " " "(load\"batch_core\")" " " "batch_insert" " " "qsave" " " "close"));;;;;;;COMMANDS FOR BATCH GO HERE
(write-line scrline scrfile)
(princ)
)
(close scrfile)
(command "script" "c:\\scrfile")
(princ "\n***Batch complete.***")
(princ)
);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DEFUN
-
Hello
I don't understand what you want to do
(setq my_dwg (vla-open (vla-get-documents (vlax-get-acad-object)) "C:/My Path/My File.dwg")
And a (vlax-dump-object my_dwg) as the same as (vlax-dump-object (vla-get-activedocument (vlax-get-acad-object))) :?
@+