Fire_col Posted March 26, 2010 Share Posted March 26, 2010 I keep getting the message ;error : no function definitions : DTR I don't understand Sprinkler Head.LSP Quote Link to comment Share on other sites More sharing options...
ILoveMadoka Posted March 26, 2010 Share Posted March 26, 2010 I removed this and now it at least loads... ;***************************************************************************************************************** (princ) ) ;***************************************************************************************************************** The Polar calculations have issues... Looks like the c:dtr is looking for "x" and no "x" is being passed to it. Not sure what you are trying to calculate in order to be of further help. -- Quote Link to comment Share on other sites More sharing options...
Fire_col Posted March 26, 2010 Author Share Posted March 26, 2010 I was under the impression that it needed both of them I'll try it with just the one and see what happens. Quote Link to comment Share on other sites More sharing options...
lpseifert Posted March 26, 2010 Share Posted March 26, 2010 try changing this (defun c:dtr (x) (* pi (/ x 180.0)) to this and see if it works (defun dtr (x) (* pi (/ x 180.0)) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 26, 2010 Share Posted March 26, 2010 This should work: ; BY COLIN MACKENZIE ; DRAWS SPRINKLER HEAD WITH MAX RADIUS ;***************************************************************************************************************** (defun C:head (/ oldsnap oldblipmode ip r1 r2 r3) ;define the function ;***************************************************************************************************************** ;Save System Variables (setq oldsnap (getvar "osmode")) ;save current snap settings (setq oldblipmode (getvar "blipmode")) ; save current blipmode settings ;***************************************************************************************************************** ;switch OFF system variables (setvar "osmode" 2) (setvar "blipmode" 0) ;***************************************************************************************************************** ;Get User Input (setq ip (getpoint ":\nEnter Insertion Point : ")) ;***************************************************************************************************************** ;Polar Calculations (setq r1 (polar ip (dtr 180.0) 59 )) (setq r2 (polar ip (dtr 180.0) 119 )) (setq r3 (polar ip (dtr 180.0) 3200 )) ;***************************************************************************************************************** ; Command Function (command "circle" ip r1 "circle" ip r2 "circle" ip r3 ) ;***************************************************************************************************************** ; Reset System Variables (setvar "osmode" oldsnap) (setvar "blipmode" oldblipmode) ;***************************************************************************************************************** (princ) ; Finish Cleanly ) ;End Function ;***************************************************************************************************************** ; Converts Degrees to Radians (defun dtr (x) (* pi (/ x 180.0))) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 26, 2010 Share Posted March 26, 2010 A few notes on where you went wrong: You suppressed the return of the dtr function using princ, so the value would not be returned when used in the main function. DTR was defined as a function to be invoked at the command line, not a sub-function. You enclosed your arguments for the polar function within brackets, which would indicate they are functions in themselves. You should always localise your variables. You don't actually need (vl-load-com), as you are not using any Visual LISP functions. Lee Quote Link to comment Share on other sites More sharing options...
Fire_col Posted March 26, 2010 Author Share Posted March 26, 2010 Right cheers for the tips Lee. But now it says ;error: bad argument type : numberp Now I'm really confused. What's numberp? Quote Link to comment Share on other sites More sharing options...
Fire_col Posted March 26, 2010 Author Share Posted March 26, 2010 Sorry missed a parenthesis, it works fine, thanks loads Lee! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 26, 2010 Share Posted March 26, 2010 Right cheers for the tips Lee. But now it says ;error: bad argument type : numberp Now I'm really confused. What's numberp? FYI, stringp -- argument should be a string (but isn't) numberp -- argument should be a number fixnump -- argument should be an integer [eg. try (itoa 1.2) ] etc etc Quote Link to comment Share on other sites More sharing options...
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.