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

Displaying full path in AutoCad 2004

12 REPLIES 12
Reply
Message 1 of 13
Anonymous
269 Views, 12 Replies

Displaying full path in AutoCad 2004

I'm having problems in one of my lisp routines. I have a find routine where you input a drawing name (ex. 888-0001) and it searches through all the 888 directories for the drawing 0001.dwg. The routine seems to find the drawings, but it doesn't display the full drawing path in the results. This routine worked fine in AutoCAD 2000. The only change is I am now using the latest Doslib2004. Any idea? The link below shows what I'm talking about. Thanks!

http://www.ezimprovement.com/autocad.html
12 REPLIES 12
Message 2 of 13
BillZ
in reply to: Anonymous

Some dos_lib functions have changed slightly in 2004.

Dos_find is a little different now.

Look in the Dos_help files.

Bill
Message 3 of 13
Anonymous
in reply to: Anonymous

I do not use the dos_find command... this is part of the code:

;--------- Search Released

(If (= "1" Search_R)
(Progn
(Princ "\nReleased")
(Setq Dwg_List nil)
(Setq Search_R
(Dos_Dir
(Strcat "M:\\Released\\" Search_Name "*.dwg")
)
)

(If (Not (Null Search_R))
(Setq Search_R
(Acad_Strlsort Search_R))) ;Sort in Alphabetical Order

(Foreach XX Search_R
(Setq XXX
(Strcat "M:\\Released\\" Class "\\" XX))

(Setq Dwg_List
(Append Dwg_List
(List XXX)
)
)
) ;Close Foreach
(Setq Search_R nil) ;Reblank variable
(Foreach XX Dwg_List
(Setq XXX
(Dos_File XX))

(Setq XXX
(Reverse ;Reverse it
(Cddddr ;Strip it down
(Reverse XXX))) ;ReReverse it
) ;Close Setq
Message 4 of 13
BillZ
in reply to: Anonymous

Notice the dos_file command does not return the full string anymore.

R14 :
Command: (dos_file "G:\\1995\\Vendor\\310100.DWG")
("G:\\1995\\Vendor\\310100.DWG" "111625" "10-09-2000" "12:28:54p" "" "" "" "")

R2004 :
Command: (dos_file "G:\\1995\\Vendor\\310100.DWG")
("310100.DWG" "111625" "10-09-2000" "12:28:54p" "" "" "" "")

So your programs is working fine, it's just the return from dos_file is different. 🙂

Bill
Message 5 of 13
Anonymous
in reply to: Anonymous

Paulyjsob,
I could be wrong, but doesn't the 'Dos_File' strip the Path, and leave just the file.dwg ?
---------------
(Setq XXX
(Dos_File XX))
---------------

Bob
Message 6 of 13
BillZ
in reply to: Anonymous

This may be a bug for Dale to fix.

From the help files:

Returns detailed information on a file.

Syntax
(dos_file filename)
Parameters
filename
The source filename.



Returns
A list of strings describing the file's details if successful. The information returned is as follows:

filename
The qualified path to filename. <-note the "qualified path" reference.

size
The size of filename in bytes.

date
The date filename was last written.

time
The time filename was last written.

read-only
"R" if filename is read-only; otherwise "".

hidden
"H" if filename is hidden; otherwise "".

system
"S" if filename is system; otherwise "".

archive
"A" if filename is archive; otherwise "".



nil on error.

Example
Command: (dos_file "c:\\program files\\autocad 2002\\drawing1.dwg")

("Drawing1.dwg" "28258" "12-06-2001" "06:58:44p" "" "" "" "A")
Message 7 of 13
Anonymous
in reply to: Anonymous

Bill,
Looks like a 'bug' to me in the R2004 DosLib .
Bob
Message 8 of 13
BillZ
in reply to: Anonymous

Email sent to Dale.
Message 9 of 13
Anonymous
in reply to: Anonymous

Bill,
Sweet !
Doesn't the dos lib have a 'dos_path' var that could be strcat'ed to form the drawingprefix ?
e.g. (setq dwgpath_name (strcat dos_path (XX) dos_dir (XX))

Bob
Message 10 of 13
BillZ
in reply to: Anonymous

<<< Sweet !
Doesn't the dos lib have a 'dos_path' var that could be strcat'ed to form the drawingprefix ?
e.g. (setq dwgpath_name (strcat dos_path (XX) dos_dir (XX))
>>>>

Not that I am aware of.

Bill
Message 11 of 13
Anonymous
in reply to: Anonymous

Thanks a lot for the help everyone. Hopefully someone will fix this so I don't have to rewrite any code.
Message 12 of 13
BillZ
in reply to: Anonymous

paulyjsob,
I got a reply from D.F and it sounds like they are going to change the help file, not the function.

<<
Hi Bill,

Thanks, I'll update the documention.

Dale Fugier
Robert McNeel & Associates

I'll take another look at your code to see if there is an easy fix.


Bill
Message 13 of 13
BillZ
in reply to: Anonymous

polyjsob,

Looking at this code:

(If (= "1" Search_R)
(Progn
(Princ "\nReleased")
(Setq Dwg_List nil)
(Setq Search_R
(Dos_Dir
(Strcat "M:\\Released\\" Search_Name "*.dwg")
)
)

(If (Not (Null Search_R))
(Setq Search_R
(Acad_Strlsort Search_R))) ;Sort in Alphabetical Order

(Foreach XX Search_R
(Setq XXX
(Strcat "M:\\Released\\" Class "\\" XX))

(Setq Dwg_List
(Append Dwg_List
(List XXX)
)
)
) ;Close Foreach
;;At this point you have a list of all the files w/full path in the DWG_LIST variable.

(Setq Search_R nil) ;Reblank variable ;;(set list to nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(Foreach XX Dwg_List
(Setq XXX
(Dos_File XX))
;From here down you are just stripping the ending quotes ""'s from the list.

(Setq XXX
(Reverse ;Reverse it
(Cddddr ;Strip it down
(Reverse XXX))) ;ReReverse it
) ;Close Setq

;The loop but I am running is a different list than you so I may be missing something but I this seems to work instead of the previous foreach:


(Foreach XX Dwg_List (Setq XXX (cons xx (cdr (Dos_File XX))) xxx
(reverse (cddddr (reverse xxx)))))

Now you have the full path in the list "g:\\autolisp\\dcl file\\wt_to_fl.DCL" "1738" "06-07-2000" "06:40:18a"

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

Post to forums  

Autodesk Design & Make Report

”Boost