neekcotrack 发表于 2022-7-6 15:27:06

我可以保持Lisp程序,因为我现在在第7行,只是添加镜子是或否的问题谢谢。我现在只想坚持下去,因为这是我现在知道的。

Lee Mac 发表于 2022-7-6 15:31:56

好吧,我想你可以做到,但LISP中有很多是不必要的,它只适用于水平线。-但我会按你的意愿改变它。

Lee Mac 发表于 2022-7-6 15:32:58

添加镜像选项后:
 

(defun c:HB ( / oldsnap ip ent1 ent2 ep1 ep2 edata ip1 ip2)

   (setq oldsnap (getvar "OSMODE"))
   ;get the current snap

   (setvar "OSMODE" 544)
   ;set snap to intersection and nearest

   (setvar "BLIPMODE" 0)
   ;switch blips off

   (setvar "CMDECHO" 0)
   ;switch command echo off

   (while
   ;while an insertion point is selected

   (setq ent1 (entsel "\nSelect Block Insertion Point")ip (osnap (cadr ent1) "_nea"))

   (setvar "OSMODE" 0)
   ;switch the snap off

   (setq ent2 (entget (car ent1)))
   ;get the entity data of the line

   (setq ep1 (cdr (assoc 10 ent2)))
   ;get the first end point

   (setq ep2 (cdr (assoc 11 ent2)))
   ;get the second end point

   (setvar "ATTDIA" 0)
   ;switch off the attribute dialog box

   (command "Insert" "HBAB" "s" (getvar "dimscale") ip pause pause "" "")
   ;insert the block

   (setq edata (entget (setq en (entlast))))
   ;get the block entity data

   (setq edata (entget (entnext (dxf -1 edata))))
   ;get the attribute entity list

   (setq ip1 (dxf 10 edata))
   ;extract the first attribute insertion point

   (setq edata (entget (entnext (dxf -1 edata))))
   ;get the next attribute entity list

   (setq ip2 (dxf 10 edata))
   ;extract the second attribute insertion point

   (command "Break" ent1 "f" ip1 ip2)
   ;break the line

   (initget "Yes No")
       (setq ans (getkword "\nMirror Block? <No>: "))
      (if (= ans "Yes")
         (command "_mirror" en "" ip1 ip2 "_Y"))

   (setvar "OSMODE" 544)
   ;switch snap back on

   );while

   (setvar "OSMODE" oldsnap)   
   ;reset snap

   (setvar "BLIPMODE" 1)
   ;switch blips back on

   (setvar "CMDECHO" 1)
   ;switch command echo back on

   (setvar "ATTDIA" 1)
   ;switch attribute dialog boc back on

(princ)
;finish clean

);defun

;;;**********************************************************
   
(defun dxf (code elist)

(cdr (assoc code elist))

);defun

(princ)

neekcotrack 发表于 2022-7-6 15:37:28

你说的水平线是什么意思?

Lee Mac 发表于 2022-7-6 15:40:47

好的,你正在找到这条线的起点和终点,(cdr(assoc 10。
 
我假设你想找到线的角度,这样你就可以把块插入到线的正确角度。

neekcotrack 发表于 2022-7-6 15:44:36

 
这是用我的一个块做的,但有一些我不是,因为我的块在0度,其他的是180度,所以更容易选择插入点,并在线上选择一个点来获得这个块的角度。

Lee Mac 发表于 2022-7-6 15:47:47

哦,这个Lisp程序是很多Lisp程序中的一个,但碰巧的是,有了这个Lisp程序,你只需要在0度或180度的角度上做块。
 
我说得对吗?

neekcotrack 发表于 2022-7-6 15:50:14

 
这些木块将被铺设在管道上,因此可以有很多角度。因此,只选择两点角度更容易。

Lee Mac 发表于 2022-7-6 15:52:39

好的,你的选择
 
如果你需要任何其他帮助,请告诉我

neekcotrack 发表于 2022-7-6 15:57:55

 
好的,很酷,谢谢。
页: 1 [2]
查看完整版本: 镜像命令