FILCADs Posted February 12, 2021 Posted February 12, 2021 Hi All, I'm producing some record drawings and would like to automate a task that I need to do on hundreds of drawings. Deleting all dimensions Deleting all MText containing words such as SET, CL, IL, ° Could anyone please help me with this? I'm competent in python programming but this is my first time ever looking at automating anything in cad and I'm unfamiliar with any of these languages Cheers Fil Quote
Lee Mac Posted February 14, 2021 Posted February 14, 2021 (edited) Deleting all write-enabled dimensions (i.e. those residing on unlocked layers) from a drawing is relatively straightforward and can be achieved by iterating over the drawing database and deleting all objects whose objectname property matches "AcDb*Dimension*", as the following code demonstrates: (defun c:deldim ( ) (vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (if (= :vlax-false (vla-get-isxref blk)) (vlax-for obj blk (if (and (wcmatch (vla-get-objectname obj) "AcDb*Dimension*") (vlax-write-enabled-p obj)) (vla-delete obj) ) ) ) ) (princ) ) (vl-load-com) (princ) The above will remove all dimensions from all layouts & block definitions. However, deleting MText containing specific words isn't quite so easy, as the MText content could potentially be interspersed with MText formatting codes, which would need to be removed prior to testing whether the content contains one of the target words. Edited February 14, 2021 by Lee Mac 3 Quote
Isaac26a Posted February 14, 2021 Posted February 14, 2021 Maybe to delete your Mtexts you'll have to use the command find, hit the select all button and then delete them, it's not a program but it'll save you time. or if your Mtext contains the same string let's say CL30 or just CL, you can use qselect and select them all at once and then delete them, but the command qselect just select the texts or Mtexts with the exact same content. Just hope it helps you. 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.