;;Kim_WiringB.lsp
;;Command Name "wb"
;;電気設備用隠線処理(配線の切断)
;;
;;May 5,2006 Original
;;May 6,2006 Version 1.0
;;
;;Coding by Kim Grossa
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;/
;;;;;;;;;;;;;;;;;;;;;;;;;/
;;;;;;;;;;;;;;;;;;;;;;;;/
;;;;;;;;;;;;;;;;;;;;;;\
;------------------;;;;;;----------
;;;;;;;;;;;;;;;;;;;\
;;;;;;;;;;;;;;;;;;/
;;;;;;;;;;;;;;;;;/
;;;;;;;;;;;;;;;;/
;;
;;*****使用方法
;;コマンドラインで"wb"と入力し、Enter
;;切断する点をクリック
;;切断する配線をクリック
;;
;;現在の隠線記号の幅が表示される
;;この値で良いなら Enter
;;変更する場合は"w"と入力し Enter,新しい値を入力
;;(間隔は幅の2倍に固定)
;;
(defun C:wb()
;*****現在のエンティティスナップの設定を退避
(setq oldES (getvar "OSMODE"))
;*****切断点選択用エンティティスナップを設定
(setvar "OSMODE" 32)
;32(Intersection)
;*****現在のレイヤーを退避
(setq oldLayer (getvar "CLAYER"))
;*****切断点中心を取得
(setq ccutP (getpoint "\n<Break point>:"));切断点中心
;*****切断する配線選択用エンティティスナップを設定
(setvar "OSMODE" 512)
;512(Nearest)
;*****切断する配線を取得
(setq wireP (getpoint "\n<Select wiring to cut>:"))
;*****レイヤーを切断する配線のレイヤーに変更
(setq sel1(nentselp wireP))
(command "SETLAYER" sel1)
;*****隠線記号の幅の入力
(princ "\n(Width=");現在の設定値(幅)を表示
(princ widS)
(princ "):")
(setq str1(getstring "<Enter to use this offset>/Width:"))
(cond
((= str1 "")()) ;現在の設定値を使用
((or(= str1 "w")(= str1 "W"))(setq widS(getreal"New Width:"))) ;設定値(幅)の変更
)
;*****隠線記号の間隔の計算
(setq bai1 2) ;間隔は幅の2倍(固定)
(setq distS (* bai1 widS))
;*****切断する配線の角度の計算
(setq wireAng (angle ccutP wireP))
;*****切断点の座標の計算
(setq ecutP (polar ccutP wireAng (/ distS 2))) ;切断終了点
(setq scutP (polar ccutP wireAng (- 0 (/ distS 2)))) ;切断開始点
;*****選択した配線を切断
(command "BREAK" scutP ecutP )
;*****切断記号を加筆
(setq ecutP1 (polar ecutP (- wireAng (/ pi 2)) (- 0 (/ widS 2))));切断終了点 pi/2=90度
(setq ecutP2 (polar ecutP (- wireAng (/ pi 2)) (/ widS 2)))
(command "LINE" ecutP1 ecutP2 "")
(setq scutP1 (polar scutP (- wireAng (/ pi 2)) (- 0 (/ widS 2))));切断開始点 pi/2=90度
(setq scutP2 (polar scutP (- wireAng (/ pi 2)) (/ widS 2)))
(command "LINE" scutP1 scutP2 "")
;*****エンティティスナップの設定を復旧
(setvar "OSMODE" oldES)
;*****レイヤーを復旧
(setvar "CLAYER" oldLayer)
)
;;Command Name "wb"
;;電気設備用隠線処理(配線の切断)
;;
;;May 5,2006 Original
;;May 6,2006 Version 1.0
;;
;;Coding by Kim Grossa
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;/
;;;;;;;;;;;;;;;;;;;;;;;;;/
;;;;;;;;;;;;;;;;;;;;;;;;/
;;;;;;;;;;;;;;;;;;;;;;\
;------------------;;;;;;----------
;;;;;;;;;;;;;;;;;;;\
;;;;;;;;;;;;;;;;;;/
;;;;;;;;;;;;;;;;;/
;;;;;;;;;;;;;;;;/
;;
;;*****使用方法
;;コマンドラインで"wb"と入力し、Enter
;;切断する点をクリック
;;切断する配線をクリック
;;
;;現在の隠線記号の幅が表示される
;;この値で良いなら Enter
;;変更する場合は"w"と入力し Enter,新しい値を入力
;;(間隔は幅の2倍に固定)
;;
(defun C:wb()
;*****現在のエンティティスナップの設定を退避
(setq oldES (getvar "OSMODE"))
;*****切断点選択用エンティティスナップを設定
(setvar "OSMODE" 32)
;32(Intersection)
;*****現在のレイヤーを退避
(setq oldLayer (getvar "CLAYER"))
;*****切断点中心を取得
(setq ccutP (getpoint "\n<Break point>:"));切断点中心
;*****切断する配線選択用エンティティスナップを設定
(setvar "OSMODE" 512)
;512(Nearest)
;*****切断する配線を取得
(setq wireP (getpoint "\n<Select wiring to cut>:"))
;*****レイヤーを切断する配線のレイヤーに変更
(setq sel1(nentselp wireP))
(command "SETLAYER" sel1)
;*****隠線記号の幅の入力
(princ "\n(Width=");現在の設定値(幅)を表示
(princ widS)
(princ "):")
(setq str1(getstring "<Enter to use this offset>/Width:"))
(cond
((= str1 "")()) ;現在の設定値を使用
((or(= str1 "w")(= str1 "W"))(setq widS(getreal"New Width:"))) ;設定値(幅)の変更
)
;*****隠線記号の間隔の計算
(setq bai1 2) ;間隔は幅の2倍(固定)
(setq distS (* bai1 widS))
;*****切断する配線の角度の計算
(setq wireAng (angle ccutP wireP))
;*****切断点の座標の計算
(setq ecutP (polar ccutP wireAng (/ distS 2))) ;切断終了点
(setq scutP (polar ccutP wireAng (- 0 (/ distS 2)))) ;切断開始点
;*****選択した配線を切断
(command "BREAK" scutP ecutP )
;*****切断記号を加筆
(setq ecutP1 (polar ecutP (- wireAng (/ pi 2)) (- 0 (/ widS 2))));切断終了点 pi/2=90度
(setq ecutP2 (polar ecutP (- wireAng (/ pi 2)) (/ widS 2)))
(command "LINE" ecutP1 ecutP2 "")
(setq scutP1 (polar scutP (- wireAng (/ pi 2)) (- 0 (/ widS 2))));切断開始点 pi/2=90度
(setq scutP2 (polar scutP (- wireAng (/ pi 2)) (/ widS 2)))
(command "LINE" scutP1 scutP2 "")
;*****エンティティスナップの設定を復旧
(setvar "OSMODE" oldES)
;*****レイヤーを復旧
(setvar "CLAYER" oldLayer)
)
※コメント投稿者のブログIDはブログ作成者のみに通知されます