viviancarvalho 发表于 2022-7-6 10:01:25

两点中间

谁能帮我找到lisp中定义的两点之间的中点。
 
谢谢和问候
维维安

alanjt 发表于 2022-7-6 10:07:52

(defun AT:Midpoint (p1 p2)
;; Midpoint between two points
;; Alan J. Thompson, 04.23.09
(mapcar (function (lambda (a b) (/ (+ a b) 2.))) p1 p2)
)

ccowgill 发表于 2022-7-6 10:11:41

我在我的档案里有这个,我从来没有用过,我在起草时总是用MTP。

BlackBox 发表于 2022-7-6 10:12:25


(defun c:FOO(/ pt1 pt2 mid)
(if (and (setq pt1 (getpoint "\n>>Specify first point: "))
          (setq pt2 (getpoint "\n>>Specify second point: ")))
   (progn
   (prompt "\n<<The midpoint is: ")
   (setq mid (mapcar '*
                        (mapcar '+ pt1 pt2)
                        '(0.5 0.5 0.5))))))


 
-大卫

David Bethel 发表于 2022-7-6 10:17:47

非常感谢大家。
 
当做
维维安

viviancarvalho 发表于 2022-7-6 10:20:59

如果它无法自行加载,您可以使用以下内容:
;;;MidPoint Between 2 Point Using CAL
;;;ARG -> 2 Points
;;;RET -> PointList
(defun midpt (p1 p2)
(cal "(p1+p2)/2"))

fuccaro 发表于 2022-7-6 10:25:12

两点中间
(if (not (member "geomcal.arx" (arx))) (arxload "geomcal"))
 
矩形的中间

(if not lisp
    (while in active command)
      <Shift+right click> <Ctrl+right click> Mid between two points
)

 
只是玩玩而已

pBe 发表于 2022-7-6 10:29:20

 
我一直认为GEOMCAL是Autocad的最佳插件之一,但大多数插件(包括我自己)都忽略了它。它有一些非常简洁的功能。

David Bethel 发表于 2022-7-6 10:32:49

两点中间
 

(if not lisp
       (while in active command)<Ctrl+right click> point filters
         .xz mid mid)
)

 
 
只是玩玩(2)
 

GP_ 发表于 2022-7-6 10:35:57

“n”点的中点
 
(if not lisp
    (while in active command)
      M2P <click1> <click2> Mid between two points
)
页: [1] 2
查看完整版本: 两点中间