Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Open File Location with commas in dwg name

4 REPLIES 4
Reply
Message 1 of 5
kzD1219
269 Views, 4 Replies

Open File Location with commas in dwg name

I am aware of the option to right-click the tab of the drawing I am working in to open up Windows Explorer and it works fine, but for years I have been using a lisp routine that was on here.  But we changed the format of some of our drawing names to work with our databases and now some of have a lengthy drawing name with commas and this lisp routine doesn't work anymore for some drawings.  Is there any way to update this lisp to make it work like it is, and add something about the commas or spaces in a drawing?  Note the space between the comma for Street and year.  The space indicates misc info that can easily be deleted, doesn't have to be a date.  

 

(defun c:FL () (startapp (strcat "explorer /select, " (getvar "dwgprefix") (getvar "dwgname") ", /e")) (princ))

 

It only doesn't work when I have two different drawing names for example

00000,xxx,lot 22,Civic 22,99999,1-1-1,Street, YYYY MM DD.dwg

00000,P#xxxxx,99999,1-1-1,Street, YYYY MM DD.dwg

 

 

4 REPLIES 4
Message 2 of 5
komondormrex
in reply to: kzD1219

maybe like this

(defun c:FL () (startapp (strcat "explorer /select, " (strcat (getvar "dwgprefix") (getvar "dwgname")) ", /e")) (princ))

 

Message 3 of 5
Kent1Cooper
in reply to: kzD1219

Is the idea simply to open the folder the current drawing is in so that you can choose another drawing to open there?  If so, I've used this little command for a long time:

;;;  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.")

and for me, it works if the current drawing's name contains commas.

 

If that's not what you're after, can you describe the purpose in more detail?

Kent Cooper, AIA
Message 4 of 5
kzD1219
in reply to: Kent1Cooper


@Kent1Cooper wrote:

Is the idea simply to open the folder the current drawing is in so that you can choose another drawing to open there?  If so, I've used this little command for a long time:

 

;;;  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.")

 

and for me, it works if the current drawing's name contains commas.

 

If that's not what you're after, can you describe the purpose in more detail?


So what I use the lisp for is to be in the current drawing, then just type in a simple command to open up Windows Explorer to where the drawing is saved.  That way I can get to the research folders for that job quicker.  It just is a quicker way than opening up windows Explorer and finding the job file which is more than a few mouse clicks.

 

I see hows yours works and that is great for drawings, but I am looking for the Windows Explorer location, just like when you right click the drawing tab in acad.  Ever since we adopted the commas in the drawing name, those particular drawings don't work unfortunately.

 

@komondormrex that just seems to take me right to Windows Explorer Home and not to the job folder.

 

So for example:  I am in a drawing named 00000,xxx,lot 22,Civic 22,99999,1-1-1,Street, YYYY MM DD.dwg and I would like to use the lisp routine to take me to Windows Explorer right where that drawing is saved in the file folder so I can access the other research folders in that job.  Any other drawing will open, but is seems since we added the commas, it doesn't like them.

Message 5 of 5
Sea-Haven
in reply to: kzD1219

Try this

 (startapp "explorer" file)

(startapp "explorer" (getvar 'dwgprefix))

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report