Here you go.
or
(defun _DeleteTAble (TableNme / aDoc dicts)
(setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq dicts (vla-get-Dictionaries aDoc))
(Vlax-for tb (vla-Item dicts "acad_tablestyle")
(if (and
(eq (Strcase (Vla-get-name tb)) (Strcase TableNme))
(vlax-write-enabled-p tb)
)
(Vla-delete tb)
)
)
(princ)
)
HTH
@Anonymous Hello, is your table not purgeable? Or can you use command TABLESTYLE to select and delete the table?
If not, then to use the code you need to load the function into CAD and then call it forth and tell it what table to delete. So you actually don't need to change the code at all. Do you need help loading the function into CAD and calling it?
It will bring up the Table Style Box but won't the Delete box is not highlighted. Set Current, New..., Modify.... are but Delete is dark grey and not a clickable option.
@Anonymous You've made sure its not the current table style and that its not being used in the drawing?
yes, I accidentally created a new table under the table icon. I am using someone else's AutoCAD and don't want this table as an option when you try to create a new table.
@Anonymous
To use the code, make sure your table you want to delete is not set as the current table.
Copy and paste the original code from pbejse into the command line and hit enter.
You should see it give feedback in the command line after you hit enter:
_DELETETABLE
Then type this in the command line:
(_deletetable "please delete")
Now check to see if your table is gone. If you want to use the code in future sessions, you will have to paste it in or tell CAD to load it in automatically every time you open. If you didn't make sure it wasn't set to the current table style, then your CAD might crash.
oh man.... I'll just ask one of the guys here to see if anyone might know before I accidentally crash anything.
Thanks a million tho!
@Anonymous You already told me it wasn't set to the current table style, so whats the issue? Just make sure when you open TABLESTYLE that another table is set to current. Click another table and hit the "Set Current" button. Then run the code as I showed you before. I just ran several tests on my system and I found it crashed when the table you are trying to delete was set to current.
No code, I agree use -purge.
-PURGE
Purge [BAtch all/purge All/Blocks/DEtail view styles/Dimension styles/Groups/LAyers/LineTypes/MAterials/MLine styles/MUltileader styles/Plot styles/Regapps/SEction view styles/SHapes/Table styles/text STyles/Visual styles/Zero-length geometry/Empty text entities/Orphaned data]:T <-- enter T
Enter name(s) to purge <*>:
Verify each name to be purged? [Yes/No] <Yes>:
Purge table style "Legend"? [Yes/No/yes to All] <No>:
It will not allow you to remove anything if it is being used.