Author Topic: RELATIVE REPATH XREF LISP HELP NEEDED  (Read 8814 times)

0 Members and 1 Guest are viewing this topic.

mrr_mobile

  • Guest
RELATIVE REPATH XREF LISP HELP NEEDED
« on: January 12, 2010, 03:07:39 PM »
Hello everyone! It's nice to find a good resource for lisp on the net!  I'm glad to be a part of this community! 

I am working on a lisp that can repath a relative path for multiple xrefs in a drawing (I have all details, tb, and plans all xref'd into a sheet). 

This is what I have now:
Code: [Select]
(defun
      c:wds_relative_path (/ AP:SYSVARS AP:UNDOCTL AP:0LD-ERROR)
   (setvar "cmdecho" 0)
   (ap-push-error ap-error)
   (ap-exit-transparent)
   (ap-push-undo nil)
   (ap-push-vars '(("osmode") ("orthomode")))
   (ap-push-command)
   (defun
filename (/ xPathControl2)
      (setq xPathControl1 nil
    xPathControl2
      (strlen xrefPath)
    xFileName1 xrefPath
      )
      (if (wcmatch xFilename1 "*\\*")
(while xPathControl2
    (setq xPathControl1 (substr xFilename1 xPathControl2 1))
    (if (= xPathControl1 "\\")
       (setq xFilename1
       (strcat (substr xFilename1 (1+ xPathControl2)))
     xPathControl2 nil
       )
       (setq xPathControl2 (1- xPathControl2))
    )
)
      )
      (if (wcmatch (strcase xFilename1) "*.DWG")
(setq xFilename1 (substr xFilename1 1 (- (strlen xFilename1) 4)))
      )
      (eval xFilename1)
   )
   (defun
xrefpathmod ()
      (setq relativePath xrefPath)
      (if (wcmatch (strcase relativePath) "*.DWG")
(setq relativePath (substr relativePath 1 (- (strlen relativePath) 4)))
      )
      (setq relativePath
      (substr
relativePath
1
(- (strlen relativePath) (strlen xrefFilename))
      )
      )
      (if (wcmatch relativePath "*:*")
(setq relativePath (substr relativePath 3))
      )
      (if (wcmatch (substr dwgPath (strlen dwgPath) 1) "\\")
(setq dwgPath (substr dwgPath 1 (1- (strlen dwgPath))))
      )
      (if (wcmatch relativePath "*ws-div1*")
(progn (setq flag 0)
(while (= flag 0)
   (if (wcmatch (substr relativePath 1 7) "ws-div1")
      (progn (setq relativePath (substr relativePath 9))
     (setq flag 1)
      )
      (setq relativePath (substr relativePath 2))
   )
)
)
      )
      (if (wcmatch (strcase dwgPath) "*ws-div1*")
(progn (setq flag 0)
(while (= flag 0)
   (if (wcmatch (strcase (substr dwgPath 1 7)) "ws-div1")
      (progn (setq dwgPath (substr dwgPath 8)) (setq flag 1))
      (setq dwgPath (substr dwgPath 2))
   )
)
)
      )
      (setq control1 0
    control2 nil
    count 0
    x dwgPath
      )
      (while (/= control1 (strlen x))
(setq control1 (1+ control1)
       control2 (substr x control1 1)
)
(if (= control2 "\\")
    (setq count (1+ count))
)
      )
      (repeat count (setq relativePath (strcat ".." (chr 92) relativePath)))
   )
   (defun
wds_relative_path_main ()
      (setq xref 1
    flag 0
      )
      (while xref
(if (= flag 0)
    (setq xref (tblnext "block" t))
    (setq xref (tblnext "block"))
)
(setq flag 1)
(if xref
    (progn
       (setq dwgPath (getvar "dwgprefix"))
       (if (member (cdr (assoc 70 xref)) '(36 44))
  (progn
     (setq xrefPath
     (strcase (cdr (assoc 1 xref)))
   xrefFilename
     (filename)
   xrefName
     (strcase (cdr (assoc 2 xref)))
     )
     (if (and (= (strcase (substr xrefPath 1 1))
(strcase (substr dwgPath 1 1))
      )
      (wcmatch (strcase xrefPath) "*:*")
)
(progn (if (wcmatch (strcase xrefPath) "*:*")
  (progn (xrefpathmod)
(if relativePath
    (progn (setq relativePath
   (strcase
      (strcat
relativePath
xrefFilename
".dwg"
      )
      t
   )
   )
   (if (findfile relativePath)
      (progn (command
"xref"
"path"
xrefName
relativePath
     )
      )
   )
    )
)
  )
       )
)
     )
  )
       )
    )
)
      )
      (princ)
   )
   (wds_relative_path_main)
   (ap-pop-command)
   (ap-pop-vars)
   (ap-pop-undo)
   (ap-pop-error)
   (princ)
)
 ;|«Visual LISP© Format Options»
(80 3 1 2 nil "end of " 80 5 0 0 0 T nil nil T)
;*** DO NOT add text below the comment! ***|;

I am new to lisp (know enough to be dangerous) and I can't get this to work.  I would like to click a button on the toolbar to invoke the command for this lisp and have it automatically change all the xref paths to relative and repath to the folder in the job file.

My file structure is:

Job Folder
   -CAD
       -XREFS

The sheet where everything is referenced into is located in the CAD folder and the Xrefs are located in the XREFS folder.

I am using a modified version of AutoCAD LT 2008 that can run lisp files and such.

If anyone could help me, it would be greatly appreciated.

Let me know if anything needs clarification.

Thanks,
Mike

Joe Burke

  • Guest
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #1 on: January 13, 2010, 06:25:20 AM »
Mike,

I've been thinking about a routine which may do what you want. I have some experience in the area of repathng xrefs.

Stay tuned...

mrr_mobile

  • Guest
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #2 on: January 13, 2010, 09:57:54 AM »
Thank you, I'm excited to see what you have.  I can't wait!

Thanks again Joe!

mrr_mobile

  • Guest
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #3 on: January 19, 2010, 12:22:30 PM »
I was just wondering if anyone had any ideas on this....  I am really in need of this and I'm stuck.

Thanks in advance for any help.

Mike

CTMill

  • Newt
  • Posts: 120
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #4 on: January 25, 2010, 11:45:22 AM »
If you have Toolpac, you can use Drawing>Repath.  It allows you to do a find/replace on the file paths.  

Have you tried using Autodesk's reference manager?


Either of these will aloow you to do a find/replace on a group of drawings.  It involves some trial and error.  But once you figure out your preferred settings, it works like a charm.  It's not what you're looking for.  But I think it'll get you the same results.  And probably faster because you can update more than one drawing unlike your lisp command.  Good luck!
« Last Edit: January 25, 2010, 12:18:14 PM by CTMill »
Civ3d/A2K16

mrr_mobile

  • Guest
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #5 on: January 25, 2010, 12:46:59 PM »
What I have is called Toolbox LT.  It doesn't seem to have the function of Drawing>Repath.  

I have multiple sheets with multiple xrefs in them.  The xrefs have their own folder in each project directory.  I would like to be able to set up a template job and copy all files from that directory to the job folders and when I go into each drawing, be able to click a button that is linked to the lisp file and repath all xrefs in that drawing to the current job xref folder.

If that can be done, that is...  I am not worried about the relative pathing...  If the file names are different (new job #) it won't do any good anyway...

Let me know if anyone has any ideas.

Thanks,
Mike

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #6 on: January 25, 2010, 12:59:57 PM »
First attempt (well actually, an oldie i had laying around i modified slightly):
Code: [Select]
(defun c:relpath ( / )
   ;;
   ;; TODO:
   ;;          echo off?
   ;;          need to test with nested xrefs?
   ;;

   (defun StringStrip-End (Str Char)
     ;; Strip the end of a string off.
     ;; e.g. (StringStrip-End "This is a test" "i")
     ;;   -> "This "
     (defun ListStriper (lst dec)
       (if (= (car lst) dec)
(cdr lst)
(ListStriper (cdr lst) dec)) )
     (if (not (and Str Char))
       ""
     (vl-List->String
       (reverse
(ListStriper (reverse (vl-string->list Str)) (ascii Char)))) ))

   (defun strParse (aStr delim / strList pos)
      (while (setq pos (vl-string-search delim aStr 0))
             (setq strList (cons (substr aStr 1 POS) strList)
                   aStr    (substr aStr (+ pos 2))))
      (reverse (cons aStr strList)) )

   ( (lambda (/ entry xname xpath saved-xref-name)
       (while
         ;; itterate thru all xrefs in dwg

        (setq entry (tblnext "block" (not entry)))
         ;; get the first block

         (if (cdr (assoc 1 entry))
           ;; check to see if it has a path
           ;;
           ;; if it does...
           (progn
             (setq saved-xref-name (cdr (assoc 2 entry))
             ;; get the name saved in database
                   xname (strcase (car (reverse (strParse (cdr (assoc 1 entry)) "\\"))))
             ;; get the drawing name saved for name in database
                   xpath (strcat "..\\XREFS\\" xname) )
             ;; set a reletive path based upon standards.
             (if (findfile xpath)
               ;; try to find the drawing with the reletive path
               ;;
               ;; if found... then load it
               (command "-xref" "path" saved-xref-name xpath)

               (if (eq
             (strcat
               (StringStrip-End
        (findfile xname)
        "\\"
               )
               "\\"
             )
             (getvar 'DWGPREFIX)
           )
;; If all else fails, check to see if the saved
                 ;; path is the same as the current drawing path...
        ;; Lets hope this is the place for the drawing
        (command "-xref" "path" saved-xref-name (strcat ".\\" xname))
               ); if
               ;; make it reletive based on working drawing path.
               ;;
               ;; NOTE: *bleh*...but I cant think of another way right now.
             );if
           ); progn
         ); if
      ); while
      (princ)
    )
   )
 )
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

mrr_mobile

  • Guest
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #7 on: January 25, 2010, 01:18:58 PM »
I tried this routine and nothing happened at all in the command line.  Just wondering what part of code I need to edit...

Thanks,
Mike

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #8 on: January 25, 2010, 01:20:45 PM »
You shouldn't have to mod anything.
cut and paste "results"  from the command line here.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

mrr_mobile

  • Guest
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #9 on: January 25, 2010, 01:32:25 PM »
This is what i have from the time I open the drawing to the time I run "relpath"

Code: [Select]
Opening an AutoCAD LT 2007/AutoCAD 2007 format file.
Loading AEC Base...
Loading AEC Base Extended...
Loading AEC Base UI...
Loading AEC Project Base...
Loading AEC Schedule Data...
Loading AEC Architectural Base...
Loading AEC Structural Base...
Loading AEC Area Base...
Loading AEC Dimensions Base...
Loading AEC Schedule...
Resolve Xref "TB": j:\mbe projects\2009\09084.1\09084.1_cad\09084.1_xref\tb.dwg
beginattach C:\DOCUME~1\MICHAE~1\LOCALS~1\Temp\tb$0$.ac$
"TB" loaded: J:\mbe projects\2009\09084.1\09084.1_cad\09084.1_xref\tb.dwg
endattach
Resolve Xref "_MARC_LA-SEAL": J:\MBE_Reference Library\WBLOCK
LIBRARY\Seals\Marc Barry\_MARC_LA-SEAL.dwg
beginattach C:\DOCUME~1\MICHAE~1\LOCALS~1\Temp\_MARC_LA-SEAL$0$.ac$
"_MARC_LA-SEAL" loaded.
endattach
Resolve Xref "_95% COORDINATION": ..\..\..\..\MBE_Reference Library\WBLOCK
LIBRARY\Title Blocks\_95% COORDINATION.dwg
beginattach C:\DOCUME~1\MICHAE~1\LOCALS~1\Temp\_95% COORDINATION$0$.ac$
"_95% COORDINATION" loaded: J:\MBE_Reference Library\WBLOCK LIBRARY\Title
Blocks\_95% COORDINATION.dwg
endattach
Resolve Xref "S1.2 - PEDESTAL DETAILS": j:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - pedestal details.dwg
beginattach C:\DOCUME~1\MICHAE~1\LOCALS~1\Temp\s1$0$.ac$
"S1.2 - PEDESTAL DETAILS" loaded: J:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - pedestal details.dwg
endattach
Resolve Xref "S1.2 - TYP DRILLED PIER DETAIL": j:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ drilled pier
detail.dwg
beginattach C:\DOCUME~1\MICHAE~1\LOCALS~1\Temp\s1$1$.ac$
"S1.2 - TYP DRILLED PIER DETAIL" loaded: J:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ drilled pier
detail.dwg
endattach
Resolve Xref "S1.2 - TYP GRADE BEAM CORNER DETAIL": j:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ grade beam corner
detail.dwg
beginattach C:\DOCUME~1\MICHAE~1\LOCALS~1\Temp\s1$2$.ac$
"S1.2 - TYP GRADE BEAM CORNER DETAIL" loaded: J:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ grade beam corner
detail.dwg
endattach
Resolve Xref "S1.2 - TYP GRADE BEAM DETAIL": j:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ grade beam detail.dwg
beginattach C:\DOCUME~1\MICHAE~1\LOCALS~1\Temp\s1$3$.ac$
"S1.2 - TYP GRADE BEAM DETAIL" loaded: J:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ grade beam detail.dwg
endattach
Resolve Xref "S1.2 - TYP.RE-ENTRANT CORNER DETAIL-OPT-2": j:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ.re-entrant corner
detail-opt-2.dwg
beginattach J:\mbe projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 -
typ.re-entrant corner detail-opt-2.dwg
"S1.2 - TYP.RE-ENTRANT CORNER DETAIL-OPT-2" loaded: J:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ.re-entrant corner
detail-opt-2.dwg
endattach
Resolve Xref "S1.2 - TYP TIE BEAM DETAIL": J:\MBE
Projects\2009\09084.1\09084.1_Cad\09084.1_Xref\S1.2 - TYP TIE BEAM DETAIL.dwg
beginattach J:\MBE Projects\2009\09084.1\09084.1_Cad\09084.1_Xref\S1.2 - TYP
TIE BEAM DETAIL.dwg
"S1.2 - TYP TIE BEAM DETAIL" loaded.
endattach
Resolve Xref "S1.2 - TYP COL CONEC @ EXIST DETAIL": .\09084.1_Xref\S1.2 - TYP
COL CONEC @ EXIST DETAIL.dwg
"S1.2 - TYP COL CONEC @ EXIST DETAIL.dwg" cannot be found.
Resolve Xref "S1.2 - 4 IN S.O.G.- CSJ - DTL - WWF": .\09084.1_Xref\S1.2 - 4 IN
S.O.G.- CSJ - DTL - WWF.dwg
"S1.2 - 4 IN S.O.G.- CSJ - DTL - WWF.dwg" cannot be found.
Resolve Xref "S1.2 - 4 IN S.O.G.- CJ - DTL - WWF": .\09084.1_Xref\S1.2 - 4 IN
S.O.G.- CJ - DTL - WWF.dwg
"S1.2 - 4 IN S.O.G.- CJ - DTL - WWF.dwg" cannot be found.
opened 7EF9BB88, J:\MBE Projects\2009\09084.0\09084.0_Cad\09084.0_S1.2.dwg
Regenerating model.
Command:
* LTE 2007-2008 : ExpressTools Vol.1-9 Support - OK
* (arxload) : can not FIND file <C:/Program Files/GlobalCAD/Toolbox LT
2009/GCADgsBaseLT2007.arx>
MOVEBAK command loaded.
 Type "ssx" at a Command: prompt or
 (ssx) at any object selection prompt. MOVEBAK command loaded.
 Type "ssx" at a Command: prompt or
 (ssx) at any object selection prompt.
Command:
Command:
Command: -xref
Enter an option [?/Bind/Detach/Path/Unload/Reload/Overlay/Attach] <Attach>: r
Enter xref name(s) to reload: *
Reload Xref "TB": j:\mbe projects\2009\09084.1\09084.1_cad\09084.1_xref\tb.dwg
J:\mbe projects\2009\09084.1\09084.1_cad\09084.1_xref\tb.dwg has not changed.
Reload Xref "_MARC_LA-SEAL": J:\MBE_Reference Library\WBLOCK LIBRARY\Seals\Marc
Barry\_MARC_LA-SEAL.dwg
J:\MBE_Reference Library\WBLOCK LIBRARY\Seals\Marc Barry\_MARC_LA-SEAL.dwg has
not changed.
Reload Xref "S1.2 - PEDESTAL DETAILS": j:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - pedestal details.dwg
J:\mbe projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - pedestal
details.dwg has not changed.
Reload Xref "S1.2 - TYP DRILLED PIER DETAIL": j:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ drilled pier
detail.dwg
J:\mbe projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ drilled pier
detail.dwg has not changed.
Reload Xref "S1.2 - TYP GRADE BEAM CORNER DETAIL": j:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ grade beam corner
detail.dwg
J:\mbe projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ grade beam
corner detail.dwg has not changed.
Reload Xref "S1.2 - TYP GRADE BEAM DETAIL": j:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ grade beam detail.dwg
J:\mbe projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ grade beam
detail.dwg has not changed.
Reload Xref "S1.2 - TYP.RE-ENTRANT CORNER DETAIL-OPT-2": j:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ.re-entrant corner
detail-opt-2.dwg
beginattach C:\DOCUME~1\MICHAE~1\LOCALS~1\Temp\s1.2 - typ.re-entrant corner
detail-opt-2$0$.ac$
"S1.2 - TYP.RE-ENTRANT CORNER DETAIL-OPT-2" loaded: J:\mbe
projects\2009\09084.1\09084.1_cad\09084.1_xref\s1.2 - typ.re-entrant corner
detail-opt-2.dwg
endattach
Reload Xref "_95% COORDINATION": ..\..\..\..\MBE_Reference Library\WBLOCK
LIBRARY\Title Blocks\_95% COORDINATION.dwg
J:\MBE_Reference Library\WBLOCK LIBRARY\Title Blocks\_95% COORDINATION.dwg has
not changed.
Reload Xref "S1.2 - TYP COL CONEC @ EXIST DETAIL": .\09084.1_Xref\S1.2 - TYP
COL CONEC @ EXIST DETAIL.dwg
"S1.2 - TYP COL CONEC @ EXIST DETAIL.dwg" cannot be found.
*Invalid*
Command: Specify opposite corner:
Command: relpath

Thi is what i get ... nothing... LOL

Thanks for the help...

Mike

mrr_mobile

  • Guest
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #10 on: January 25, 2010, 01:33:32 PM »
I forgot to mention the project number for this job is 09084.0 instead...  That is the number i am trying to change...

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #11 on: January 25, 2010, 01:39:22 PM »
Hi,

If they're nested xref, it's needed to use a recursive process so that the nested xrefs path is relative to their parent folder.

Code: [Select]
;; XREL
;; Set relative path to all xref attached to the current drawing

(defun c:xrel (/ fltr ss)
  (vl-load-com)
  (or *acad* (setq *acad* (vlax-get-acad-object)))
  (or *acdoc* (setq *acdoc* (vla-get-ActiveDocument *acad*)))
  (or *blocks* (setq *blocks* (vla-get-Blocks *acdoc*)))

  (defun relpath (blk fold / path def)
    (setq path (vla-get-Path blk))
    (if (findfile path)
      (progn
        (vla-put-Path blk (GetRelativePath fold path))
        (vla-Reload blk)
        (vlax-for obj blk
          (if (and
                (= (vla-get-ObjectName obj) "AcDbBlockReference")
                (= (vla-get-IsXref
                     (setq def (vla-Item *blocks* (vla-get-Name obj)))
                   )
                   :vlax-true
                )
              )
            (relpath def (vl-filename-directory path))
          )
        )
      )
    )
  )
   
  (setq fold (getvar 'dwgprefix)
        fltr ""
  )
  (vlax-for blk *blocks*
    (if (= (vla-get-IsXref blk) :vlax-true)
      (setq fltr (strcat fltr (vla-get-Name blk) ","))
    )
  )
  (if (ssget "_X" (list (cons 0 "INSERT") (cons 2 fltr)))
    (progn
      (vlax-for xr (setq ss (vla-get-ActiveSelectionSet *acdoc*))
        (relpath (vla-Item *blocks* (vla-get-Name xr)) fold)
      )
    )
  )
  (princ)
)



;; GetRelativePath (gile)
;; returns the relative path according to a folder path
;;
;; Arguments
;; dir : the folder complete path
;; file : the complete filename

(defun GetRelativePath (dir file / a b)
  (setq dir (vl-string-right-trim "\\" dir))
  (if (/= (strcase (substr dir 1 1)) (strcase (substr file 1 1)))
    file
    (progn
      (while
        (= (strcase (substr dir 1 (setq a (vl-string-position 92 dir))))
           (strcase (substr file 1 (setq b (vl-string-position 92 file))))
        )
         (setq dir (if a
                   (substr dir (+ 2 a))
                   ""
                 )
               file (substr file (+ 2 b))
         )
      )
      (if (= dir "")
        (strcat ".\\" file)
        (progn
          (while (setq a (vl-string-position 92 dir))
            (setq file (strcat "..\\" file)
                  dir (substr dir (+ 2 a))
            )
          )
          (strcat "..\\" file)
        )
      )
    )
  )
)
Speaking English as a French Frog

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #12 on: January 25, 2010, 01:49:01 PM »

cut and paste the relsults from this please:
Code: [Select]
( (lambda (/ entry xname xpath saved-xref-name)
    (while
      ;; itterate thru all xrefs in dwg
      (setq entry (tblnext "block" (not entry)))
      ;; get the first block
      (if (cdr (assoc 1 entry))
        ;; check to see if it has a path (is an xref)
        ;;
        ;; if it does..
        (if (zerop (logand (cdr (assoc 70 entry)) 32))
          (princ
             (strcat
               "\nExternal Reference is unloaded, but its saved path is: "
               "\""
               (cdr (assoc 1 entry))
               "\""
               ))
           (princ
              (strcat "\nExternal Reference is loaded and its saved path is: "
              "\""
              (cdr (assoc 1 entry))
              "\""
              ))
          )
        ) ; if
      ); while
    (princ)
    )
 )
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #13 on: January 25, 2010, 01:50:29 PM »
Try gile's.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

mrr_mobile

  • Guest
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #14 on: January 25, 2010, 02:25:21 PM »
This is what I got...

I ran both and the results are below...

Code: [Select]
Command: lambda
Unknown command "LAMBDA".  Press F1 for help.
Command:
Command:
Command: lisp
Lisp Expression [Return] > lambda
SPECIAL-FORM
Lisp Expression [Return] >
Command: lambda
Unknown command "LAMBDA".  Press F1 for help.
Command: xrel
beginattach C:\DOCUME~1\MICHAE~1\LOCALS~1\Temp\S1.2 - TYP TIE BEAM DETAIL$0$.ac$
endattach
beginattach C:\DOCUME~1\MICHAE~1\LOCALS~1\Temp\s1.2 - typ.re-entrant corner
detail-opt-2$0$.ac$
endattach
Command: Specify opposite corner:
Command: Specify opposite corner:
Command: Specify opposite corner:
Command:
Command:
Command: lisp
Lisp Expression [Return] > xrel
NIL
Lisp Expression [Return] >

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: RELATIVE REPATH XREF LISP HELP NEEDED
« Reply #15 on: January 25, 2010, 02:36:22 PM »
huh? that make little to no sense. Here is what i got:
Quote
Command: ( (lambda (/ entry xname xpath saved-xref-name)
((_>     (while
(((_>       ;; itterate thru all xrefs in dwg
(((_>       (setq entry (tblnext "block" (not entry)))
(((_>       ;; get the first block
(((_>       (if (cdr (assoc 1 entry))
((((_>         ;; check to see if it has a path (is an xref)
((((_>         ;;
((((_>         ;; if it does..
((((_>         (if (zerop (logand (cdr (assoc 70 entry)) 32))
(((((_>           (princ
((((((_>              (strcat
(((((((_>                "\nExternal Reference is unloaded, but its saved path
is: "
(((((((_>                "\""
(((((((_>                (cdr (assoc 1 entry))
(((((((_>                "\""
(((((((_>                ))
(((((_>            (princ
((((((_>               (strcat "\nExternal Reference is loaded and its saved
path is: "
(((((((_>               "\""
(((((((_>               (cdr (assoc 1 entry))
(((((((_>               "\""
(((((((_>               ))
(((((_>           )
((((_>         ) ; if
(((_>       ); while
((_>     (princ)
((_>     )
(_>  )

External Reference is loaded and its saved path is:
"C:\tmp\Xref-paths\XREFS\Drawing1.dwg"
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org