ktbjx 发表于 2022-7-5 17:27:53

帮助创建基于圆的

塞纳里奥是这样的,我画了一条线,它会自动生成一个以线的长度为直径的圆,我相信你们可以很容易地做到这一点。。。但是我对这个Lisp程序的东西真的很陌生,所以我请求帮助,非常好,请??
圆线。图纸

Tharwat 发表于 2022-7-5 17:38:48

干得好。

(defun c:Test (/ a b)
;; Tharwat.        ;;
(and (setq a (getpoint "\nSpecify 1st point :"))
      (setq b (getpoint "\nSpecify 2nd point :" a))
      (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b)))
      (entmake
      (list '(0 . "CIRCLE")
            (cons 10 (mapcar '(lambda (q p) (/ (+ q p) 2.)) a b))
            (cons 40 (/ (distance a b) 2.))
      )
      )
)
(princ)
)

ktbjx 发表于 2022-7-5 17:44:40

该死的你太好了!!!!!这正是我需要的!!!!非常感谢!

Tharwat 发表于 2022-7-5 17:50:49

不客气。

ktbjx 发表于 2022-7-5 18:00:48

先生只是快速的思考,
有没有可能先画一个圆,然后再画一条我想加的线
(C:hhatch)
这是我从这个论坛获得的代码

Tharwat 发表于 2022-7-5 18:02:26

如果可能,张贴代码以修改它们以适合第一个例程。

ktbjx 发表于 2022-7-5 18:08:56

(defun c:HHatch (/ hcol pt1 clr)
(initget 1 "Gray Blue greeN Yellow Red Magenta")
(if (and (setq hcol (getkword "\nEnter COLOR : "))
          (setq clr (nth (vl-position hcol '("Gray" "Blue" "greeN" "Yellow" "Red" "Magenta")) '(252 5 3 2 1 200)))
          (setq pt1 (getpoint "\nSelect INTERNAL point: "))
          )
      
(command "_-hatch" "Properties" "_Solid" "_COLOR" clr "" pt1 "")
   )
(princ)
)

Tharwat 发表于 2022-7-5 18:17:16

(defun c:Test (/ a b h p c)
   ;; Tharwat.        ;;
(initget 1 "Gray Blue greeN Yellow Red Magenta")
(if (and (setq h (getkword "\nEnter COLOR : "))
          (setq c (nth (vl-position h '("Gray" "Blue" "greeN" "Yellow" "Red" "Magenta")) '(252 5 3 2 1 200)))
          )
   (while (and
            (setq a (getpoint "\nSpecify 1st point :"))
            (setq b (getpoint "\nSpecify 2nd point :" a))            
            (entmake (list '(0 . "CIRCLE") (cons 10 (setq p (mapcar '(lambda (q p) (/ (+ q p) 2.)) a b)))
                           (cons 40 (/ (distance a b) 2.))
                           )
                     )
            )
   (command "_-hatch" "Properties" "_Solid" "_COLOR" c "" p "")
   (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b)))
   )
   )
(princ)
)

ktbjx 发表于 2022-7-5 18:24:43

 
这就是我需要的!该死的你太好了!唾手可得地

Tharwat 发表于 2022-7-5 18:32:16

 
真为你高兴。
享受它。
页: [1]
查看完整版本: 帮助创建基于圆的