打印getangle结果
你好我只想打印(getangle()返回的值
(defun printAngle(/ p1 p3)
(setq p1 (getpoint "Select first point"))
(setq p3 (getpoint p1 "Select second point"))
(command "_line"p1 p3 "")
(princ(strcat "angle is : " (angtos(angle p1 p3) 3))
)
我尝试了angtos()的所有标志,但所有标志都给了我结果,我要么不需要,要么不知道,比如东西方,或者3r等等
谢谢
谢伊 (getangle)返回以弧度为单位的实数
(princ (rtos (getangle "\nSelect an angle: ) 2 )
即使在命令行中输入为度。
-大卫 angle和getangle函数都将返回以弧度表示的角度。
angtos函数将接受以弧度为单位的角度,并返回基于提供的单位和精度参数格式化的字符串。
我建议您阅读这些函数的文档:
角
获取角度
安格托斯
(defun printAngle (/ p1 p3)
(setq p1 (getpoint "\nSelect first point"))
(setq p3 (getpoint p1 "\nSelect second point"))
(command "_line"p1 p3 "")
(princ (strcat "\nAngle is : " (rtos (cvunit (getvar 'lastangle) "radians" "degrees") 2 ))
(princ)
)
嗨,谢。
当然,这适用于您计划使用的任何函数或命令。但是你在代码中的任何地方都没有使用它?
不知怎么的,我觉得你没有。下面显示了一个非常具体的限制。 (angtos)特性之一是sysvar AUNITS的值比UNITS命令输入值小1。
Command: units
Report formats: (Examples)
1.Scientific 1.55E+01
2.Decimal 15.50
3.Engineering 1'3.50"
4.Architectural 1'3-1/2"
5.Fractional 15-1/2
With the exception of Engineering and Architectural formats,
these formats can be used with any basic unit of measurement.
For example, Decimal mode is perfect for metric units as well
as decimal English units.
Enter choice, 1 to 5 <2>:
Number of digits to right of decimal point (0 to<2>:
Systems of angle measure: (Examples)
1.Decimal degrees 45.0000
2.Degrees/minutes/seconds 45d0'0"
3.Grads 50.0000g
4.Radians 0.7854r
5.Surveyor's units N45d0'0"E
Enter choice, 1 to 5 <1>: 1
Number of fractional places for display of angles (0 to<2>:
Direction for angle 0.00:
East 3 o'clock=0.00
North12 o'clock=90.00
West 9 o'clock=180.00
South 6 o'clock=270.00
Enter direction for angle 0.00 <0.00>:
Do you want angles measured clockwise? <N>
Command: aunits
New value for AUNITS <0>:
-大卫 另一个
(defun c:printAngle (/ p1 p3)
(setq p1 (getpoint "\nSelect first point"))
(setq p3 (getpoint p1 "\nSelect second point"))
(command "_line"p1 p3 "")
(princ (strcat "\nAngle is : " (rtos (c:cal "ang (p1,p3)") 2 3)))
(princ)
) 另一个
(defun c:printangle ( / p1 p2 )
(if
(and
(setq p1 (getpoint "\nSpecify 1st point: "))
(setq p2 (getpoint "\nSpecify 2nd point: " p1))
)
(progn
(command "_.line" "_non" p1 "_non" p2 "")
(princ (strcat "\nAngle: " (angtos (apply 'atan (cdr (reverse (mapcar '- p2 p1)))) 0 2)))
)
)
(princ)
)
页:
[1]