MikeP Posted September 9, 2009 Posted September 9, 2009 This is basicaly a lisp that creates a circle at a scaled radius to the original number I enter. That constant im using is the number you would use if you want to dimension a isometric 2d object. Because an iso image cannot be scaled at a 1:1 scale. I use this lisp to draw isometric objects correctly. (defun c:isoc (/ ic sd) (initget 6) (cond (setq ic (strcat "\nEnter Length "")) (setq ic) ) (setq sd (ic * .816496581)) (command "circle" getvar(sd)) (princ) ) Quote
MikeP Posted September 9, 2009 Author Posted September 9, 2009 Try (* Ic 0.8.... ) Im just getting "unknown command" Quote
architecture68-raff Posted September 9, 2009 Posted September 9, 2009 This is basicaly a lisp that creates a circle at a scaled radius to the original number I enter. That constant im using is the number you would use if you want to dimension a isometric 2d object. Because an iso image cannot be scaled at a 1:1 scale. I use this lisp to draw isometric objects correctly. (defun c:isoc (/ ic sd) (initget 6) (cond (setq ic ([color=Red]strcat[/color] "\nEnter Length [color=Red]""[/color])) (setq ic) ) (setq sd ([color=Red]ic * .816496581[/color])) (command "circle" [color=Red]getvar(sd)[/color]) (princ) ) These above red are a few of your other problems. Perhaps start with the following code and add your desired initget functions to it. You need to decide for yourself how you want to execute the circle command in the correct fashion. (defun c:isoc (/ ic sd) (setq ic (getint "\nEnter Length ")) (setq sd (* ic 0.816496581)) (command "circle" (getpoint "\nCenter: ") sd) (princ) ) Quote
Lee Mac Posted September 9, 2009 Posted September 9, 2009 "What am I doing wrong here?..." I think the converse is easier to answer... You have an incorrect number of quote marks making your String. Your COND statement is missing quite a few brackets Your second condition in your COND statement has a "setq" without a value argument. Your Getvar statement is incorrect. Your multiplication is wrong. Quote
Lee Mac Posted September 9, 2009 Posted September 9, 2009 Here are the mistakes highlighted: (defun c:isoc (/ ic sd) (initget 6) (cond [b][color=Red]([/color][/b]setq ic ([b][color=Red]strcat[/color][/b] "\nEnter Length [b][color=Red]""[/color][/b])) [b][color=Red](setq ic)[/color][/b] ) (setq sd (ic [color=Red][b]*[/b][/color] [color=Red][b].816496581[/b][/color])) (command "circle" [b][color=Red]getvar(sd)[/color][/b]) (princ) ) Quote
Lee Mac Posted September 9, 2009 Posted September 9, 2009 This is better: (defun c:isoc (/ ic) (initget 6) (if (setq ic (getdist "\nEnter Length: ")) (command "_.circle" pause (* ic 0.816496581))) (princ)) Quote
MikeP Posted September 9, 2009 Author Posted September 9, 2009 (defun c:isoc (/ ic sd) (setq ic (getint "\nEnter Length ")) (setq sd (* ic 0.816496581)) (command "circle" (getpoint "\nCenter: ") sd) (princ) ) That works great. I really know how to over complicate things i guess:? Only thing is I cant enter a decimal into the length. It asks for a integer. I forgot how to fix that. Quote
architecture68-raff Posted September 9, 2009 Posted September 9, 2009 (defun c:isoc (/ ic sd) (setq ic (getint "\nEnter Length ")) (setq sd (* ic 0.816496581)) (command "circle" (getpoint "\nCenter: ") sd) (princ) ) That works great. I really know how to over complicate things i guess:? Only thing is I cant enter a decimal into the length. It asks for a integer. I forgot how to fix that. Use Lee Mac's code. It is far more elegant and will allow for non-integers. Or change "getint" to "getdist" in what I gave you. Quote
Lee Mac Posted September 9, 2009 Posted September 9, 2009 The solution provided by architecture68-raff is only half way there (no offence intended to architecture68-raff), as it doesn't allow for a null user input, and uses getint as opposed to getreal or getdist. Mike - you really need to be looking at AfraLISP or Jeffery Sanders to learn how to use these functions. Also, I presume by the error with the quote marks, that you are using notepad to write your LISPs? You will encounter a lot more mistakes without using a syntax highlighting program. Quote
architecture68-raff Posted September 9, 2009 Posted September 9, 2009 The solution provided by architecture68-raff is only half way there (no offence intended to architecture68-raff), as it doesn't allow for a null user input, and uses getint as opposed to getreal or getdist. No offense taken I was merely trying to point him in the right direction, not do it for him. Quote
MikeP Posted September 9, 2009 Author Posted September 9, 2009 Thats all. Lee It works great. I dont use lisp all that often. there is so much logic of it I just dont understand. Quote
MikeP Posted September 9, 2009 Author Posted September 9, 2009 Also, I presume by the error with the quote marks, that you are using notepad to write your LISPs? You will encounter a lot more mistakes without using a syntax highlighting program. Yeah, I am. What would you suggest using? I know CAD has a autolisp editor. But I don't know how to use it. Is there a tutorial somewhere? Quote
Lee Mac Posted September 9, 2009 Posted September 9, 2009 Mike, Type VLIDE or VLISP at the command line to open ACAD's Visual LISP Editor. Then go to File > New File and you can start typing your LISP out. More info on debugging etc can be found here: http://midpointcad.com/au/docs/lakose_The_Visual_LISP_Developers_Bible.pdf 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.