Jump to content

Issue with startup running of LISP


K Baden

Recommended Posts

Good afternoon all!

 

the community here never ceases to amaze me so, I have a question. I have created a routine, that runs multiple other routines to do some general maintenance on my drawings. It has worked without fail for months, so i decided to pick a few routines from the original, and place them into a separate startup "Auto" lisp. when calling the command itself, everything works great, but for some reason, it will not work upon startup of SITEPLAN drawings.

 

I know my if statement is working, because i have it posting a message for testing. For some reason though, it just refuses to utilize the command i'm calling.

 

Like I said, this works perfectly if I run it directly after the drawing is opened, but will not run within this statement i have placed into my acaddoc file.

 

 (if (wcmatch (getvar 'dwgname) "*SITEPLAN")
 (c:AutoSiteScrub)
 (print "This will print."))
(princ)

 

"This will print" pops up without fail on every drawing with SITEPLAN.dwg in it. I'm getting no errors or anything. Is there something I am missing when calling commands like this in the startup for acaddoc?

 

Any help is appreciated! Thanks!

 

(if necessary, i can post the code for the command im calling, but i really dont think its the problem, since it works perfectly on its own, let me know if that will help though)

 

EDIT: should i perhaps be using progn before calling the command?

Link to comment
Share on other sites

wcmatch function is case sensitive, so whats the value when you type (getvar 'dwgname) ?

 

EDIT:

2nd glance..

(wcmatch (getvar 'dwgname) "*SITEPLAN[color="red"].dwg[/color]")

 

Also this might be of interest:

; note: do not use range [] brackets for the pattern - it might fail.
; _$ (_noncasewcmatch "Hello World!1" "HELLO w*!#") -> T
(defun _noncasewcmatch ( str pat ) ; (87 114 105 116 116 101 110 32 66 121 32 71 114 114 114)
 (if (vl-every '(lambda (x) (eq 'STR (type x))) (list str pat))
   (wcmatch str
     (apply 'strcat
       (mapcar 
         (function 
           (lambda (x / v) (setq v (chr x))
             (cond 
               ( (<= 48 x 57) v )
               ( (member x '(9 32 35 64 46 42 63 126 45 44 96 91 93 33 64 36 37 94 38 40 41 95 61 43 92 47 34)) v) ; "\t #@.*?~-,`[]!@$%^&()_=+\\/\""
               ( (strcat "[" (strcase v) (strcase v t) "]") )
             ); cond
           ); lambda
         ); function
         (vl-string->list pat)
       ); mapcar
     ); apply 'strcat
   ); wcmatch
   (prompt "\n_noncasewcmatch: invalid inputs.")
 ); if
); defun _noncasewcmatch

Edited by Grrr
Link to comment
Share on other sites

As Grrr pointed out, wcmatch is case sensitive and you're missing an asterisk:

(wcmatch ([color="red"]strcase[/color] (getvar 'dwgname)) "*SITEPLAN[color="red"]*[/color]")

Link to comment
Share on other sites

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...