- UID
- 1
- 积分
- 15892
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-3
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
问:下面的代码是我想在LISP中设置polyline的bulge的过程,提示错误,正确的语法是什么?[
[pcode=lisp,true]
Command: !pline
#
Command: !mspace
#
Command: (vla-SetBulge mSpace pline 0 0.5)
; error: ActiveX Server returned the error: unknown name: SetBulge
Command: (vla-put-SetBulge pline 0 0.5)
; error: no function definition: VLA-PUT-SETBULGE
Command: (vlax-invoke-method mspace 'setbulge pline 0 0.5)
; error: ActiveX Server returned the error: unknown name: SETBULGE
Command: (vlax-put-property pline 'setbulge 0 0.5)
; error: ActiveX Server returned an error: Type mismatch[/pcode]
回答:
帮助文件里面包含了关于这个问题的信息,在 AutoCAD ActiveX and VBA Reference, 位于 Object Model -> Polyline Object -> SetBulge 方法.
然后我们看 Visual LISP Developer's Guide: Using Visual LISP Functions with ActiveX Methods -> Determining How to Call a Function
读完两个帮助文件后,你应该注意到 SetBulge 是polyline对象的方法, 即不是 Model Space Collection 的 Property 也不是 Method
你应该找到下面设置Polyline对象的bulge的代码:
[pcode=lisp,true]
(vl-load-com)
(defun a_Polyline_wArc()
(setq acadapp (vlax-get-Acad-Object)
acaddoc (vla-get-ActiveDocument acadapp)
*ModelSpace* (vla-get-ModelSpace acaddoc)
)
(setq pt1 (list 2.93905 1.87048 0.0))
(setq pt2 (list 5.54349 4.81627 0.0))
(setq pt3 (list 8.78096 4.97892 0.0))
(setq pt4 (list 12.6153 1.20181 0.0))
(setq Points (apply 'append (list pt1 pt2 pt3 pt4)))
(setq ptlstlen (length Points))
(setq PointDataA (vlax-make-safearray vlax-vbDouble (cons 0 (1- ptlstlen))))
(vlax-safearray-fill PointDataA Points)
(setq PointData (vlax-make-variant PointDataA (logior vlax-vbarray
vlax-vbDouble)))
(setq myPolyObj (vla-addPolyline *ModelSpace* PointData))
(vla-Put-Color myPolyObj acBlue)
(setq strtWidth 1.0 endWidth 1.0 verticies (1- (/ ptlstlen 3)) indx0)
(while (< indx verticies)
(vla-SetWidth myPolyObj indx strtWidth endWidth)
(setq indx (1+ indx))
)
(vla-SetBulge myPolyObj 1 -0.42080)
(vla-Update myPolyObj)
(princ)
)
; (a_Polyline_wArc)[/pcode]
|
|