大家好,我需要帮助。
使用LISP插入动态块,但显示:错误:错误参数类型:lentyp nil。我不知道是怎么回事。
代码如下:
- ;Modify the dynamic property values
- (defun DynamicProps (ename propname value / obj prpL cla cll prp)
- (vl-load-com)
- (setq obj (if (= (type ename) 'VLA-OBJECT) ename (vlax-ename->vla-object ename)))
- (if vla-getdynamicblockproperties (setq prpL (vlax-invoke obj 'getdynamicblockproperties)))
- (setq return
- (if (setq prp (vl-remove-if-not (function (lambda(x)(= (vlax-get-property x 'PropertyName) propname))) prpL))
- (mapcar (function (lambda(v)
- (if (and (/= value nil)(vlax-property-available-p v 'Value)(/= (type value)'LIST))
- (progn (vlax-put-property v 'Value value)(vla-update obj))
- )
- (if (and (vlax-property-available-p v 'AllowedValues) (vlax-get v 'AllowedValues))
- (list (vlax-get v 'Value)(vlax-get v 'AllowedValues))
- (vlax-get v 'Value)
- )
- )) prp)
- (mapcar (function (lambda(v)(list (vla-get-propertyName v)(vlax-get v 'Value) v))) prpL)
- )
- )
- return
- )
- ;===============================================================
- ;Get polyline vertex
- (defun verpoytexs (ename / plist pp n)
- (setq obj (vlax-ename->vla-object ename))
- (setq plist (vlax-safearray->list
- (vlax-variant-value
- (vla-get-coordinates obj))))
- (setq n 0)
- (repeat (/ (length plist) 2)
- (setq pp (append pp (list (list (nth n plist)(nth (1+ n) plist)))))
- (setq n (+ n 2))
- )
- pp
- )
- ;===============================================================
- (defun c:tt ( / ss pt_copy pl_pt_lst off_real)
- (princ "\n Select the block to be processed:" )
- (setq ss (ssget ":S" '((0 . "insert"))))
- (setq pt_copy (cdr (assoc 10 (entget (ssname ss 0)))))
- (or (= (vla-get-isdynamicblock (vlax-ename->vla-object e)):vlax-true) (exit))
- (princ "\n Select polyline to be processed:" )
- (setq pl_pt_lst (verpoytexs (ssname (ssget ":S" '((0 . "LWPOLYLINE"))) 0)))
- (setq off_real (getreal "\n Enter the interval width:"))
- (mapcar
- '(lambda (p1 p2)
- (vl-cmdf ".copy" ss "" "_none" pt_copy "_none" p1)
- (vl-cmdf ".rotate" (entlast) "" "_none" p1 "R" 0 p2)
- (DynamicProps (entlast) "L" (- (distance p1 p2) off_real))
- )
- pl_pt_lst
- (cdr pl_pt_lst)
- )
- (princ)
- )
- (vl-load-com)
插入动态块。图纸 |