mel-wlp Posted March 31, 2023 Posted March 31, 2023 I have an issue where we have been supplied about 400 drawings from a vendor where the drawing have been created using some other form of CAD (unknown) and dumped out into AutoCAD format and for some reason some of blocks (and there many blocks over the 400 drawings) that have been created where there should be a circle with a radius of 1 but has com in as 0 .... i am not great at this LISP thing but i was hoping there was someone out there that can help me with a lisp that can find the circles with a 0 radius and change it to 1. I started manually editing the blocks but there are just way to many, i ma hoping i make sense to someone ! Quote
ronjonp Posted March 31, 2023 Posted March 31, 2023 Post your sample drawing. I've never seen a circle in AutoCAD that has a radius of 0. Quote
Lee Mac Posted March 31, 2023 Posted March 31, 2023 Quickly written, but should do the job - (defun c:test ( / d ) (vlax-for b (vla-get-blocks (setq d (vla-get-activedocument (vlax-get-acad-object)))) (if (= :vlax-false (vla-get-isxref b) (vla-get-islayout b)) (vlax-for o b (if (and (= "AcDbCircle" (vla-get-objectname o)) (equal 0.0 (vla-get-radius o) 1e-8) (vlax-write-enabled-p o)) (vla-put-radius o 1.0) ) ) ) ) (vla-regen d acallviewports) (princ) ) (vl-load-com) (princ) 1 Quote
mhupp Posted March 31, 2023 Posted March 31, 2023 7 hours ago, ronjonp said: Post your sample drawing. I've never seen a circle in AutoCAD that has a radius of 0. its probably a small number like 0.00000000005 and with the precision set to like 4 it would only show 0. Also If you run Lee's code and it doesn't change anything the precision might be too high so change 1e-8 to something lower. right is only going to find really small circles. Quote
ronjonp Posted April 1, 2023 Posted April 1, 2023 (edited) 4 hours ago, mhupp said: its probably a small number like 0.00000000005 and with the precision set to like 4 it would only show 0. Also If you run Lee's code and it doesn't change anything the precision might be too high so change 1e-8 to something lower. right is only going to find really small circles. I know these small numbers only wanted a sample drawing. Edited April 1, 2023 by ronjonp 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.