# Thread: Circle inside the Block

1. Registered forum members do not see this ad.

Originally Posted by wimal
Code:
`(setq xss2 (ssget"C"pt1 pt2  '((0 . "INSERT") )))`
I mean there are blocks in my selection set. So I cant directly pick on circle to get the diameter.
Hi,

This should print the radius of circles found in the selected blocks:
Code:
```(if xss2
(repeat (setq i (sslength xss2))
(setq obj (tblobjname "BLOCK" (cdr (assoc 2 (entget (ssname xss2 (setq i (1- i))))))))
(while (setq obj (entnext obj))
(and (= (cdr (assoc 0 (setq get (entget obj)))) "CIRCLE")
(print (cdr (assoc 40 get))))
)
)
)```

2. Originally Posted by Tharwat
Hi,

This should print the radius of circles found in the selected blocks:
Code:
```(if xss2
(repeat (setq i (sslength xss2))
(setq obj (tblobjname "BLOCK" (cdr (assoc 2 (entget (ssname xss2 (setq i (1- i))))))))
(while (setq obj (entnext obj))
(and (= (cdr (assoc 0 (setq get (entget obj)))) "CIRCLE")
(print (cdr (assoc 40 get))))
)
)
)```

If the block is scaled then you need to check if the block is uniformly scaled and if it is, multiple the radius from the block def by the xscalefactor to get the true radius

3. Originally Posted by dlanorh
If the block is scaled then you need to check if the block is uniformly scaled and if it is, multiple the radius from the block def by the xscalefactor to get the true radius
Right on.

But it seems is that the OP deleted one of their replies that they mentioned they wanted to get the radius to re-scale the blocks back to scale.

4. Originally Posted by Tharwat
Right on.

But it seems is that the OP deleted one of their replies that they mentioned they wanted to get the radius to re-scale the blocks back to scale.

No wonder i'm confused

5. Both of you are correct.We need to resize the block with reference to the circle inside the block. Our blocks are always scaled uniformly. So the above code is fulfill our requirements. Thanks for your valuable time and codes.

6. Originally Posted by wimal
Both of you are correct.We need to resize the block with reference to the circle inside the block. Our blocks are allays scaled uniformly. So the above code is fulfill our requirements. Thanks for your valuable time and codes.
If you need to check the blocks scale using lisp, check the scale factor

Code:
```(= (cdr (assoc 41 (entget ent))) 1) ;  for "insert" entity

(= (vla-get-xscalefactor blk_obj) 1);  for blk object```

7. Originally Posted by dlanorh
If you need to check the blocks scale using lisp, check the scale factor

Code:
```(= (cdr (assoc 41 (entget ent))) 1) ;  for "insert" entity

(= (vla-get-xscalefactor blk_obj) 1);  for blk object```
Code:
```;;;............FIND DETAILS OF CIRCLE INSIDE A BLOCK.........................
(setq xss2 nil)
(setq pt1 (getpoint"\n Select objects by window "))
(setq pt2 (getcorner pt1"\n 2nd corner"))
(setq xss2 (ssget"C"pt1 pt2  '((0 . "INSERT") )))
(if xss2
(repeat (setq i (sslength xss2))
(setq e(entget (ssname xss2 (setq i (1- i)))))
(setq xscale (cdr(assoc 41 e)))
(setq obj (tblobjname "BLOCK" (cdr (assoc 2 e))))

(while (setq obj (entnext obj))
(and (= (cdr (assoc 0 (setq get (entget obj)))) "CIRCLE")
(setq radius (cdr (assoc 40 get)))
);and
);while
);repeat
);if
;;;.............................................................................```

8. Select similar blocks then from the properties palette you can change the three scales X,Y,Z to 1.0 and that's the shortest way.

9. Registered forum members do not see this ad.

Originally Posted by Tharwat
Select similar blocks then from the properties palette you can change the three scales X,Y,Z to 1.0 and that's the shortest way.
Good idea. thanks a lot.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts