TOP PAGE > 記事閲覧
レイヤでフィルタ選択(lisp)
投稿日 : 2015/12/11(Fri) 09:11
投稿者 アルサポ
参照先
以前、図形のタイプでフィルタ選択できるLISPを紹介しましたが、
http://r-support.org/bbs/patio.cgi?read=21&ukey=0
今回は、指定したレイヤの図形のみ選択する事ができるLISPを紹介します。

前回と同じようにダイアログボックスも作成するので、lispファイルとdclファイルの
2つ作成しないといけません。

使用する時の注意は、「図形のタイプでフィルタ選択できるLISP」の時
と同じです。
図形のタイプ、レイヤ名、それぞれのフィルタ選択のLISPを紹介していますが、
この2つのLISPを組み合わせたものを作るってみるとさらに勉強になるかもしれません。
記事編集 編集
Re: レイヤでフィルタ選択(lisp)
投稿日 : 2015/12/11(Fri) 09:15
投稿者 アルサポ
参照先
下の内容がダイアログボックスの内容になります。
とりあえずテキストエディタで、「MyFilter2.DCL」のファイルを作成して、
内容をコピー貼付で作成して下さい。


MyFilter2 : dialog
{
label = "フィルタ選択";

:boxed_column /* 画層の選択 */
{
label = "画層を選択";
:list_box
{
key = "list1";
multiple_select = true;
width = 30;
height = 30;
}
}

/* OK or CANCEL */
ok_cancel;

}
記事編集 編集
Re: レイヤでフィルタ選択(lisp)
投稿日 : 2015/12/11(Fri) 09:18
投稿者 アルサポ
参照先
下の内容がLISPになります。
テキストエディタで、「MyFilter2.LSP」のファイルを作成して、
内容をコピー貼付で作成して下さい。


(defun c:MyFilter2 ( / dialog_box dcl_id lyrName lyrData lyrList)
(if(not MyFilter2)(load "MyFilter2"))
(setq dcl_id (load_dialog "MyFilter2.DCL"))
(new_dialog "MyFilter2" dcl_id)

;全ての画層を取得してリストにする
(setq lyrName (tblnext "LAYER" T))
(while lyrName
(setq lyrData (cdr (assoc 2 lyrName)))
(setq lyrList (append lyrList(list lyrData)))
(setq lyrName (tblnext "LAYER"))
);while

;start_list関数
;1.選択したリスト項目の内容を変更します。
;2.新しいリスト項目を追加します。
;3.古いリストを削除して新しいリストを作成します(既定)。
(start_list "list1" 3)
(mapcar 'add_list lyrList);リストにした画層をリストボックスに登録
(end_list)

;選択した画層をリストに登録
(defun SelectLayer(/ readlist count item)
(setq retList(list))
(setq readlist (get_tile "list1"));選択した画層のリスト番号を取得
(setq count 1)
(while (setq item (read readlist))
(setq retlist (append retlist (list (nth item lyrList))))
(while
(and
(/= " " (substr readlist count 1))
(/= "" (substr readlist count 1))
);and
(setq count (1+ count))
);
(setq readlist (substr readlist count))
);while
);defun

(action_tile "list1" "(SelectLayer)")

(setq dialog-box (start_dialog))
(unload_dialog dcl_id)
;OKボタンを押した時の処理
(if(= (getvar "DIASTAT") 1)(obj_Val))
(princ)
)

(defun obj_Val(/ i conditioins ss1)
(setq conditions (list (cons -4 "<or")))
(setq i 0)
(while (/= (nth i retlist) nil);リストが空になるまで繰り返す
(setq conditions (append conditions (list (cons 8 (nth i retlist)))))
(setq i (+ i 1))
);while
(setq conditions (append conditions (list (cons -4 "or>"))))

(setq ss1 (ssget conditions))
(command "_pselect" ss1 "")
(setq ss1 nil)
(princ)
)
記事編集 編集
ページの上に移動
件名 スレッドをトップへソート
名前
メールアドレス
URL
暗証キー
画像認証 (右画像の数字を入力) 投稿キー
コメント


- WEB PATIO -