TheSwamp
CAD Forums => CAD General => Topic started by: CADaver on January 18, 2005, 11:52:51 AM
-
Before I burn a lot of time, does anyone (Yo, CAB?) have a lisp routine or something that will XREF overlay a bunch of files at once?
-
;;;Created by Will DeLoach
;;;
;;;Description:
;;;Does a multiple attach of selected dwg's.
;;;
;;;Usage:
;;;From the dialog box select a dwg and then click on open.
;;;Keep doing this procedure until you have selected all the
;;;files you want to attach, then click cancel to continue with
;;;the attaching of the xref's.
;;;The routine can be modified for insertion point, scale, and
;;;rotation respectively by changing the 3 pause commands.
;;;
;;;
(defun c:mxattach (/ file files)
(setq file "")
(while (setq file (getfiled "Select a file to xref" file "dwg" 128))
(setq files (cons file files))
)
(foreach f (reverse files)
(vl-bb-set 'name (vl-filename-base f))
(if (vl-cmdf "-xref" "attach" (vl-bb-ref 'name))
(command pause pause pause)
)
)
(princ)
)
This is one I wrote, but it requires alot of user input and it doesn't currently attach overlay. You can change it however you need to or just holler and I will.
HTH,
-
Do a google search for Xtools.
-
Do a google search for Xtools.
I did, now what??
-
How are you planning on implementing this?
Are each of your xrefs the same scale or location?
Do you want to select all the files in a folder?
I can make any or all of these options as well as changing from "attach" to "overlay".
Just say the word and give directions.
-
Will,
I modified your code so you could attach files ouside the root dir as well.
(defun c:mx (/ file files)
(setq file "")
(while (setq file (getfiled "Select a file to xref" file "dwg" 128))
(setq files (cons file files))
)
(foreach f (reverse files)
(vl-bb-set 'name (strcat (vl-filename-directory f) "\\" (vl-filename-base f)))
(if (vl-cmdf "-xref" "attach" (vl-bb-ref 'name))
(command pause pause pause)
)
)
(princ)
)
Ron
-
Xtools v5.1
http://www.freecadapps.com/swdetails.php?page=category&value=ACG-BXT&orgvalue=ACG&review=6216&rowcolor=ffffcc
-
Thanks AfricaAD, I'll look into it.
Will, I did something similar to what Ron did, but added the insertion point at 0,0,0 and the scales are 1 with a 0 rotation:
(defun c:mx (/ file files)
(setq file "")
(while (setq file (getfiled "Select a file to xref" file "dwg" 128))
(setq files (cons file files))
)
(foreach f (reverse files)
(vl-bb-set 'name (strcat (vl-filename-directory f) "\\" (vl-filename-base f)))
(if (vl-cmdf "-xref" "overlay" (vl-bb-ref 'name))
(command "*0,0,0" "1" "1" "0")
)
)
(princ)
)
This works pretty well, thanks, I was just hoping to select a range of files with a shift or ctrl, but this works just fine for now.
-
I was just hoping to select a range of files with a shift or
ctrl
Unfortunately that is a downside to lisp. I have been bummed out on this for a while now.
I also have a tool that will search a folder and/or all sub-folders for a string in a filename. It uses wcmatch selection with wildcards and all. I will post it if you would like to use it. It does however require that "acetutil" be loaded from the expresstools..
-
there might be something that might do what you want in the latest installment from cadalyst but i didn't try it might wanna check it out
-
here try this like i say haven't tried it meself
;;;CADALYST 01/05 Tip2009: mxrefi.lsp Multiple Xref (c) 2005 Leonid Nemirovsky
;;=============================================================
;; BTN by Leonid Nemirovsky 2004
;;=============================================================
(defun c:mxrefi (/ dir pt typ scl ang file lista)
(setq dir (getstring T "X-Ref's Location<Current Folder>: "))
(setq pt (getpoint "\nSelect or Type Insertion Point<0,0>: "))
(if (= pt nil)(setq pt "0,0"))
(initget 1 "Overlay Attach")
(setq typ (getkword "Overlay or Attach <O or A>: "))
(setq scl (getreal "\nScale <1>: "))
(if (= scl nil)(setq scl 1))
(setq ang (getreal "\nRotation Angle<0>: "))
(if (= ang nil)(setq ang 0))
(setq file (getfiled "X-Ref's to attach" dir "dwg" 0))
(command"xref" typ file pt scl scl ang)
(setq lista (list file))
(while
(setq file (getfiled "X-Ref's to attach" dir "dwg" 0))
(setq lista (append (list file) lista))
(command"xref" typ file pt scl scl ang)
)
(princ)
-
I found that one in Cadalyst during lunch, but it's not nearly as good as the one Will posted here already.
The one from XTOOLS, posted by AfricaAD, does exactly what I want, but it has some overhead I need to trim away.
Thanks folks, I appreciate the help.
-
I actually used it for the xref text file export. Since it included everything else, I kept it & use it religiously.
I modified mine a little. I would like to however allow multiple selection in CAD not in the dialogue. Just remember, it requires doslib & it comes with doslib2k. Also, there is 1 command that doesn't work (XM) which requires an outside app.
-
Just remember, it requires doslib & it comes with doslib2k.
That's my only problem with the routine, I've been stung in the past by relying on software that becomes unsupported later.
Also, there is 1 command that doesn't work (XM) which requires an outside app.
I noticed that too, I wonder what's up with that.
-
From what I noticed, I think doslib is only required for the xref name export to text file & to xref files from a text file (which is a pretty good function).
-
From what I noticed, I think doslib is only required for the xref name export to text file & to xref files from a text file (which is a pretty good function).
I haven't had a chance to wade through it yet to see just what's going on, but I plan to do so this week. Thanks for the link.