CharlieDFW Posted April 16 Posted April 16 I’m working on a lips to add an xref to a drawing. The filename begins with a 4 letter project designator that changes but the rest of the name is static. I’m using * as wildcards but it’s not working. For filename I have: (setq wildcard "****-CP-SITE-BASE.dwg") ; Define the wildcard pattern to match xref names (setq xrefFiles (vl-directory-files xrefPath wildcard 1)) ; Get a list of xref files matching the wildcard (foreach xref xrefFiles (setq xrefFile (strcat xrefPath wildcard)) (command "_.-XREF" "Attach" xrefFile "0,0,0" "1" "1" "0") When I run it, I get this error: Error: "..\01_Basefiles\****-CP-SITE-BASE.dwg" is not a valid file name. *Invalid* ; error: Function cancelled I'd appreciate any help, Thanks Quote
CharlieDFW Posted April 16 Author Posted April 16 Changed the code to: (setq drawingName (getvar "DWGNAME")) (setq prefix (substr drawingName 1 4)) ;; Construct the xref file path (setq xrefPath (strcat xrefPath prefix "-CP-SITE-BASE.dwg")) and this seems to be working! Quote
GLAVCVS Posted April 16 Posted April 16 1 hour ago, CharlieDFW said: I’m working on a lips to add an xref to a drawing. The filename begins with a 4 letter project designator that changes but the rest of the name is static. I’m using * as wildcards but it’s not working. For filename I have: (setq wildcard "****-CP-SITE-BASE.dwg") ; Define the wildcard pattern to match xref names (setq xrefFiles (vl-directory-files xrefPath wildcard 1)) ; Get a list of xref files matching the wildcard (foreach xref xrefFiles (setq xrefFile (strcat xrefPath wildcard)) (command "_.-XREF" "Attach" xrefFile "0,0,0" "1" "1" "0") When I run it, I get this error: Error: "..\01_Basefiles\****-CP-SITE-BASE.dwg" is not a valid file name. *Invalid* ; error: Function cancelled I'd appreciate any help, Thanks Hello Replace the 4 * with ? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.