I'm having an issue with using the SSGET to select a block so I can move it. I'm changing the UCS to be at the center of the top view in the program(user selects center) and the block is at 0,0,0 after changing the UCS. However when I use SSGET it doesn't select it. So I used:
(setq en(car (entsel "\n Select a block :"))) (setq enlist(entget en))
and it lists the DXF Code of 10 as
(10 15.0893 13.5165 0.0)
How can I then select it if I don't necessarily know where the block is going to be?
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
@AR12 wrote:I'm having an issue with using the SSGET to select a block so I can move it. I'm changing the UCS to be at the center of the top view in the program(user selects center) and the block is at 0,0,0 after changing the UCS. However when I use SSGET it doesn't select it. So I used:
(setq en(car (entsel "\n Select a block :"))) (setq enlist(entget en))and it lists the DXF Code of 10 as
(10 15.0893 13.5165 0.0)How can I then select it if I don't necessarily know where the block is going to be?
It sounds like you do know where it's going to be -- you just have to be able to identify that location. Try this:
(setq en
(ssname
(ssget "_X" ; search whole drawing
(list
'(2 . "YourBlockName")
(cons
10 ; insertion point
(trans '(0 0 0) 1 0); UCS origin converted to WCS
); cons
); list
); ssget
0 ; first [presumably only] item in selection set
); ssname
); setq
Or, if it's the only such Block in the drawing, you can just filter for the Block name:
(setq en (ssname (ssget "_X" '((2 . "YourBlockName"))) 0)
Hi Kent,
Thank you that sounds like it will probably work. That was the part I wasn't aware of was how to get it to the UCS from what it was looking at.