no function definition: DTR or polar

no function definition: DTR or polar

Anonymous
Not applicable
671 Views
3 Replies
Message 1 of 4

no function definition: DTR or polar

Anonymous
Not applicable

this is my program..its for something like M shape

there is an error

(defun C:STR () ;1
(setq p0(getpoint "\n Base point:"))
(setq a(getdist "\n enter length<50>:"))
(setq h0(getdist "\n enter height<60>:"))
(setq a1(getdist "\n width1<20>:"))
(setq a2(getdist "\n width2<30>:"))
(setq h1(getdist "\n height1<40>:"))
(setq h2(getdist "\n height2<80>:"))
(setq w 1) ;4
(setq p1(polar p0(pi)a))
(setq p2(polar p1(/ pi 2.0)a1))
(setq p3(polar p2(* 1.75 pi)a2))
(setq p4(polar p3(/ pi 4.0)a3))
(command "pline" p0 "W" w "" p1 p2 p3 p4 p0 "")

(princ) ;8
)

0 Likes
672 Views
3 Replies
Replies (3)
Message 2 of 4

Ajilal.Vijayan
Advisor
Advisor

Hi,

Welcome to Autodesk Discussio forum.

 

Your program fails at these two lines.

1.(setq p1(polar p0(pi)a))
2.(setq p4(polar p3(/ pi 4.0)a3))

1. As the pi variable is inside in the brackets, did you forgot to add any function/calculation to this ?

2.a3 variable is not defined anywhere in this program and it doesnt have any value.

0 Likes
Message 3 of 4

Kent1Cooper
Consultant
Consultant

Pi is a symbol, not a function, so it shouldn't be in parentheses:

 

(setq p1(polar p0 pi a))

 

Only when some calculation is made using pi should there be parentheses involved, such as in your (/ pi 2.0), but the parentheses are for the (/) function, not for pi.

 

Your code does not include a (dtr) function mentioned in the Subject line, but that's a common name people use for degrees-to-radians conversion.  A Search will reveal the many ways of defining that calculation, if you need it elsewhere.  The Subject line also mentions polar, but surely if, for example, the (getpoint) and (getdist) functions are defined, then (polar) is.

Kent Cooper, AIA
0 Likes
Message 4 of 4

devitg
Advisor
Advisor

;;******************************************************
;;RAD TO DEG AND DEG TO RAD
(DEFUN RtD (X) ;_define RADIAN TO DEGREE function
(/ (* X 180.0) PI)
)
;; MULTIPLY THE RAD ING BY 180 AND DIVIDE IT BY PI
(DEFUN DtR (X) ;_define DEGREE to RADIAN function
(/ (* X PI) 180.0)
) ;_end dtr rtd
;;MULTIPLY THE DGR ING BY PI AND DIVIDE IT BY 180
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*

0 Likes