TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: hardeight on March 16, 2009, 04:37:25 PM

Title: xref found path information?
Post by: hardeight on March 16, 2009, 04:37:25 PM
I have been trying to find someone with some information on this subject. Is there any way in autolisp to access the found path, not the saved path, of an xref? I have been searching for info and keep coming up empty handed. Se7en tried to help me out on another forum and while he was one of the few who tried to help, he didn't know of a way to access what I was looking for either. here is what the scenario is...

Employees work on their personal edit drive they have write access to.
When a drawing is checked and signed off, I move it to the archive server that only I have write access too. Now, some of their drawings xref parts already on the archive server. So when I move the drawings over, The found path and the saved path are always the same. I am trying to make a database that keeps up with where every drawing is xrefed to. That way, whenever we change a standard part, we can check to see if it will effect any drawings that it is inserted into. I have that lisp written, the only problem is, I only seem to be able to access saved path information. So when I move a drawing folder over that has new basic parts that are xrefed, the found path changes to the new path but the saved path stays the old one. SO I was thinking just add a routine to the beginning of my lisp that updated all found paths and saved them to the saved path. Only problem is, I cant find this information anywhere.....

As of right now I am having to open up the drawing, open classicxref and save all my paths manually. I also tried to get a -classicxref dialog to use in a command statement, but I cant seem to get that to work either.
It would be easier to write a lisp that changes found paths to saved paths.

If anyone out there has any ideas, I would be very very thankful...
Title: Re: xref found path information?
Post by: David Hall on March 16, 2009, 04:43:21 PM
you might have to test this, but I think if you set the path to the path it sees, it will make the saved path the found path.
Title: Re: xref found path information?
Post by: T.Willey on March 16, 2009, 04:50:10 PM
This might be of some help.  Pointed out to me by Joe Burke.

Code: [Select]
(vlax-for i (vla-get-FileDependencies (vla-get-ActiveDocument (vlax-get-Acad-Object)))
    (if (= (vla-get-Feature i) "Acad:XRef")
        (princ (strcat "\n Xref file name [ path ]: " (vla-get-FileName i) " [ " (vla-get-FullFileName i) " ]"))
    )
)
(princ)

This is for the current opened drawing.
Title: Re: xref found path information?
Post by: JohnK on March 16, 2009, 05:03:24 PM
huh?! Would you look at that! ...Very nice!

Thats going into my library.
Title: Re: xref found path information?
Post by: alanjt on March 16, 2009, 10:32:58 PM
This might be of some help.  Pointed out to me by Joe Burke.

Code: [Select]
(vlax-for i (vla-get-FileDependencies (vla-get-ActiveDocument (vlax-get-Acad-Object)))
    (if (= (vla-get-Feature i) "Acad:XRef")
        (princ (strcat "\n Xref file name [ path ]: " (vla-get-FileName i) " [ " (vla-get-FullFileName i) " ]"))
    )
)
(princ)

This is for the current opened drawing.

oh man, i was just trying to figure this out. thank you so much!!!

i just needed a list of the names:
Code: [Select]
(defun XrefNameList (/ #List)
  (vlax-for i (vla-get-FileDependencies
(vla-get-ActiveDocument (vlax-get-Acad-Object))
      ) ;_ vla-get-FileDependencies
    (if (= (vla-get-Feature i) "Acad:XRef")
      (progn
(if (not #List)
  (setq #List (list (vl-filename-base (vla-get-FileName i))))
) ;_ if
(setq
  #List (cons (vl-filename-base (vla-get-FileName i)) #List)
) ;_ setq
      ) ;_ progn
    ) ;_ if
  ) ;_ vlax-for
  (if #List
    (acad_strlsort #List)
  ) ;_ if
) ;_ defun
Title: Re: xref found path information?
Post by: Joe Burke on March 17, 2009, 10:18:22 AM
The FileDependencies collection was added in ACAD 2004. So version checking may be needed...
Title: Re: xref found path information?
Post by: ronjonp on March 17, 2009, 11:07:12 AM
Alanjt,

You could shorten up your function like so. There is no need to check if the list exists.

Code: [Select]
(defun xrefnamelist (/ #list)
  (vlax-for i (vla-get-filedependencies (vla-get-activedocument (vlax-get-acad-object))) ;_ vla-get-FileDependencies
    (if (= (vla-get-feature i) "Acad:XRef")
      (setq #list (cons (vl-filename-base (vla-get-filename i)) #list)) ;_ setq
    ) ;_ if
  ) ;_ vlax-for
  (acad_strlsort #list)
) ;_ defun
Title: Re: xref found path information?
Post by: hardeight on March 17, 2009, 03:38:57 PM
The FileDependencies collection was added in ACAD 2004. So version checking may be needed...

Yep. I have already discovered it isn't available in 2000. Is there an ARX add-on for something like these missing collections?
Title: Re: xref found path information?
Post by: alanjt on March 17, 2009, 08:12:36 PM
Alanjt,

You could shorten up your function like so. There is no need to check if the list exists.

Code: [Select]
(defun xrefnamelist (/ #list)
  (vlax-for i (vla-get-filedependencies (vla-get-activedocument (vlax-get-acad-object))) ;_ vla-get-FileDependencies
    (if (= (vla-get-feature i) "Acad:XRef")
      (setq #list (cons (vl-filename-base (vla-get-filename i)) #list)) ;_ setq
    ) ;_ if
  ) ;_ vlax-for
  (acad_strlsort #list)
) ;_ defun


thanks so much ron, i didn't realize you didn't have to declare a list first.
Title: Re: xref found path information?
Post by: ronjonp on March 18, 2009, 12:28:49 PM
Alanjt,

You could shorten up your function like so. There is no need to check if the list exists.

Code: [Select]
(defun xrefnamelist (/ #list)
  (vlax-for i (vla-get-filedependencies (vla-get-activedocument (vlax-get-acad-object))) ;_ vla-get-FileDependencies
    (if (= (vla-get-feature i) "Acad:XRef")
      (setq #list (cons (vl-filename-base (vla-get-filename i)) #list)) ;_ setq
    ) ;_ if
  ) ;_ vlax-for
  (acad_strlsort #list)
) ;_ defun


thanks so much ron, i didn't realize you didn't have to declare a list first.

 8-)