Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

passing a list of points to a lisp function instead of user unput

21 REPLIES 21
SOLVED
Reply
Message 1 of 22
kennethmjones
3852 Views, 21 Replies

passing a list of points to a lisp function instead of user unput

Hello.

 

I have a list function that asks for the user to pick points when it is run. It looks something like this...

 

(foo arg1 arg2) 

 

When invoked it asks the user to pick points and press enter when done It.

 

Instead of getting the points from the user i want to pass it a list of pre-defined points. The code cannot be changed so I must use it as is.

 

 

Is this possible, if so how can it be done? I will be very grateful for any suggestions. 

Thank you in advance.

21 REPLIES 21
Message 21 of 22
stevor
in reply to: kennethmjones

I may be confused, but what did you use

to effect the 'foo action,  ie the

'(foo arg1 arg2) '  stated earlier?

S
Message 22 of 22
kennethmjones
in reply to: stevor

Hello stevor,

 

I finally got it todo what I wanted by using a combination of Lisp functions and a command script as suggested by doni49. This works well in this situation, or at least it does for me here anyway.

 

The problem black box (foo ...) function responds to inputting the points from a command script when I wrap it in a (C:Foo()) defun and run a script for the point input bit, something like this...

 

The script file "myfooscript.scr" that contains the command and the list of points

 

MYFOOWRAPPER

0,0

0,100

100,100

0,100

...

 

The Foo "C:" wrapper function for the script to run

 

(defun C:MYFOOWRAPPER()

(foo arg1 arg2)

)

 

The myfoo function to run it from Lisp and pass any values as required from time to time

 

(defun myfoo ( arg1 arg2 ) ; add more arguments as required

...

(command "script" "myfooscript.scr")

...

  )

 

The result of this that the points in the command script file get inserted into the drawing by (foo ...) and it does its thing as it should (which is what I wanted). If I have a space on the final line of the script the (foo ...) function stops asking for more input, if there is no space it will ask for the user to pick more points and continue drawing a polyline.

 

This is perfect for me in this situaltion.

 

The script file can be pre-written or created on the fly using Lisp just before it is used. In my case I create it on the fly because the points change depending on various things... but that is another story and not relevant here.

 

Thanks again to you all for your suggestions.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost