swtching to AutoCad 2005 from 2000i, the lisp file can't be loaded

Discussion in 'AutoCAD' started by maryam, Jul 6, 2004.

  1. maryam

    maryam Guest

    Hi
    I am trying to upload a lisp file which contains the definitions of the commands that I have on my toolbar button. However when I load the lisp file , the following error message appear.

    what should i change in the 2005 version. has any thing changed? because this file was perviously loaded on the 2000i version .
    \
     
    maryam, Jul 6, 2004
    #1
  2. maryam

    Rudy Tovar Guest

    Was it compiled as a vlx?

    commands that I have on my toolbar button. However when I load the lisp file
    , the following error message appear.
    this file was perviously loaded on the 2000i version .
     
    Rudy Tovar, Jul 6, 2004
    #2
  3. maryam

    maryam Guest

    i am not sure what u mean by vlx!!!
     
    maryam, Jul 7, 2004
    #3
  4. maryam

    Rudy Tovar Guest

    Then that rules that out...

    Well, the best way to actually give you a response you'd like to hear is to
    have you post the code.
     
    Rudy Tovar, Jul 7, 2004
    #4
  5. maryam

    maryam Guest

    ok I realized the file is not a vlx. It is a normal lisp file. I loaded it on my AutoCAD.

    I have several groups of blocks. each block need to be inserted on a certain layer.
    there is a mylayers function that create all the layers. This works fine. however when you enter the command call the following function to insert a block you see the block on the screen and it asks you to click at what location you want to insert the block. after clicking the block disappears and nothing happens.
    any idea why ?
    the cod for block insertion is the following:

    (anai BNAME BLOCKTYPE LAYER) - block insertion command.
    ; - BNAME is block name.
    ; - BLOCKTYPE is as follows:
    ; 0 insert standard block scaled.
    ; 1 insert standard block scaled with attribute.
    ; 2 insert standard block scaled with attribute
    ; angle rotated to zero.
    ; 3 insert standard block not scaled.
    ; 4 insert baseboard and patio heaters.
    ; - LNAME is the layer to put the block on.
    (defun anai (BNAME BLOCKTYPE LNAME)
    (if (= blocktype 0)
    (progn
    (if (= lname "AN-TEXT")
    (set_text)
    (progn
    (draw_type)
    (sl lname)
    )
    )
    (while T
    (progn
    (prompt "\nBlock Insert <")
    (prompt bname)
    (prompt "> ")
    (command "insert" bname pause bscale bscale pause)
    (princ)
    )
    )
    )
    )
    (if (= blocktype 1)
    (progn
    (draw_type)
    (sl lname)
    (setq a (getstring 1 "\nEnter attribute value: "))
    (while T
    (progn
    (prompt "\nBlock Insert <")
    (prompt bname)
    (prompt "> ")
    (command "insert" bname pause bscale bscale pause a)
    (princ)
    )
    )
    )
    )
    (if (= blocktype 2)
    (progn
    (draw_type)
    (sl lname)
    (if (= bname "anl-42")
    (setq d (* bscale 0.06)) ; d is the distance from the insertion
    ) ; point to the centre of the attribute.
    (if (= bname "anl-43")
    (setq d (* bscale 0.16))
    )
    (if (= bname "anl-44")
    (setq d (* bscale 0.06))
    )
    (if (= bname "anl-45")
    (setq d (* bscale 0.16))
    )
    (if (= bname "anp-1")
    (setq d (* bscale 0.1133))
    )
    (if (= bname "ant-16j")
    (setq d (* bscale 0.25))
    )
    (setq a (getstring T "\nEnter attribute value: "))
    (while T
    (progn
    (prompt "\nBlock Insert <")
    (prompt bname)
    (prompt "> ")
    (command "insert" bname pause bscale bscale pause a)
    (setq ix (nth 0 (getvar "lastpoint")))
    (setq iy (nth 1 (getvar "lastpoint")))
    (setq x1 (- ix d))
    (setq y1 (+ iy d))
    (setq X2 (+ ix d))
    (setq y2 (- iy d))
    (command "attedit" "y" "*" "*" "*" "c" (list x1 y1) (list x2 y2) "a" 0 "")
    (princ)
    )
    )
    )
    )
    (if (= blocktype 3)
    (progn
    (if (= lname "AN-TEXT")
    (progn
    (set_text)
    (sl lname)
    )
    (progn
    (draw_type)
    (sl lname)
    )
    )
    (setq tempscale 1)
    (if (= unitsystem 2)
    (setq tempscale 25.4)
    )
    (while T
    (progn
    (prompt "\nBlock Insert <")
    (prompt bname)
    (prompt "> ")
    (command "insert" bname pause tempscale tempscale pause)
    (princ)
    )
    )
    )
    )
    (if (= blocktype 4)
    (progn
    (draw_type)
    (sl lname)
    (if (= bname "anm-1") (setq te "0.3KW"))
    (if (= bname "anm-1b") (setq te "0.5KW"))
    (if (= bname "anm-1c") (setq te "0.75KW"))
    (if (= bname "anm-1d") (setq te "1.0KW"))
    (if (= bname "anm-1e") (setq te "1.25KW"))
    (if (= bname "anm-1f") (setq te "1.5KW"))
    (if (= bname "anm-1g") (setq te "1.75KW"))
    (if (= bname "anm-1h") (setq te "2.0KW"))
    (if (= bname "anm-1i") (setq te "2.25KW"))
    (if (= bname "anm-1j") (setq te "2.5KW"))
    (if (= bname "anm-2") (setq te "0.4KW"))
    (if (= bname "anm-2b") (setq te "0.6KW"))
    (if (= bname "anm-2c") (setq te "0.8KW"))
    (if (= bname "anm-2d") (setq te "1.0KW"))
    (if (= bname "anm-2e") (setq te "1.2KW"))
    (if (= bname "anm-2f") (setq te "1.4KW"))
    (if (= bname "anm-2g") (setq te "1.6KW"))
    (if (= bname "anm-2h") (setq te "1.8KW"))
    (if (= bname "anm-2i") (setq te "2.0KW"))
    (setq ht (substr bname 5 1))
    (setq bbhscale 1)
    (if (= unitsystem 2)
    (setq bbhscale 25.4)
    )
    (setq height 4.5)
    (if (= ht "2") (setq height 4.0))
    (setq p1 (getpoint "\nPick insertion point: "))
    (setq ang (getangle p1 "\nEnter or pick insertion angle: "))
    (setq dang (/ (* 180 ang) 3.1415))
    (command "insert" bname p1 bbhscale bbhscale dang)
    (set_text)
    (setq p3 (getpoint p1 "\nPick point for leader: "))
    (setq lang (angle p1 p3))
    (setq ldist (distance p1 p3))
    (if (> ang 3.1415)
    (progn
    (setq oang (- ang 3.1415))
    (if (and (< lang ang) (> lang oang))
    (setq p1 p1)
    (setq p1 (polar p1 (- ang 4.7123) height))
    )
    )
    (progn
    (setq oang (+ ang 3.1415))
    (if (and (> lang ang) (< lang oang))
    (setq p1 (polar p1 (+ ang 1.5708) height))
    (setq p1 p1)
    )
    )
    )
    (setq slang 0)
    (setq d (* 0.0833 bscale))
    (if (< lang 6.1085) (setq slang 5.2358))
    (if (< lang 4.8868) (setq slang 4.7123))
    (if (< lang 4.5377) (setq slang 4.1887))
    (if (< lang 3.3160) (setq slang 3.1415))
    (if (< lang 2.9670) (setq slang 2.0943))
    (if (< lang 1.7453) (setq slang 1.5708))
    (if (< lang 1.3962) (setq slang 1.0472))
    (if (< lang 0.1745) (setq slang 0))
    (setq sld (distance p1 p3))
    (setq p3 (polar p1 slang sld))
    (setq p2 (polar p1 slang d))
    (command "insert" "ant-2" p1 bscale bscale p2)
    (command "line" p2 p3 "")
    (setq p4 p3)
    (if (and (/= slang 0) (/= slang 3.1415) (/= slang 1.5708) (/= slang 4.7123))
    (progn
    (command "ortho" "on")
    (setq p4 (getpoint p3 "\nPick 3rd point of leader: "))
    (command "line" p3 p4 "")
    )
    )
    (setq x1 (nth 0 p3))
    (setq y1 (nth 1 p3))
    (setq x2 (nth 0 p4))
    (setq y2 (nth 1 p4))
    (if (= p3 p4)
    (progn
    (setq x1 (nth 0 p2))
    (setq y1 (nth 1 p2))
    )
    )
    (setq just_flag 0)
    (if (< x2 x1)
    (setq just_flag 1)
    )
    (if (= (fix (- x2 x1)) 0)
    (if (> y2 y1)
    (setq just_flag 2)
    (setq just_flag 3)
    )
    )
    (if (= just_flag 0)
    (progn
    (command "insert" "ant-10b" p4 bscale bscale 0 te)
    )
    )
    (if (= just_flag 1)
    (progn
    (command "insert" "ant-10c" p4 bscale bscale 0 te)
    )
    )
    (if (= just_flag 2)
    (progn
    (command "insert" "ant-10e" p4 bscale bscale 0 te)
    )
    )
    (if (= just_flag 3)
    (progn
    (command "insert" "ant-10d" p4 bscale bscale 0 te)
    )
    )
    (sl lname)
    )
    )
    (if (= blocktype 5)
    (progn
    (if (= lname "AN-TEXT")
    (set_text)
    (progn
    (draw_type)
    (sl lname)
    )
    )
    (prompt "\nBlock Insert <")
    (prompt bname)
    (prompt "> ")
    (command "insert" bname pause bscale bscale pause)
    )
    )
    )

    ; (anai) support function.
    (defun draw_type ()
    (if (= lname "an-power")
    (if (= powerdraw 1)
    (setq lname "an-power_hidden")
    )
    )
    (if (= lname "an-lights")
    (if (= lightsdraw 1)
    (setq lname "an-lights_hidden")
    )
    )
    (if (= lname "an-mechanical")
    (if (= mechdraw 1)
    (setq lname "an-mechanical_hidden")
    )
    )
    (if (= lname "an-emergency")
    (if (= emergdraw 1)
    (setq lname "an-emergency_hidden")
    )
    )
    (if (= lname "an-communication")
    (if (= commdraw 1)
    (setq lname "an-communication_hidden")
    )
    )
    )
     
    maryam, Jul 7, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.