Author Topic: Export Support Paths To Text File  (Read 1485 times)

0 Members and 1 Guest are viewing this topic.

deegeecees

  • Guest
Export Support Paths To Text File
« on: June 17, 2008, 01:42:54 PM »
It's been a while, and I just need a jump start, does anyone have anything that will do this?

deegeecees

  • Guest
Re: Export Support Paths To Text File
« Reply #1 on: June 17, 2008, 01:53:06 PM »
NM, found something:

http://www.theswamp.org/index.php?topic=442.0

Thanks Mark!

FengK

  • Guest
Re: Export Support Paths To Text File
« Reply #2 on: June 17, 2008, 02:09:17 PM »
It's a little late, but since I've typed them up.

Code: [Select]
(defun C:ExportSupportPaths (/ strPaths file outputPath)
  (setq strPaths (vla-get-supportpath
   (vla-get-files
     (vla-get-preferences (vlax-get-acad-object)
     )
   )
)
  )
  (setq file (open
       (setq outputPath (strcat (getvar "DWGPREFIX") "current_support_paths.txt"))
       "W"
     )
  )
  (foreach strPath (string_split str ";")
    (write-line strPath file)
  )
  (close file)
  (prompt
    (strcat "\nSupport paths exported to \"" outputPath "\".")
  )
 
  (princ)
)

(defun string_split (str delimiter / lenStr lenDelimiter start@ lstStr done find@)
  (setq lenStr      (strlen str)
lenDelimiter (strlen delimiter)
start@      0
lstStr      nil
done      nil
  )
  (while (and (not done) (<= (1+ start@) lenStr))
    (if (setq find@ (vl-string-search delimiter str start@))
      (setq lstStr (cons
     (if (zerop find@)
       ""
       (substr str (1+ start@) (- find@ start@))
     )
     lstStr
   )
    start@ (+ find@ lenDelimiter)
      )
      (setq done   t
    lstStr (cons (substr str (1+ start@)) lstStr)
      )
    )
  )
  (if (= start@ lenStr)
    (setq lstStr (cons "" lstStr))
  )
  (reverse lstStr)
)

deegeecees

  • Guest
Re: Export Support Paths To Text File
« Reply #3 on: June 17, 2008, 02:14:56 PM »
Thanks Kelie, nice work.