liuhaixin88 发表于 2022-7-5 23:06:59

将“圆角”更改为“倒角”

嗨,伙计们
 
如何将“圆角”更改为“倒角”
 
;;CAB 08.01.07
(defun c:efillet (/ e1 e2 el1 el2 rad)
(defun set_radius (/ NewRad)
   (if
   (and
       (not (initget 6))
       (setq NewRad (getdist (strcat "\nSpecify fillet radius < "
                                     (rtos (getvar "filletrad"))
                                     " > : ")))
   )
      (setvar "filletrad" NewRad)
   )
)

;;Get user pick of object to fillet
(defun linepick (order / mode ent)
   (while ; exit loop if entity is selected or Enter is pressed
   (progn
       (if (and (zerop (getvar "filletrad")) (not (zerop *FilletMode*)))
         (set_radius)
       )
       (setq mode (cdr (assoc *FilletMode* '((0 . "B") (1 . "F") (2 . "S")))))
       (initget "Radius Both First Second")
       (setq ent (entsel (strcat "\nSelect " order
                           " line or [(R)adius, (B)oth, (F)irst, (S)econd]: <"
                           Mode ">")))
       (cond
         ((and (null ent)(= 52 (getvar "ErrNo"))) ; <Enter> only was hit
         (setq ent nil))
         ((= ent "Radius") (set_radius))
         ((= ent "Both") (setq *FilletMode* 0))
         ((= ent "First") (setq *FilletMode* 1))
         ((= ent "Second") (setq *FilletMode* 2))
       )
       (and (/= (type ent) 'list) (not(null ent)))
   )
   )
   ent
)


(command "._UNDO" "_Begin")
(or *FilletMode* (setq *FilletMode* 0))
;;Fillet Mode Options
;;0 = (B)oth
;;1 = (F)irst
;;2 = (S)econd

(if (and
       (setq e1 (linepick "first"))
       (setq e2 (linepick "second"))
       (setq el1 (entget (car e1)))
       (setq el2 (entget (car e2)))
   )
   (progn
   (command "._fillet" e1 e2)
   (if (> (getvar "CMDACTIVE") 0)
       (progn
         (command)
         (princ "\nCannot fillet between these two entities.")
       )
       (if (equal (assoc 0 (entget (entlast))) '(0 . "ARC"))
         (progn
         (if (= *FilletMode* 1) (entmod el2))
         (if (= *FilletMode* 2) (entmod el1))
         )
       )
   )
   )
)
(command "._UNDO" "_End")
(princ)
)
(princ)
(prompt "\nEnhanced Fillet Loaded, Enter eFillet to run.")

Snownut 发表于 2022-7-5 23:25:33

需要明确的是,您是否希望更改CAB上面发布的代码,以执行倒角操作,而不是现在执行的圆角操作?

liuhaixin88 发表于 2022-7-5 23:34:44

CAB的代码是关于圆角操作的,但我想要倒角操作

Snownut 发表于 2022-7-5 23:48:14

 
为什么你不尝试开始这个修改,然后在发布过程中可能遇到的任何具体问题。把你自己的一些时间花在这个功能上,不要让别人帮你做。(假设这对你来说是公平的)。我的最后一个声明是基于之前的帖子,他在一个中国网站上发布了lnks,显然他在这里发布是为了获取该网站上OP的代码。
 
CAB的函数是一个很好的模板,您可以使用,因为圆角和倒角命令非常相似。

liuhaixin88 发表于 2022-7-6 00:02:35

 
 
很抱歉我不懂,只懂一点点。我的英语很差。
我不明白。
 
关于fillet,只有FILLETRAD(系统变量),但关于chamfer,有四个系统变量。
倒角
倒角B
倒角
倒角

Snownut 发表于 2022-7-6 00:08:10

线交点允许有不同的倒角距离,如果手动执行chamfer命令,您将看到选项(距离1和2),尝试将这些设置为不同的值,然后检查系统变量以查看受影响的内容。然后,您将知道要调整哪些变量。
页: [1]
查看完整版本: 将“圆角”更改为“倒角”