My first post here, so I will start with a brief introduction. I'm an engineering surveyor working in BricsCAD 18 (it's not listed as an option in this forum's registration form), most of my work is editing/tidying drawings exported from other software. I also do a fair bit of data manipulation in spreadsheets, and LISP is the next thing I want to get into.
Unfortunately I have very limited time for troubleshooting. I wrote my first script today and guess what - too few / too many arguments. Can anyone cast their eye please?
The code is intended to produce a piece of text based on a scaled measurement of the y distance between two points on paperspace. Naturally this is just a dimension but I will later need to apply offsets etc to the calculation. I tried a few changes already and still get the error. I hope this is enough information for someone to resolve. Thanks in advance.
Thank you both for your rapid responses, that's great.
I was going by this:
taken from the bottom of http://www.afralisp.net/autolisp/tutorials/the-define-function.php
Is the advice on afralisp a bit oversimplified or am I missing something?
I've put red colour on any of your edits which I noticed. Coding is not forgiving, is it... Your code works! Did you make any more edits which I am missing?
Thank you both for your rapid responses, that's great.
I was going by this:
taken from the bottom of http://www.afralisp.net/autolisp/tutorials/the-define-function.php
Is the advice on afralisp a bit oversimplified or am I missing something?
Global variables.. well I hope you understand:
(defun c:something ( )
This means you didn't used global variables either,
Main issue with your code is that you excluded '/' so your function became this structure:
(defun example ( ex1 ex2 ex3 )
where to call it you must provide arguments to it, like:
(example "string" 1 (list "this" "is" "a list"))
so if it was:
(defun example ( / ex1 ex2 ex3 )
the call would be just:
(example)
because now 'ex ex2 and ex3' are variables that the example functions uses inside.
Yeah afralisp's examples are oversimplified and thats great for someone new to learn easily LISP.
I'd suggest checking Lee Mac's tutorials, Localising Variables is related to your problem.
Tho each tutorial requires very careful reading and re-reading it n-times, but you won't regret it.