Trouble with a list as argument

Trouble with a list as argument

Anonymous
Not applicable
1,491 Views
3 Replies
Message 1 of 4

Trouble with a list as argument

Anonymous
Not applicable

I'm completely stumped as to why I can't get my LISP function to run properly. I am trying to use Lee Mac's "Steal" script to import layers and Page Setups from different template files depending on the extents of the drawing. Everything works as intended, except when I try to call the Steal script.

 

What I'm trying to get to work (returns Error: bad argument type: listp STEAL_PLOT):

 

(setq
	steal_path (strcat template_path 30k)
	steal_plot '("Plot 20k" "11x17")
)

(Steal steal_path
	'(
		("Layers"
			("*")
		)
		("Page Setups"
			steal_plot
		)
	)
)

But, If I change it to the following, the script runs as expected:

 

 

(setq
	steal_path (strcat template_path 30k)
	steal_plot '("Plot 20k" "11x17")
)

(Steal steal_path
	'(
		("Layers"
			("*")
		)
		("Page Setups"
			("Plot 20k" "11x17")
		)
	)
)

I'm still new to LISP, but it is my understanding that in the second snippet, "("Plot 20k" "11x17")" is a list, so why am I getting the error when I set my list before the function call? I have several different types of drawings, so I want to be able to set the Page Setup before the function call to reduce the lines of code I'll need.

 

0 Likes
Accepted solutions (1)
1,492 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant
Accepted solution

@Anonymous wrote:

I'm completely stumped as to why I can't get my LISP function to run properly. I am trying to use Lee Mac's "Steal" script to import layers and Page Setups from different template files depending on the extents of the drawing. Everything works as intended, except when I try to call the Steal script.

 

What I'm trying to get to work (returns Error: bad argument type: listp STEAL_PLOT):

 

(setq
	steal_path (strcat template_path 30k)
	steal_plot '("Plot 20k" "11x17")
)

(Steal steal_path
	(list
		'("Layers"
			("*")
		)
		(list "Page Setups"
			steal_plot ; this variable has to be evaluated
		)
	)
)

 


 

0 Likes
Message 3 of 4

Anonymous
Not applicable

For clarification, the "list" command is explicitly needed because the variable "steal_plot" has to be evaluated at runtime? I reread the page on list and must have glanced over the "unless variables" are contained part when it states you can shorten the list with an apostrophe beforehand.

0 Likes
Message 4 of 4

ВeekeeCZ
Consultant
Consultant

Yes, basically if there is any variable, you need to use LIST or CONS functions or particular list and all above on that particular tree branch.

 

 

(list '(1 2 3)
       (list a 4 "5")
       '(6 7 (8 . 9))
       (list 10 11 (cons b 13)))
0 Likes