XREF absolute versus relative, no additonal tools needed>.

 Simply enter xref
The drawing explorer starts.

Click on the saved path and set a point before the first /

Example:

Absolute path is Z:/company/aaa/bbb/ccc/ddd/xref/drawing.dwg

Click on it and set a point just before /xref
Then press enter an save the drawing. From then relative.

Works also under other cad applications.

Comments

  •  this lisp function is what I use:
    [code];;;------------absolute to relative path----------------
    ;IDEA IS TO GET RID OF PORTIONS OF PATH THAT MATCH, AND REPLACE FOLDERS THAT DO NOT WITH ..
    ;NO CROSS DRIVES ALLOWED
    ;IF PATH MATCHES, STRIP IT TO BARE FILENAME

    ;(CONV-PATH-ABS-TO-REL "C:\\Storage\\Programming\\Lisp2\\PurgeIds2\\Development.dwg" "C:\\Storage\\Programming\\Lisp\\PurgeIds\\Development.dwg")
    ;GIVES "..\\..\\Lisp2\\PurgeIds2\\Development.dwg"
    ;(CONV-PATH-ABS-TO-REL "D:\\0001\\Engineering\\Base Files\\1E-OA_Project-CALC.dwg" "D:\\0001\\Engineering\\test1.dwg")


    (DEFUN CONV-PATH-ABS-TO-REL (CHG-FILENAME CUR-FILENAME / DWG_NAME N LAST_N DNAME XRELNAME DL)
      ;IF ON SAME DRIVE
      (COND
        ;SAME PATHccf
        ((= (STRCASE (vl-filename-directory CUR-FILENAME)) (STRCASE (vl-filename-directory CHG-FILENAME)))
          (SETQ xRELname (vl-filename-base CHG-FILENAME)) ;NAME ONLY
        )
        ;ON SAME DRIVE
        ((= (STRCASE (SUBSTR CUR-FILENAME 1 1)) (STRCASE (SUBSTR CHG-FILENAME 1 1)))
          (SETQ n 1)
          (SETQ last_n 1)
    ;;;WHILE PREFIXS ARE SAME, KEEP TRACK OF INDEX
          (while (= (STRCASE (SUBSTR CUR-FILENAME n 1)) (STRCASE (SUBSTR CHG-FILENAME n 1)))
            (IF (= (SUBSTR CHG-FILENAME n 1) (chr 92))
              (SETQ last_n n)
            )
            (SETQ n (1+ n))
          )
         ;NOW STRIP OUT AND ADD BACK STARTING AT N
          (SETQ dname (SUBSTR CUR-FILENAME (+ last_n 1))
                xRELname (SUBSTR CHG-FILENAME (+ last_n 1))
          )
          (SETQ dl (STRLEN CUR-FILENAME))
          (SETQ n 1)
          (REPEAT dl
            (IF (= (SUBSTR dname n 1) (chr 92))
              (SETQ xRELname (STRCAT ".." (chr 92) xRELname))
            )
            (SETQ n (1+ n))
          )
        )
        ;NOT ON SAME DRIVE
        ((/= (STRCASE (SUBSTR CUR-FILENAME 1 1)) (STRCASE (SUBSTR CHG-FILENAME 1 1)))
          (SETQ xRELname CHG-FILENAME) ;FULL PATH
        )
      )
      xRELname
    )[/code]
  •  my gosh, looks like insert code adds a billion empty lines!
    Use this:
    ;;;------------absolute to relative path----------------
    ;IDEA IS TO GET RID OF PORTIONS OF PATH THAT MATCH, AND REPLACE FOLDERS THAT DO NOT WITH ..
    ;NO CROSS DRIVES ALLOWED
    ;IF PATH MATCHES, STRIP IT TO BARE FILENAME

    ;(CONV-PATH-ABS-TO-REL "C:\\Storage\\Programming\\Lisp2\\PurgeIds2\\Development.dwg" "C:\\Storage\\Programming\\Lisp\\PurgeIds\\Development.dwg")
    ;GIVES "..\\..\\Lisp2\\PurgeIds2\\Development.dwg"
    ;(CONV-PATH-ABS-TO-REL "D:\\0001\\Engineering\\Base Files\\1E-OA_Project-CALC.dwg" "D:\\0001\\Engineering\\test1.dwg")


    (DEFUN CONV-PATH-ABS-TO-REL (CHG-FILENAME CUR-FILENAME / DWG_NAME N LAST_N DNAME XRELNAME DL)
      ;IF ON SAME DRIVE
      (COND
        ;SAME PATHccf
        ((= (STRCASE (vl-filename-directory CUR-FILENAME)) (STRCASE (vl-filename-directory CHG-FILENAME)))
          (SETQ xRELname (vl-filename-base CHG-FILENAME)) ;NAME ONLY
        )
        ;ON SAME DRIVE
        ((= (STRCASE (SUBSTR CUR-FILENAME 1 1)) (STRCASE (SUBSTR CHG-FILENAME 1 1)))
          (SETQ n 1)
          (SETQ last_n 1)
    ;;;WHILE PREFIXS ARE SAME, KEEP TRACK OF INDEX
          (while (= (STRCASE (SUBSTR CUR-FILENAME n 1)) (STRCASE (SUBSTR CHG-FILENAME n 1)))
            (IF (= (SUBSTR CHG-FILENAME n 1) (chr 92))
              (SETQ last_n n)
            )
            (SETQ n (1+ n))
          )
         ;NOW STRIP OUT AND ADD BACK STARTING AT N
          (SETQ dname (SUBSTR CUR-FILENAME (+ last_n 1))
                xRELname (SUBSTR CHG-FILENAME (+ last_n 1))
          )
          (SETQ dl (STRLEN CUR-FILENAME))
          (SETQ n 1)
          (REPEAT dl
            (IF (= (SUBSTR dname n 1) (chr 92))
              (SETQ xRELname (STRCAT ".." (chr 92) xRELname))
            )
            (SETQ n (1+ n))
          )
        )
        ;NOT ON SAME DRIVE
        ((/= (STRCASE (SUBSTR CUR-FILENAME 1 1)) (STRCASE (SUBSTR CHG-FILENAME 1 1)))
          (SETQ xRELname CHG-FILENAME) ;FULL PATH
        )
      )
      xRELname
    )
This discussion has been closed.