Jump to content

Find circles of a certain radius in block and update size


mel-wlp

Recommended Posts

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 ! 

Link to comment
Share on other sites

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)

 

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by ronjonp
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...