Ashish123 Posted May 30, 2018 Posted May 30, 2018 Hello All, I am trying to remove one table from my drawings. Please take a look at the attached sample dwg. I have over 8000 drawings to modify. All drawings contains 3 tables as shown in sample drawing. I want to erase table 3. The location of the table 3 can be anywhere in with in outside border. tried many things. but no luck so far. right now i have an autolisp that works fine if i run it in one drawing. but it doesn't work while running thru script. (defun c:abcd() (setq ss1 (ssget)) (command "erase" "p" "" ) (command "zoom" "e" "") (command "qsave") (princ) ) i have a scrip that loads the autolisp containing the above code. any help would be really appreciated. TEST DWG.dwg Quote
BIGAL Posted May 31, 2018 Posted May 31, 2018 If its a table with 4 columns can be done. A word of warning this is destructive once saved table is gone. I would test on a few that have been copied. I would back them all up 1st. (defun AH:deltable ( / x y) (setvar 'ctab "Model") (setq y 4) (setq ss (ssget "X" (list (cons 0 "ACAD_TABLE")))) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object(ssname ss (setq x (- x 1))))) (setq cols (vla-get-Columns obj)) (if (= cols Y)(vla-delete obj)) ) ) (AH:deltable) open dwg1 (load "deltable") close Y open dwg2 (load "deltable") close Y open dwg3 (load "deltable") close Y Quote
Ashish123 Posted May 31, 2018 Author Posted May 31, 2018 Hi Bigal, Thank you very much for the reply. It works like a charm. the only thing i noticed is that your code works when i have a table with 4 columns. Is there a way to modify the code to delete the table with 4 or more rows.? Thank you once again. Quote
Ashish123 Posted May 31, 2018 Author Posted May 31, 2018 I have modified your code to following code & it works like a charm. (defun AH:deltable ( / x y) (setvar 'ctab "Model") (setq x 4) (setq ss (ssget "X" (list (cons 0 "ACAD_TABLE")))) (repeat (setq y (sslength ss)) (setq obj (vlax-ename->vla-object(ssname ss (setq y (- y 1))))) (setq rows (vla-get-Rows obj)) (if (>= rows x)(vla-delete obj)) ) ) (AH:deltable) Thank you very much. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.