Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using SSGET to select a Block to move it

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
AR12
3277 Views, 2 Replies

Using SSGET to select a Block to move it

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?

Thanks,
Adam Richardson

If needed: AutoCAD 2017 User using Visual LISP for editing LISP and DCL files
2 REPLIES 2
Message 2 of 3
Kent1Cooper
in reply to: AR12


@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)

Kent Cooper, AIA
Message 3 of 3
AR12
in reply to: Kent1Cooper

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.

Thanks,
Adam Richardson

If needed: AutoCAD 2017 User using Visual LISP for editing LISP and DCL files

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost