- (defun c:csk (/ dxf10 i p0 p1 p2 pp s1 ss)
- (defun dxf10 (e / s);10组码取点
- (if (setq s
- (mapcar 'cdr
- (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget e))
- )
- )
- (if (= 1 (length s))
- (car s)
- s
- )
- )
- )
- (setq i -1)
- (if (setq ss (ssget ":S" (list '(0 . "LWPOLYLINE"))))
- (while (and (setq s1 (ssname ss (setq i (1+ i)))))
- (setq pp (dxf10 s1)
- p1 (car pp)
- p2 (caddr pp)
- )
- (setq p0 (mapcar '(lambda (x) (* 0.5 x)) (mapcar '+ p1 p2)))
- (vla-AddCircle
- (vla-get-modelSpace
- (vla-get-ActiveDocument (vlax-get-acad-object))
- )
- (vlax-3D-point p0)
- (* 0.02 (distance p1 p2))
- )
- (if (= (tblsearch "LAYER" "CSK") nil)
- (entmake
- (list
- '(0 . "LAYER")
- '(100 . "AcDbSymbolTableRecord")
- '(100 . "AcDbLayerTableRecord")
- '(70 . 0)
- '(6 . "Continuous")
- '(62 . 2)
- (cons 2 "CSK")
- )
- )
- )
- (vla-put-layer (vlax-ename->vla-object (entlast)) "CSK")
- (entmake (list '(0 . "LINE")
- (cons 8 "CSK")
- (cons 10 p0)
- (cons 11 p1)
- )
- )
- )
- )
- (princ)
- )
|