Bill Tillman Posted July 31, 2014 Posted July 31, 2014 I must have missed this part in the tutorials and so far searching comes up with nothing that fits this. I have a list like this: '(13.5 16.75) I want to let one of the values be a variable but when I try this: '(pos1 16.75) I get a DXF error? Quote
MSasu Posted July 31, 2014 Posted July 31, 2014 Using quote to a list will prevent AutoLISP to evaluate the content; for second case consider LIST function. ([color=red]list[/color] pos1 16.75) Quote
BlackBox Posted July 31, 2014 Posted July 31, 2014 Try searching on the QUOTE Symbol; I recall Lee having a good tutorial on this. In short, by using ' (aka QUOTE symbol) you've told LISP to not evaluate the expression, but to take it at face value. If the desired output is a list: (list pos1 16.75) ... And for grouped pair: (cons pos1 16.75) Quote
Lee Mac Posted July 31, 2014 Posted July 31, 2014 Try searching on the QUOTE Symbol; I recall Lee having a good tutorial on this. Thanks BlackBox Bill, this should help to explain: The Apostrophe and the Quote Function Quote
BlackBox Posted July 31, 2014 Posted July 31, 2014 Thanks BlackBox Bill, this should help to explain: The Apostrophe and the Quote Function Anytime, Lee; that's the one! Quote
Bill Tillman Posted August 9, 2014 Author Posted August 9, 2014 Thanks all. I've been working on new projects and getting spoiled on Visual Studio and it's intellisense editor. But still have to keep up with AutoCAD side of it. This was great advice. Quote
Bill Tillman Posted April 3, 2015 Author Posted April 3, 2015 I had to revist this one today. I tried the above advice but still seem to be getting no where with it. The code is like this: (setq bbn (* (+ 119.5 (/ dim_b 2.)) -1)) (setq bbx (+ 116.5 (/ dim_a 2.))) ;;;(hgrt '(-148.0 143.0)) (hgrt (list bbn bbx)) The commented line shows how the function gets called successfully so now I'd like to pass variables that are the results of the equations above. But I keep getting this error: ; error: bad argument type: 2D/3D point: (-148.0 . 153.0) I've also tried (hgrt (cons bbn bbx)) and (hgrt '(bbn bbx)) Quote
Commandobill Posted April 3, 2015 Posted April 3, 2015 (hgrt (list bbn bbx)) This code should work perfectly. I find it helps to put certain lines of code directly into autocad to see what it returns. I.E. If you type (list 1 2) into autocad, it will return (1 2). Also, if you want to see what data is stored in a variable, use and exclamation point and tyoe the variable name into the autocad command line. IE !bbn Play around with it a bit and see if something is wrong with your variables. Quote
Bill Tillman Posted April 3, 2015 Author Posted April 3, 2015 Thanks. I must have been hallucinating but I'm really sure I tried it that way at least once. Probably forgot something like loading the code after I changed it. Anyway, the code you confirm is working now. Quote
BlackBox Posted April 4, 2015 Posted April 4, 2015 Also, FWIW Bill, you can simply modify your sub-function to accept two arguments, rather than a single, two element list as argument. You're currently having to build the list to pass as a single, only parameter, then presumable having to extract respective list elements within the sub-function... More work, same result. Cheers Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.