- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a lisp for changing a titleblock. This lisp 1st unlocks the "barcode" layer and the deletes the "barcode" layer. It then zooms to extents and moves all to 0,0. It then deletes the titleblock "TB_02", inserts a different titleblock and updates the newly inserted titleblock.
My problem is that not all sheets have the "barcode" layer so I would like it to only delete the "barcode" layer if it exists, else continue on with the lisp (zoom to extents, move all to 0,0)
My 2nd issue is that not all sheets have the "TB_02" titleblock. Same here. I would like it to only delete "TB_02" if it exists, else continue on with the lisp (insert different titleblock and update said block)
Here is a copy of my code:
(defun c:tbc ( / ss x)
(command"_.Layer""_U""Barcode""")
(command"_.Laydel""N""Barcode""""Y")
(command"zoom""extents")
(command"_.Move""all""""""0,0")
(setq ss (SSGET "X" '((0 . "INSERT"))))
(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(if (= (vla-get-EffectiveName obj) "TB_02")
(vla-delete obj)
)
)
(princ)
(command "_.-insert" "fordtitleblock2" "R" "0" "0,0" "1" "1" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" )
(command "script" "L:/9-ControlsDesign/scripts/ngftbin.scr")
)
Any advice on this is greatly appreciated. Thanks in advance for your help.
RH
Solved! Go to Solution.