Jump to content

Recommended Posts

Posted

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

Posted

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! 

Posted
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 ?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...