(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)
你说的水平线是什么意思? 好的,你正在找到这条线的起点和终点,(cdr(assoc 10。
我假设你想找到线的角度,这样你就可以把块插入到线的正确角度。
这是用我的一个块做的,但有一些我不是,因为我的块在0度,其他的是180度,所以更容易选择插入点,并在线上选择一个点来获得这个块的角度。 哦,这个Lisp程序是很多Lisp程序中的一个,但碰巧的是,有了这个Lisp程序,你只需要在0度或180度的角度上做块。
我说得对吗?
这些木块将被铺设在管道上,因此可以有很多角度。因此,只选择两点角度更容易。 好的,你的选择
如果你需要任何其他帮助,请告诉我
好的,很酷,谢谢。
页:
1
[2]