error: no function definition: MAKE-ARRAY

error: no function definition: MAKE-ARRAY

asad.mahmood17
Explorer Explorer
1,315 Views
5 Replies
Message 1 of 6

error: no function definition: MAKE-ARRAY

asad.mahmood17
Explorer
Explorer

Hi,

 

I'm fairly new to AutoLisp and still trying to learn how it works. I was writing a script that needed inputs into arrays for it to function properly but I keep getting this message when I try to execute the functions "error: no function definition: MAKE-ARRAY". Is there a different way of defining an array?

I know the script below is incomplete but I like to test the code as I'm writing it to avoid tedious debugging later on. I will be doing calculations involving the elements contained in the arrays after I get past this error.

P.S. I started using Autolisp about a week ago so please excuse any other errors I might've made in the script, I'm still learning.

 

 

(defun platformLoading()


  (setq numOPL (getint "Enter number of platforms: "))
  (setq n 0)
  (setf PlArray(make-array '(numOPL)))
  (setf xCenterArray(make-array '(numOPL)))
  (setf yCenterArray(make-array '(numOPL)))
  (setf mofPlArray(make-array '(numOPL)))

  (while (>= numOPL 1)
    (setf (aref PlArray n) (getint "Enter length of Platform: "))

    (setf (aref xCenterArray n) (getpoint "Select x-center for Platform"))
    (setf (aref yCenterArray n) (getpoint "Select y-center for Platform"))
    (setf (aref mofPlArray n) (getint "Enter mass for Platform: "))

    (setq nOPL (1- numOPL))
    (setq n (1+ n))
  )
)

 

0 Likes
1,316 Views
5 Replies
Replies (5)
Message 2 of 6

Kent1Cooper
Consultant
Consultant

You're calling for several routines that must be custom-defined -- not just (make-array) but also (setf) and (aref).  None of those is an AutoLisp function.  Do you have the code that defines them in something that you can either include in this routine or have loaded by it?

 

[And that's not a "script," by the way -- the word Script has a specific, and different, meaning in AutoCAD.]

Kent Cooper, AIA
Message 3 of 6

asad.mahmood17
Explorer
Explorer

Thank you for the quick reply. I wasn't aware I have to define these functions first. I've used Java before and it had built in array functions so I assumed it would be similar in AutoLisp. I looked up a similar code online and got some of the code from there.

 

How can I define these functions so I can easily assign values to the array and retrieve them?

 

And thank you for pointing out my mistake about using "script" in the original post.

0 Likes
Message 4 of 6

_gile
Consultant
Consultant

Hi,

 

setf, aref, make-array are Common LISP built function which do not exist in AutoLISP.

 

If you want to have some help learning Common LISP you should search for another forum, this one is dedicated to AutoLISP, a LISP dialect specific to AutoCAD.

 

If you want to learn AutoLISP, you're in the right place. You can start from this.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 6

asad.mahmood17
Explorer
Explorer

Ohhh, that explains why i found it in other codes. I'm only interested in AutoLisp but I couldn't find any good tutorials so I've just been looking around for stuff I actually need. Any idea how I can achieve this using lists then? Like make a list that has number of elements equal to what the user specifies and how I can access and write into list? 

 

You don't have to write out the code for me. If you can redirect me to a good resource for learning AutoLisp I would be happy with that as well since I'm really new to this.

 

Thank you

 

 


@_gilewrote:

Hi,

 

setf, aref, make-array are Common LISP built function which do not exist in AutoLISP.

 

If you want to have some help learning Common LISP you should search for another forum, this one is dedicated to AutoLISP, a LISP dialect specific to AutoCAD.

 

If you want to learn AutoLISP, you're in the right place. You can start from this.


 

0 Likes
Message 6 of 6

asad.mahmood17
Explorer
Explorer

I managed to use lists to store the values instead of defining an array function. Thanks for the help guys.

0 Likes