;;;画手机外边框;;;输入数据:手机宽度mpWidth,手机高度mpHeight,圆角半径filletRadius,我来为大家科普一下关于手机画线条图?以下内容希望对你有帮助!

手机画线条图(画手机外边框)

手机画线条图

;;;画手机外边框

;;;输入数据:手机宽度mpWidth,手机高度mpHeight,圆角半径filletRadius

;;;由用户在屏幕上指定一点insertionPt作为手机底部左侧点,另外指定

;;;一点secondPt作为底边的方向。

(vl-load-com)

(defun mpOutside(mpWidth mpHeight filletRadius)

(setq acadObj(vlax-get-acad-object))

(setq doc(vla-get-ActiveDocument acadObj))

(setq modelSpace(vla-get-ModelSpace doc))

;;用户屏幕指定一点

(setq insertionPt(getpoint"\n屏幕上指定起点:")

secondPt(getpoint"\n屏幕上指定方向点:"))

;;中间变量计算

(setq a(- mpWidth (* filletRadius 2))

b(- mpHeight (* filletRadius 2))

c(* (sqrt 2) filletRadius)

marchingAngle(angle insertionPt secondPt)

incrementAngle(/ pi 4)

valueBulge (/ (sin (/ pi 8)) (cos (/ pi 8)))

lstdisp(list a c b c a c b)

lstpt ()

lstpt(cons insertionPt lstpt))

(repeat (length lstdisp)

(setq pt(polar (car lstpt) marchingAngle (car lstdisp))

lstpt(cons pt lstpt)

lstdisp(cdr lstdisp)

marchingAngle( marchingAngle incrementAngle)))

(setq lstpt(reverse lstpt)

lstused ())

(repeat (length lstpt)

(setq lstused(cons (caar lstpt) lstused)

lstused(cons (cadar lstpt) lstused)

lstpt(cdr lstpt)))

(setq lstused(reverse lstused))

;;数据转换

(setq points(vlax-make-safearray vlax-vbDouble '(0 . 15)))

(vlax-safearray-fill points lstused)

;;创建多段线

(setq plineObj(vla-AddLightWeightPolyline modelspace points))

(vla-put-Closed plineObj :vlax-true)

;;做圆角

(setq index 1)

(repeat 4

(vla-setBulge plineObj index valueBulge)

(setq index( index 2)))

(vla-Updata plineObj)

(vla-ZoomAll acadObj)

)

,