Results 1 to 6 of 6

Thread: Functions that worked in AutoCAD 2004 no longer work in AutoCAD 2007

  1. #1
    I could stop if I wanted to
    Join Date
    2006-01
    Posts
    306
    Login to Give a bone
    0

    Default Functions that worked in AutoCAD 2004 no longer work in AutoCAD 2007

    We have a highly configured enviornment in 2004 and are in the process of migrating to 2007. In testing out 2007 we have encountered a problem. We have some functions that call commonly used functions in a separate lisp file. The function LABEL has the following segment of code:

    (setq SYM_LAY "PANNO")
    (lyr_set sym_lay)

    The function LYR_SET has the following segment of code:

    (defun LYR_SET ( LYRLINK / LAY_CANCL)

    When the LABEL function calls LYR_SET the following error occurs:

    Error: bad arguement type: FILE "PANNO"

    It appears the LYR_SET function is expecting a FILE parameter rather than a String.

    These routines work fine in 2004 but not 2007.

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,105
    Login to Give a bone
    0

    Default Re: Functions that worked in AutoCAD 2004 no longer work in AutoCAD 2007

    Probably need to see more of your code, but the layer link may be a link to a previously opened file which has not been closed.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    I could stop if I wanted to
    Join Date
    2006-01
    Posts
    306
    Login to Give a bone
    0

    Default Re: Functions that worked in AutoCAD 2004 no longer work in AutoCAD 2007

    Here is more (not all) of the code:

    LABEL function:
    Code:
    (if (= "PL" (strcase (substr (getvar "dwgname") 1 2)))
    		;then
    		(setq SYM_LAY "PANNO")
    		;else
       	(if (= "PI" (strcase (substr (getvar "dwgname") 1 2)))
    			;then
    			(setq SYM_LAY "MANNO")
    			;else
    			(setq SYM_LAY nil)
       	);end if
       );end if
    
       (if SYM_LAY
          (progn
    	      (LYR_SET SYM_LAY)  ;;<----This is the function call that triggers the error
    	      (command ".BREAK" TXT_PT "F"
    	         (polar TXT_PT TXT_ANG (/ brk_dist 2))
    	         (polar TXT_PT (+ PI TXT_ANG) (/ brk_dist 2))
    	      )
          )
          (progn
             (command "LAYER" "S" LYR_NM "" "COLOR" CLR ".BREAK" TXT_PT "F"
                (polar TXT_PT TXT_ANG (/ brk_dist 2))
                (polar TXT_PT (+ PI TXT_ANG) (/ brk_dist 2))
             )
          )
       )
    LYR_SET function:
    Code:
    (Defun LYR_SET ( LYRLINK / LAY_CANCL)     ;;<------This is where the error occurs.
       (setq LYR (assoc LYRLINK LYRLINK_LST))
       (if LYR
          (progn
             (cond
                ((= CONST_TYPE "NEW")
                    (if (= (tblsearch "ltype" (last LYR)) nil)
                       (command ".linetype" "load" (last LYR) "ACAD" "")
                    )
                    (if (= (tblsearch "layer" (caddr LYR)) nil)
                       (progn
                          (defun do_exit ()
                             (done_dialog 1)
                          )
                          (setq SRT (load_dialog (strcat AECAD_PATH "COMN/LAYERMAKE")))
                          (new_dialog "LAYERMAKE" SRT)
                          (action_tile "cancel" "(setq LAY_CANCL 1)(do_exit)")
                          (Start_dialog)
                          (unload_dialog SRT)
                          (if (/= LAY_CANCL 1)
                             (command "-layer" "MAKE" (strcat (caddr LYR) "") "COLOR" (cadddr LYR) "" "LT" (last LYR) "" "")
                          )
                       )
    		   (command "-layer" "SET" (strcat (caddr LYR) "") "")
                    )
                )
                ((= CONST_TYPE "EXST")
                    (if (= (tblsearch "ltype" (last LYR)) nil)
                       (command ".linetype" "load" (last LYR) "ACAD" "")
                    )
                    (command "-layer" "MAKE" (strcat (caddr LYR) "-EXST") "COLOR" "8" "" "LT" (last LYR) "" "")
                )
                ((= CONST_TYPE "DEMO")
                    (if (= (tblsearch "ltype" "DASHED2") nil)
                       (command ".linetype" "load" "DASHED2" "ACAD" "")
                    )
                    (command "-layer" "MAKE" (strcat (caddr LYR) "-DEMO") "COLOR" (cadddr LYR) "" "LT" "DASHED2" "" "")
                )
             )
          )
    ;     (exit)
       )
       (princ)
    )
    Last edited by Opie; 2007-05-04 at 03:41 PM. Reason: [CODE] tags added

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

    Default Re: Functions that worked in AutoCAD 2004 no longer work in AutoCAD 2007

    Quote Originally Posted by sthedens
    We have a highly configured enviornment in 2004 and are in the process of migrating to 2007. .
    Gotta ask, why not upgrade to the current version 2008?
    Try adding lines like "\nGot this far!" in the function where the error occurs to see exactly where. Does the dialog box display?

  5. #5
    I could stop if I wanted to
    Join Date
    2006-01
    Posts
    306
    Login to Give a bone
    0

    Default Re: Functions that worked in AutoCAD 2004 no longer work in AutoCAD 2007

    Our company isn't mobile regarding decisions to upgrade (like trying to turn the Queen Mary). So 2008 is out of the question for now.

    I had already embedded flags in the code to determine where the error is occurring. I removed those flags once I determined the culprit. I commented the code segments where the problem occurs. The problem is the function call (LYR_SET SYM_LAY). The SYM_LAY variable contains String information. The function LYR_SET seems to be expecting a File parameter rather than the String parameter it is receiving.

  6. #6
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,105
    Login to Give a bone
    0

    Default Re: Functions that worked in AutoCAD 2004 no longer work in AutoCAD 2007

    The first line in your LYR_SET routine is using the assoc function. This function looks for an element (LYRLINK) within a list (LYRLINK_LST). You do not show where LYRLINK_LST is defined.

    Have you tried the VLIDE (Visual Lisp integrated development environment)? It will allow you to step through your routines and display the values of variables within the Watch window. You will want to place a break point somewhere close to where you think the error is located. When you run your routine, the VLIDE will break execution once it reaches a break point.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Similar Threads

  1. Replies: 6
    Last Post: 2007-03-27, 03:06 PM
  2. Replies: 21
    Last Post: 2006-12-16, 05:44 PM
  3. Copy-Clip and WBlock functions no longer work
    By barbara_burkhardt94763 in forum AutoCAD General
    Replies: 3
    Last Post: 2006-11-12, 11:18 PM
  4. When will AutoCAD 2004 no longer be supported
    By BCrouse in forum AutoCAD General
    Replies: 3
    Last Post: 2006-09-08, 10:44 PM
  5. Cost of upgrading from AutoCAD 2004 to AutoCAD 2007
    By SteveChestnut in forum CAD Management - General
    Replies: 7
    Last Post: 2006-05-25, 10:43 AM

Posting Permissions

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