Results 1 to 2 of 2

Thread: lisp run command only on specified filename

  1. #1
    Member
    Join Date
    2017-09
    Posts
    3
    Login to Give a bone
    0

    Default lisp run command only on specified filename

    hello
    i'm tryng to run a command only if the filename start with some specific caracters.
    but i can't find the right way
    any suggestion?

    Code:
    (defun c:test1()
    	(if ((wcmatch (getvar "DWGNAME") "CH*.dwg" "C1*.dwg" "C2*.dwg" "LI*.dwg" "MN*.dwg" "ON*.dwg" "NO*.DWG" "RJ*.dwg" "SH*.dwg" "WT*.dwg" ))  	;;if file name start with
    																																				;; change blcok A / CW
    	(command "_-insert" "C:\\dati\\block_update\\blocks\\lin_acquatorre.dwg" "-50,0" "" "" "" "" "" "" "" "" "")								;;insert block
    	(entdel (entlast))
    
    	(if (setq ss (ssget "_X" '((2 . "riduzione")))) 																							;block to be replaced
    		(repeat (setq n (sslength ss))
    		  (setq edata (entget (ssname ss (setq n (1- n)))))
    		  (entmod (subst '(2 . "lin_acquatorre") '(2 . "lin_cooling-water") edata)) 
    		)
    
    	)
    )

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: lisp run command only on specified filename

    wcmatch (AutoLISP) https://help.autodesk.com/view/ACD/2...6-9B09952A53AD
    By example (wcmatch "Name" "???,~*m*,N*") you need to modify yours to
    Code:
    (wcmatch (getvar "DWGNAME") "CH*.dwg,C1*.dwg,C2*.dwg,LI*.dwg,MN*.dwg,ON*.dwg,NO*.DWG,RJ*.dwg,SH*.dwg,WT*.dwg" )
    for it to work.

Similar Threads

  1. Replies: 0
    Last Post: 2017-06-26, 02:26 AM
  2. Change filename when printing via LISP
    By vladimir.karatsupa982899 in forum AutoLISP
    Replies: 5
    Last Post: 2013-12-12, 03:14 PM
  3. Render only specified categories or specified objects visible in a view.
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2009-03-07, 07:25 AM
  4. Replies: 1
    Last Post: 2007-09-28, 06:59 PM
  5. Replies: 2
    Last Post: 2005-07-07, 09:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •