或者试试这个,你需要输入一次圆半径
- ;;This will work for LWPolylines 3DPolylines (incl fitted curves) Lines Splines arcs circles ellipses
- ;;If object is "closed" and the start point and end point are the same
- ;;then the two circles will be at the same point (eg full circles ellipses)
- ;;
- ;;Make a null selection on Select Line to end
- ;;Ron Harman Copyright © 2014
- ;;
- (defun c:pcircles (/ *error* c_doc ms circle_rad ent p_obj s_pt e_pt)
- (defun *error* ( msg )
- (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
- (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (alert (strcat "\nOops an Error : " msg " occurred")))
- (princ)
- )
- (setq c_doc (vla-get-activedocument (vlax-get-acad-object)))
- (setq ms (vla-get-modelspace c_doc))
-
- (initget (+ 1 2 4))
- (setq circle_rad (getreal "\nEnter Radius for circles : "))
-
- (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
- (vla-startundomark c_doc)
-
- (while (setq ent (entsel "\nSelect Line : "))
- (if (not ent) (progn (vla-endundomark c_doc) (exit)))
- (setq p_obj (vlax-ename->vla-object (car ent))
- s_pt (vlax-curve-getStartPoint p_obj)
- e_pt (vlax-curve-getEndPoint p_obj)
- )
- (vla-addcircle ms (vlax-3d-point s_pt) circle_rad)
- (vla-addcircle ms (vlax-3d-point e_pt) circle_rad)
- )
- (princ)
- )
- (princ)
- (princ "Type "pcircles" to run")
- (princ)
|