- ;;;自编的中点插窗,大家分享。再帮忙改进一下。
- ;;;中点插窗,由此生成的窗为非块实体,可以直接拉伸
- (defun c:win (/ angd angb cmdech osm la rmode pt1
- pt2 ss1 ss2 wall1 wall2 ang dist pt3 pt4
- pt5 pt6 lt3 lt4 lt5 lt6
- )
- (setq angd (getvar "angdir"))
- (setq angb (getvar "angbase"))
- (setq cmdech (getvar "CMDECHO"))
- (setq osm (getvar "osmode"))
- (SETQ LA (getvar "clayer"))
- (setq rmode (getvar "regenmode"))
- (setvar "regenmode" 1)
- (setvar "CMDECHO" 0)
- (setvar "angdir" 0)
- (setvar "angbase" 0)
- (setq no12 (@User2 1 "" "\n输入窗宽度" no12))
- ;(command "-layer" "m" "门窗" "c" "4" "门窗" "l" "continuous" "" "")
- (mkla"门窗"4)
- (mkla"墙体"2)
- (mkla"轴线"1)
- ;(setvar "clayer" "墙体")
- (setvar "osmode" 34)
- (command "-layer" "f" "轴线" "")
- (while
- (setq pt1 (getpoint "\n输入第一条墙线的中点:"))
- (setvar "osmode" 160)
- (setq pt2 (getpoint pt1 "\n输入第二条墙线的插入点:"))
- (command "-layer" "t" "轴线" "")
- (setvar "osmode" osm)
- (setvar "clayer" LA)
- (command "_.undo" "be")
- (setvar "osmode" 0)
- (setq ss1 (ssget pt1)
- ss2 (ssget pt2)
- )
- (setq wall1 (ssname ss1 0)
- wall2 (ssname ss2 0)
- )
- (setq ang (angle pt1 pt2)
- dist1 (distance pt1 pt2)
- )
- (setq pt3 (polar pt1 (+ ang (/ pi 2)) (/ no12 2))
- pt4 (polar pt2 (+ ang (/ pi 2)) (/ no12 2))
- pt5 (polar pt1 (- ang (/ pi 2)) (/ no12 2))
- pt6 (polar pt2 (- ang (/ pi 2)) (/ no12 2))
- )
- (setq lt3 (polar pt3 ang (- (/ dist1 2) 30))
- lt4 (polar pt4 ang (- 30 (/ dist1 2)))
- lt5 (polar pt5 ang (- (/ dist1 2) 30))
- lt6 (polar pt6 ang (- 30 (/ dist1 2)))
- )
- (setvar "clayer" "墙体")
- (command "_.line" pt3 pt4 "")
- (command "_.line" pt5 pt6 "")
- (command "_.break" wall1 pt3 pt5)
- (command "_.break" wall2 pt4 pt6)
- (setvar "clayer" "门窗")
- (command "_.line" pt3 pt5 "")
- (command "_.line" pt4 pt6 "")
- (command "_.line" lt3 lt5 "")
- (command "_.line" lt4 lt6 "")
- (command "-layer" "f" "轴线" "")
- (setvar "osmode" 34)
- (command "_.undo" "e")
- )
- (command "-layer" "t" "轴线" "")
- (princ)
- (setvar "angdir" angd)
- (setvar "angbase" angb)
- (setvar "CMDECHO" cmdech)
- (setvar "osmode" osm)
- (setvar "clayer" LA)
- (setvar "regenmode" rmode)
- ;(princ "\n76067133@qq.com")
- )
- (defun @User2 (bit kwd msg def / inp)
- (if def
- (setq msg (strcat "\n" msg "<" (rtos def 2) ">: ")
- bit (* 2 (fix (/ bit 2)))
- )
- (setq msg (strcat "\n" msg ": "))
- )
- (initget bit kwd)
- (setq inp (getreal msg))
- (if inp
- inp
- def
- )
- )
- (defun mkla (name color)
- (If (= (Tblsearch "layer" name) nil)
- (Command "layer" "m" name "c" color name "")
- (Command "layer" "t" name "s" name "c" color name "")
- )
- )
|