本帖最后由 ga619091 于 2020-3-12 11:16 编辑
我尝试制作两个源码效果是我想要的,但他的效果是要抓取点对点才能实现,有办法改成框选实现?想法是
(1)任意矩形的垂直面水平面添加5MM中心线
(2)及矩型往内偏移8MM制作我想要的圆尺寸
- ;;;选取框注意由左上到右下点;;;
- (defun C:ff ()
- (setvar "osnapcoord" 1)
- (setq PT1 (getpoint "\n 选取第一点:"))
- (setq PT3 (getcorner pt1 "\n 对角点:"))
- (setq x1 (car pt1))
- (setq y1 (cadr pt1))
- (setq x3 (car pt3))
- (setq y3 (cadr pt3))
- (setq PT2 (list x3 y1))
- (setq PT4 (list x1 y3))
- (setq pn1 (polar PT1(angle PT1 PT2) (/ (distance PT1 PT2) 2)))
- (setq pn2 (polar PT2(angle PT2 PT3) (/ (distance PT2 PT3) 2)))
- (setq pn3 (polar PT3(angle PT3 PT4) (/ (distance PT3 PT4) 2)))
- (setq pn4 (polar PT4(angle PT4 PT1) (/ (distance PT4 PT1) 2)))
- (setq P11(car PT1))
- (setq P12(cadr PT1))
- (setq P00 (list(+ P11 8)(+ P12 -8)))
- (command "circle" P00 "d" "3.6")
- (command "circle" P00 "d" "3.1")
- (setq P13(car PT2))
- (setq P14(cadr PT2))
- (setq P01 (list(+ P13 -8)(+ P14 -8)))
- (command "circle" P01 "d" "3")
- (setq P15(car PT3))
- (setq P16(cadr PT3))
- (setq P02 (list(+ P15 -8)(+ P16 8)))
- (command "circle" P02 "d" "3.6")
- (command "circle" P02 "d" "3.1")
- (setq P17(car PT4))
- (setq P18(cadr PT4))
- (setq P03 (list(+ P17 8)(+ P18 8)))
- (command "circle" P03 "d" "3")
- (princ)
- )
- ;;;加5MM十字对位线;;;
- ;;;选取框注意由左上到右下点;;;
- (defun c:dd ()
- (setvar "osnapcoord" 1)
- (setq PT1 (getpoint "\n 选取第一点:"))
- (setq PT3 (getcorner pt1 "\n 对角点:"))
- (setq x1 (car pt1))
- (setq y1 (cadr pt1))
- (setq x3 (car pt3))
- (setq y3 (cadr pt3))
- (setq PT2 (list x3 y1))
- (setq PT4 (list x1 y3))
- (setq pn1 (polar PT1(angle PT1 PT2) (/ (distance PT1 PT2) 2)))
- (setq pn2 (polar PT2(angle PT2 PT3) (/ (distance PT2 PT3) 2)))
- (setq pn3 (polar PT3(angle PT3 PT4) (/ (distance PT3 PT4) 2)))
- (setq pn4 (polar PT4(angle PT4 PT1) (/ (distance PT4 PT1) 2)))
- (setq pn1x(car pn1))
- (setq pn1y(cadr pn1))
- (setq pn11 (list(+ pn1x 0)(+ pn1y -5)))
- (command "line" pn1 pn11 "")
- (setq pn2x(car pn2))
- (setq pn2y(cadr pn2))
- (setq pn21 (list(+ pn2x -5)(+ pn2y 0)))
- (command "line" pn2 pn21 "")
- (setq pn3x(car pn3))
- (setq pn3y(cadr pn3))
- (setq pn31 (list(+ pn3x 0)(+ pn3y 5)))
- (command "line" pn3 pn31 "")
- (setq pn4x(car pn4))
- (setq pn4y(cadr pn4))
- (setq pn41 (list(+ pn4x 5)(+ pn4y 0)))
- (command "line" pn4 pn41 "")
- (princ)
- )
|