browse for xref from current directory

browse for xref from current directory

robert06
Collaborator Collaborator
1,538 Views
8 Replies
Message 1 of 9

browse for xref from current directory

robert06
Collaborator
Collaborator

I'd like xref command to open current drawing folder window to browse for attaching xref, by default it opens a directory used previous time for adding a xref.

 

(command "-xref" "o" |open current drawing location window for browsing| "0,0,0" "1" "1" "0")

 

Thanks!

0 Likes
Accepted solutions (2)
1,539 Views
8 Replies
  • xref
Replies (8)
Message 2 of 9

ВeekeeCZ
Consultant
Consultant

HERE is a similar example.

Message 3 of 9

Kent1Cooper
Consultant
Consultant
Accepted solution

Here is what I use to open a Drawing in the Current Folder:

;;;  DwgCurrentFolder.lsp
;;;  to open a Drawing in the Current drawing's Folder
(defun C:DCF ()
  (vla-activate
    (vla-open
      (vla-get-documents
        (vlax-get-acad-object)
      )
      (getfiled "Select drawing:" (getvar 'dwgprefix) "dwg" 0)
    )
  )
)
(prompt "\nType DCF to open a Drawing in the Current Folder.")

Can you modify that for your purpose?

Kent Cooper, AIA
Message 4 of 9

robert06
Collaborator
Collaborator

Nice & easy, this works fine, thanks:
(command "-xref" "o" (getfiled "Select drawing:" (getvar 'dwgprefix) "dwg" 0) "0,0,0" "1" "1" "0")

 

I wonder if there is a way to make the getfield window scaleable like a regular file browser window?

0 Likes
Message 5 of 9

robert06
Collaborator
Collaborator
Sorry i could not make use of the method using registry values and windows profile data.
0 Likes
Message 6 of 9

robert06
Collaborator
Collaborator
Still, it gave a clue, thanks! Here's an useful option to set all default paths by 'dwgprefix
https://www.cadtutor.net/forum/topic/67098-open-and-saveas-default-path/
0 Likes
Message 7 of 9

ronjonp
Mentor
Mentor

@robert06 Figured out what key was missing. I've updated the code @ CadTutor.

;; ;; RJP » 2022-01-05 -XREF dialog key
			("Select Reference File" "InitialDirectory")

 

0 Likes
Message 8 of 9

robert06
Collaborator
Collaborator
Accepted solution

thank you to @ronjonp for further improvements at the link

https://www.cadtutor.net/forum/topic/67098-open-and-saveas-default-path/

0 Likes
Message 9 of 9

ronjonp
Mentor
Mentor

@robert06 @ You're welcome👍

0 Likes