lamensterms Posted May 2, 2014 Posted May 2, 2014 Hi, Just trying to get my head around the process to define points/co-ordinates base on the DIMSCALE, so I have the follow 2 variations of code - the difference between the two is coloured red. (DEFUN C:test ( / xcoord ycoord bpt ) (setq xcoord (* (getvar "dimscale") 424)) (setq ycoord (* (getvar "dimscale") 96)) [color="red"](setq bpt (list xcoord ycoord))[/color] (command "line" bpt) (princ) ) (DEFUN C:test ( / xcoord ycoord bpt ) (setq xcoord (* (getvar "dimscale") 424)) (setq ycoord (* (getvar "dimscale") 96)) [color="red"](setq bpt '(xcoord ycoord))[/color] (command "line" bpt) (princ) ) My question is, why does the first code work, but the second fails? No error message is given. Where am I going wrong with the list quoting? Thanks a lot for any help. Quote
LosGirk Posted May 2, 2014 Posted May 2, 2014 I've run across this same thing before. I don't know much, but here's what I do know: After removing the declared variables (DEFUN C:test (), and banging (!bpt)... The first case returns: (424.0 96.0), the second: (XCOORD YCOORD). So I'd guess maybe they're both ways to create a list, the first is designed for when you need an integer returned, the second way is for if your code needs a string returned? I'm interested to know the real answer, good luck! Quote
lamensterms Posted May 2, 2014 Author Posted May 2, 2014 Good point LosGirk. Perhaps quoting the variables adds the variables to the list, rather than the values of the variables. Thanks for the reply. Quote
Snownut Posted May 2, 2014 Posted May 2, 2014 Good point LosGirk. Perhaps quoting the variables adds the variables to the list, rather than the values of the variables. That's exactly how it works.... Quote
marko_ribar Posted May 2, 2014 Posted May 2, 2014 Read following explanation by Lee Mac to understand... http://www.lee-mac.com/quote.html M.R. Quote
Lee Mac Posted May 3, 2014 Posted May 3, 2014 Read following explanation by Lee Mac to understand... http://www.lee-mac.com/quote.html Thank you Marko, I was just about to suggest that when reading this thread! Quote
lamensterms Posted May 5, 2014 Author Posted May 5, 2014 Understood (now). Thanks a lot for the input guys. Great article Lee, thanks also for providing the link Marko. Quote
Lee Mac Posted May 5, 2014 Posted May 5, 2014 Great article Lee, thanks also for providing the link Marko. Thank you lamensterms - I'm glad that the explanation was clear 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.