Results 1 to 2 of 2

Thread: LIsp and i'm stuck.....HELP!

  1. #1

    Default LIsp and i'm stuck.....HELP!

    guys, i know how to write a simple lisp to rename and repath multiple xrefs....i just dont know how to progress to the next level.....I need to add a loop into the code below to search for a name and if it doesnt existing within that particular drawing, to skip to the next xref....

    anybody?

    Code:
    (defun c:repath ()
    
    (command "-rename" "b" "XC00-AA005360-AAX-00-TITLE" "XC00-PN001234-aax-00-TITLE")
    (command "-xref" "p" "XC00-PN001234-aax-00-TITLE" "E:\\_ACAD Customization\\_example job set\\C-Civil\\X-Xref\\XC00-PN001234-aax-00-TITLE")
    
    (command "-rename" "b" "XC01-AA005360-AAX-00-SURVEY" "XC01-PN001234-aax-00-SURVEY")
    (command "-xref" "p" "xC01-PN001234-aax-00-SURVEY" "E:\\_ACAD Customization\\_example job set\\C-Civil\\X-Xref\\XC01-PN001234-aax-00-SURVEY")
    
    (command "-rename" "b" "XC02-AA005360-AAX-00-CADASTRE" "XC02-PN001234-aax-00-CADASTRE")
    (command "-xref" "p" "xC02-PN001234-aax-00-CADASTRE" "E:\\_ACAD Customization\\_example job set\\C-Civil\\X-Xref\\XC02-PN001234-aax-00-CADASTRE")
    
    (command "-rename" "b" "XC03-AA005360-AAX-00-EXCONT" "XC03-PN001234-aax-00-EXCONT")
    (command "-xref" "p" "XC03-PN001234-aax-00-EXCONT" "E:\\_ACAD Customization\\_example job set\\C-Civil\\X-Xref\\XC03-PN001234-aax-00-EXCONT")
    
    (command "-rename" "b" "XC04-AA005360-AAX-00-DESIGN" "XC04-PN001234-aax-00-DESIGN")
    (command "-xref" "p" "XC04-PN001234-aax-00-DESIGN" "E:\\_ACAD Customization\\_example job set\\C-Civil\\X-Xref\\XC04-PN001234-aax-00-DESIGN")
    
    (command "-rename" "b" "XC05-AA005360-AAX-00-DESCONTS" "XC05-PN001234-aax-00-DESCONTS")
    (command "-xref" "p" "XC05-PN001234-aax-00-DESCONTS" "E:\\_ACAD Customization\\_example job set\\C-Civil\\X-Xref\\XC05-PN001234-aax-00-DESCONTS")
    
    (command "-rename" "b" "XC06-AA005360-AAX-00-RDLONG" "XC06-PN001234-aax-00-RDLONG")
    (command "-xref" "p" "XC06-PN001234-aax-00-RDLONG" "E:\\_ACAD Customization\\_example job set\\C-Civil\\X-Xref\\xcsu-PN001234-aax-00-RDLONG")
    
    )
    ps i've deliberatly separated the lines of code hoping somebody adds the loop for me

  2. #2
    Past Vice President peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu Hawaii
    Posts
    575

    Default Re: LIsp and i'm stuck.....HELP!

    My suggestion is to create a function that checks the rename and repath.


    Code:
    (switchxrefandpath "XC00-AA005360-AAX-00-TITLE" "XC00-PN001234-aax-00-TITLE"
                       "XC00-PN001234-aax-00-TITLE"
                       "E:\\_ACAD Customization\\_example job set\\C-Civil\\X-Xref\\XC00-PN001234-aax-00-TITLE"
    )

    Code:
    (defun SwtichXrefAndPath (strOldName strNewName strPath / strNewPath)
     (if (and (tblobjname "block" strOldName)
              (not (tblobjname "block" strNewName))
              (setq strNewPath (findfile (strcat strPath strNewName)))
         )
      (progn
       (command "-rename" "b" strOldName strNewName)
       (command "-xref" "p" strNewName strNewPath)
      )
     )
    )
    AUGI Volunteer

Similar Threads

  1. Replies: 1
    Last Post: 2013-04-01, 03:29 PM
  2. CPU Stuck
    By trek100 in forum Revit Architecture - General
    Replies: 2
    Last Post: 2009-08-05, 02:52 PM
  3. New to VBA and Stuck
    By arcadia_x27 in forum VBA/COM Interop
    Replies: 4
    Last Post: 2009-02-13, 03:46 PM
  4. Stuck on a Lisp - Explode a Selection Set
    By todd.mackay in forum AutoLISP
    Replies: 16
    Last Post: 2005-09-20, 12:00 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
  •