guosheyang 发表于 2024-4-24 08:30:06

xyp1964 发表于 2024-4-23 23:59


创意不错!宽的话开可以形成纵横交错的道路网格

世井 发表于 2024-4-25 11:26:41

本帖最后由 世井 于 2024-4-25 11:28 编辑

guosheyang 发表于 2024-4-23 13:17
以下是偏移代码
(setq en(car(entsel)))
(setq pykd(getreal "\n输入偏移宽度"))

(DEFUN C:TT (/ en pykd pd P4 P6 s1 s2 S2E obj e1 e2)
(IF (NULL *pykd) (setq *pykd 15))
(setq pykd (getreal (strcat "\n输入偏移宽度<" (rtos *pykd 2 2) ">:")))
(if (NULL pykd) (setq pykd *pykd) (setq *pykd pykd))
(setq en(car(entsel)))
(setq pd(POLY:clockwise (mapcar 'cdr(vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget en)))))
(vla-offset (vlax-ename->vla-object en)(if pd pykd (- pykd)))
(SETQ s1 (entlast))
(command "change" s1 "" "P" "la" "layer3" "")
(setq p4 (JNH9PT s1 4)
      p6 (JNH9PT s1 6))
(setq s2 (LINE p4 p6))
(SETQ S2E (entlast))
(setq obj (vlax-ename->vla-object s2E))
(vla-offset obj (/ pykd 2.0)) (setq e1 (entlast))
   (vla-offset obj (- 0 (/ pykd 2.0))) (setq e2 (entlast))
   (vla-erase obj)
(princ))

;;;---------------------- 高飞函数改造------------------------------;
;;;功能: 判断多边形的方向(为简单多边形,不自交的多边形);
;;;输入: 多边形顶点列表Pts(参数是点集)                           ;
;;;输出: 返回T则是顺时针,否则逆时针            ;
(defun POLY:clockwise (Pts / MATet2V)
      (defun MATet2V (v1 v2)
                (-(* (car v1) (cadr v2))
                  (* (car v2) (cadr v1)) )      )
      (< (* (apply '+
                     (mapcar 'MATet2V pts
                               (append (cdr Pts) (list (car Pts)))
                            )) 0.5   ) 0.0      ))

;
(defun getboundingbox (e / BP UP)
(cond ((equal (type e) 'ENAME) (setq e (vlax-ename->vla-object e))))
(vla-getboundingbox e 'bp 'up)
(list (safearray-value bp) (safearray-value up)))
;包围实体9点坐标 (JNH9PT e site)
(DEFUN JNH9PT (e site / obj p1 p2 p3 p4 p5 p6 p7 p8 p9)
(defun MID (p1 p2) (mapcar '(lambda (x) (* x 0.5)) (mapcar '+ p1 p2)))
    (SETQ obj (getboundingbox e))
(setq p1 (car obj))
(setq p9 (cadr obj))
(setq p3 (list (car p9)(cadr p1)))
(setq p7 (list (car p1)(cadr p9)));
(setq p2 (MID P1 P3))
(setq p8 (MID P7 P9))
(setq p4 (MID P1 P7))
(setq p6 (MID P3 P9))
(setq p5 (MID P1 P9))
(nth (- site 1) (list p1 p2 p3 p4 p5 p6 p7 p8 p9))    )
(defun LINE (pt pt1)
(entmake (list '(0 . "LINE") (cons 10 pt) (cons 11 pt1))))哥 要怎么把中间没用的线修剪掉呢

世井 发表于 2024-4-25 18:27:20

xyp1964 发表于 2024-4-23 23:59


页: 1 [2]
查看完整版本: 求 内缩中间对半打断分开