本帖最后由 水吉空 于 2018-10-26 15:36 编辑
选择圆变半径
Public Sub by()
'选择圆半径变为原来的2倍
On Error Resume Next '出现错误接着往下走,但选择为空时
Dim ent As AcadEntity
Dim pt As Variant
ThisDrawing.Utility.GetEntity ent, pt, "请选择对象" '交互选择返回的对象就是定义的那个变量
If ent.ObjectName = "AcDbCircle" Then '判断选择的是不是圆
ent.Radius = ent.Radius * 2
Else
MsgBox ("您选择的不是圆")
End If
End Sub
(defun c:tt ()
(vl-load-com)
(defun *error* (msg)
(alert "您没有选择到东西哦,请重新选择:")
(princ msg)
(princ)
);错误函数没有继续往下走的功能,只有提示错误功能
(setq ent (Vlax-Ename->Vla-Object (car (entsel "请选择对象"))))
(if (= (Vlax-Get ent 'ObjectName ) "AcDbCircle")
(Vlax-Put-Property ent 'Radius (* (Vlax-Get ent 'Radius ) 2) )
(alert "你选择的不是圆")
)
(princ)
)
======================= 水吉空出品============================
微信公众号:通信工程与CAD
|