Results 1 to 3 of 3

Thread: LISP routine returning bad function error

  1. #1
    Member
    Join Date
    2008-06
    Posts
    32
    Login to Give a bone
    0

    Default LISP routine returning bad function error

    I am hoping that there is someone who can give me a few pointers on the lisp routine below. It is supposed to create one segment of a pline in a metric drawing while allowing the user to enter the length in architectural units. Unfotunately that is right about where it fails. Once the user enters the length in architectural units, the lisp routine crashes and returns a 'bad function' error. Any help that I receive will be greatly appreciated!


    (defun C:imppl (/ error Pt1 Pt2 Ang1 Ang2 OrigUnit DistA)

    (defun error (msg)
    (setvar "lunits" OrigUnit)
    (princ msg)
    (princ)
    )

    (setq OrigUnit (getvar "lunits"))

    (setvar "lunits" 4)

    (setq Pt1 (getpoint "\nPick Start Point:"))

    (setq Ang1 (getangle Pt1 "\nEnter or Select Angle:"))
    (setq Ang2 (* Ang1 57.2957795))

    (setq DistA (getdist Pt1 "\nEnter Distance in Imperial Units:"))
    (setvar "lunits" OrigUnit)

    (SETQ Pt2 (POLAR Pt1 (Ang2) (* DistA 25.4)))

    (Command "pline" Pt1 pt2 "")

    (princ)
    )

  2. #2
    Super Moderator dkoch's Avatar
    Join Date
    2003-03
    Location
    Philadelphia, PA
    Posts
    2,392
    Login to Give a bone
    0

    Default Re: LISP routine returning bad function error

    Drop the parentheses around Ang2 in the POLAR statement. Also, GETANGLE returns values in radians, and POLAR requires that the angle be in radians, so you will not need to calculate Ang2 and will want to use Ang1 in the POLAR statement.

  3. #3
    Member
    Join Date
    2008-06
    Posts
    32
    Login to Give a bone
    0

    Smile Re: LISP routine returning bad function error

    Thanks for your help, it works great now. That was my first time using the POLAR command, so your assistance was very helpful.

Similar Threads

  1. Function "order and resize array" not returning values
    By CADfunk MC in forum VBA/COM Interop
    Replies: 8
    Last Post: 2015-01-06, 02:06 PM
  2. Replies: 17
    Last Post: 2014-02-17, 07:18 PM
  3. LISP Routine Error for AutoCAD 2012
    By mmm3535361934 in forum AutoCAD Customization
    Replies: 1
    Last Post: 2011-10-25, 01:16 PM
  4. Replies: 16
    Last Post: 2007-05-16, 01:20 AM
  5. Returning a SYMBOL using VB.Net Lisp Function
    By bweir in forum Dot Net API
    Replies: 0
    Last Post: 2007-05-11, 03:56 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
  •