Archive for category LISP

テーブルの余白

(setq OBJ (vlax-ename->vla-object (car (entsel))))
(vlax-put-property OBJ ‘VertCellMargin (getint))
(vlax-put-property OBJ ‘HorzCellMargin (getint))

1 Comment

テーブルの幅と高さ

全てのセルの幅と高さを指定
(setq OBJ (vlax-ename->vla-object (car (entsel))))
(vlax-put-property OBJ ‘RowHeight (getint))
(vlax-put-property OBJ ‘ColumnWidth (getint))

No Comments

面積

ポリラインの面積を求めるVLISP
(vlax-get-property (vlax-ename->vla-object ename) ‘Area)

3 Comments

ダイナミックブロックの値

ダイナミックブロックの値の種類と値を取得
(defun y_dyblklst(
E_NAME
/
V_OBJ
VARPRO
I
V_OBJ_BL
N_LST
DAT
D_LST
)
(setq V_OBJ (vlax-ename->vla-object E_NAME))
(setq VARPRO (vlax-variant-value (vla-GetDynamicBlockProperties V_OBJ)))
(setq I (vlax-safearray-get-l-bound VARPRO 1))
(while I
(setq V_OBJ_BL (vlax-safearray-get-element VARPRO I))
(setq N_LST (append N_LST (list (vla-get-PropertyName V_OBJ_BL))))
(setq DAT (vla-get-value V_OBJ_BL))
(cond
((= 2 (vlax-variant-type DAT))
(setq DAT (vlax-variant-value DAT))
)
((= 5 (vlax-variant-type DAT))
(setq DAT (vlax-variant-value DAT))
)
((= 8 (vlax-variant-type DAT))
(setq DAT (vlax-variant-value DAT))
)
(T
(setq DAT (vlax-safearray->list (vlax-variant-value DAT)))
)
)
(setq D_LST (append D_LST (list DAT)))
(setq I (1+ I))
(if (> I (vlax-safearray-get-u-bound VARPRO 1))
(setq I nil)
)
)
(list N_LST D_LST)
)
(("X 距離" "Y 距離" "Origin" "反転状態" "側溝反転" "ルックアップ")
(77.9525 24.6063 (0.0 0.0 0.0) 1 1 "拝み"))
こんな感じ。

No Comments

画層の説明を取得

;;画層の説明を取得
(defun y_layer_des(
L_NAM	;画層名
/
OBJ
)
(setq OBJ
(vla-get-layers
(vla-get-activedocument (vlax-get-acad-object))
)
)
(setq OBJ (vlax-invoke-method OBJ 'Item L_NAM))
(vlax-get-property OBJ 'Description)
)

No Comments

画層のリスト VLISP版

;;画層のリスト VLISP版
(defun y_layerlist_v (/ LA LST)
(vlax-for LA
(vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(setq LST (cons (vla-get-name LA) LST))
)
(acad_strlsort (mapcar 'strcase (reverse LST)))
)

No Comments

LISP本

こんなのが出ていたんですね。
AutoLISPの初歩―AutoCADを使いこなすために
lispbook01.jpg

2 Comments