ola.etc Posted November 25, 2021 Posted November 25, 2021 (edited) Hello, I was wondering if anyone has/ can whip up a LISP routine that selects any dimension (rotated, aligned, diametric, radial, ect) from the entire drawing (not just a selection) that has a "dim scale linear" value that is <> Not Equal to 1 I have been doing it in "qselect" then choosing the options but this is very time consuming. (Where it says "Rotated Dimension" I would like the command to check all dimension types at once, not just rotated) Thank-you kindly, Ola Edited November 25, 2021 by ola.etc Quote
mhupp Posted November 29, 2021 Posted November 29, 2021 (edited) Selects all dimensions in the drawing and then removes them if they have a linear scale factor = 1 or doesn't have a property of linear scale factor. like angular dimensions. this will either say Drawing Doesn't Have Any Dimension All Dimension in Drawing Have Linear Scale Factor = 1 or have the dimension's with a scale factor other then 1 selected when lisp is over (defun C:foo (/ SS e obj) (vl-load-com) (if (setq SS (ssget "_X" '((100 . "AcDbDimension")))) (foreach e (mapcar 'cadr (ssnamex SS)) (setq obj (vlax-ename->vla-object e)) (if (vlax-property-available-p obj 'LinearScaleFactor) (if (= 1 (vla-get-LinearScaleFactor obj)) (ssdel e SS) ) (ssdel e SS) ) ) (prompt "\nDrawing Doesn't Have Any Dimension") ) (if (and (/= ss nil) (> (sslength SS) 0)) (sssetfirst nil SS) (prompt "\nAll Dimension in Drawing \"Linear Scale Factor = 1\"") ) (princ) ) Edited February 8, 2022 by mhupp updated code. 1 Quote
ola.etc Posted February 8, 2022 Author Posted February 8, 2022 (edited) On 11/29/2021 at 2:14 AM, mhupp said: Selects all dimensions in the drawing and then removes them if they have a linear scale factor = 1 or doesn't have a property of linear scale factor. like angular dimensions. this will either say Drawing Doesn't Have Any Dimension All Dimension in Drawing Have Linear Scale Factor = 1 or have the dimension's with a scale factor other then 1 selected when lisp is over (defun C:foo (/ SS e obj) (vl-load-com) (if (setq SS (ssget "_X" '((0 . "DIMENSION")))) (foreach e (mapcar 'cadr (ssnamex SS)) (setq obj (vlax-ename->vla-object e)) (if (vlax-property-available-p obj 'LinearScaleFactor) (if (= 1 (vla-get-LinearScaleFactor obj)) (ssdel e SS) ) (ssdel e SS) ) ) (prompt "\nDrawing Doesn't Have Any Dimension") ) (if (and (/= ss nil) (> (sslength SS) 0)) (sssetfirst nil SS) (prompt "\nAll Dimension in Drawing \"Linear Scale Factor = 1\"") ) (princ) ) This is exactly what I am looking for , thank you so much! I gave it a test run and it selected the ones I needed but it also selected some dimetric and radial dimensions that did have a dim scale linear of 1, any chance you could take another peak? Thanks in advanced, I really appreciate it. This helps so much, Edited February 8, 2022 by ola.etc Quote
mhupp Posted February 8, 2022 Posted February 8, 2022 Can you upload a sample drawing that has these dimetric and radial dimensions. Quote
ola.etc Posted February 8, 2022 Author Posted February 8, 2022 QSELECT LISP EXAMPLE.dxf here you go! Quote
mhupp Posted February 9, 2022 Posted February 9, 2022 That drawing had 5 dimensions that are not = to 1 linear scale. the two that I'm guessing you changed to 1.5 for testing. But the other three dimensions are not 1 either. These deviations wouldn't affect any real dimensions and could be ignored by adding a fuzz distance to the if statement. (if (= 1 (vla-get-LinearScaleFactor obj)) change to (if (equal 1 (vla-get-LinearScaleFactor obj) 0.001) or change them to linear scale factor of 1 1 Quote
ola.etc Posted February 9, 2022 Author Posted February 9, 2022 Thank you! I didn't realize that these were not at a dim scale linear = 1 because my precision wasn't set as high. Thank you so very much. 1 Quote
ola.etc Posted July 12, 2022 Author Posted July 12, 2022 Do you know if there is a way to have this command run every time I open a file in AutoCAD? Quote
Steven P Posted July 12, 2022 Posted July 12, 2022 If you load the lisp at startup (via the start-up suit) then I think the simplest way is to put the line (c:foo) after the lisp routine - once it is loaded it runs, but if you later delete the lisp or whatever you don't need to worry about much more You can also search for acad.lsp file and put the same line in there (search online how to do that if you need to). (I am always a little paranoid about order things load at start up, whether acad.lsp loads before or after a LISP routine - if it is before it tries to run something that isn't loaded and will just move on without it - what you think it has done hasn't and that's another reason I prefer the first option) 1 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.