PDA

View Full Version : Xref Path



Ehsan
2008-03-05, 01:15 PM
Xref
Hi This program is working perfectly and the Path to all Xref's are changed but when i close the drawing and open again it does not load
all the xref from the changed path even though all the xref drawings are there in the changed Path.
Thanks


(defun C:XrefStripPath(/ )
(vl-load-com)
(BrowseForFolder)
(setq jbActiveDoc (vlax-get-property (vlax-get-acad-object) 'activedocument))
(vlax-for X (vla-get-blocks jbActiveDoc)
(if
(= (vlax-get-property X "IsXRef") :vlax-true)
(progn
(setq ssfilter (list (cons 0 "INSERT")(cons 2 (vlax-get-property X "Name"))))
(setq blk (ssget "X" ssfilter))
(if blk
(progn
(setq Xobj (vlax-ename->vla-object (ssname blk 0)))
(setq Path (vlax-get-property xobj "Path"))
(setq Name (strcat (vlax-get-property X "Name") ".Dwg"))
(if (/= Path Name)
(progn
(vlax-put-property Xobj "Path" Name)
;(princ (strcat "The path for" (vlax-get-property x "Name") ".Dwg" "has been stripped!"))
(vlax-put-property Xobj "Path" (strcat Result "\\" Name))
)
(not (princ (strcat "\nNo path saved for" Name)))
)
)
)
)
)
)
(princ)
)

(defun BrowseForFolder ( / sh folder folderobject)
(setq sh (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application"))
(setq folder (vlax-invoke-method sh 'BrowseForFolder 0 "" 0))
(vlax-release-object sh)
(if folder
(progn
(setq folderobject (vlax-get-property folder 'Self))
(setq result (vlax-get-property FolderObject 'Path))
(vlax-release-object folder)
(vlax-release-object FolderObject) result)
)
)


Moderator Note:

Please use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)