如何在两端添加圆
谁能帮我做一个例程,在多段线的每一端放一个圆。。。所以如果我选择多段线,它会在每一端刻一个直径为2米的圆??
或者至少帮我做一个?
您好,学习,搜索:
-entmake圆
-LW多段线、顶点坐标等。。
或者只是鱼,
用2.0M的圆圈做一个方块,然后看
此处显示最近的线程 这应该很接近了
; add a circle to end of lines for import into the DRAINS software
; By alan H May 2018
(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)
(command "layer" "n" "PITS" "Color" 1 "PITS" "s" "PITS" "")
(setq ent (car (entsel "\nSelect drain layer: ")))
(setq l_name (cdr (assoc 8 (entget ent))))
; (setq listlines (ssget "X" (list (cons 0 "line")(cons 8 l_name))))
;(setq listlines (ssget "X" (list (cons 0 "line,Lwpolyline")(cons 8 l_name))))
(setq listlines (ssget "X" (list (cons 0 "Lwpolyline")(cons 8 l_name))))
(setq y 0)
(repeat(sslength listlines)
(setq pt1 (cdr (assoc 10 (entget (ssname listlines y)))))
(command "circle" pt1 1.0)
(setq pt1 (cdr (assoc 11 (entget (ssname listlines y)))))
(command "circle" pt1 1.0)
(setq y (+ y 1))
) ;end repeat listlineno
(setvar "osmode" oldsnap)
或者试试这个,你需要输入一次圆半径
;;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 HarmanCopyright © 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)
以此为起点,这应该是你想要的。
(defun c:foo (/ s tmp)
(if (setq s (ssget '((0 . "*polyline"))))
(foreach l (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
(mapcar '(lambda (x)
(and (not (vl-position x tmp))
(setq tmp (cons x tmp))
;; '(40 . 1.) 1. is radius below .. change to suit
(entmakex (list '(0 . "circle") (cons 10 x) '(40 . 1.)))
)
)
(list (vlax-curve-getstartpoint l) (vlax-curve-getendpoint l))
)
)
)
(princ)
)
(vl-load-com)
哇,谢谢!正是我需要的
这么多的代码,我困惑lol!但我喜欢这样的想法,因为输入部分,我可以控制直径
我喜欢你的代码,我能比其他人更容易理解它,我可以用它作为将来的参考
页:
[1]