Jump to content

SSGET - select block by coordinates


scubastu

Recommended Posts

Someone has probably asked this before but I can't quite make sense of the ssget function with all its options.

 

I want to write into my lisp a command to select a block at the end of my line which is variable pt2. I will then move the block to a new position (where the end of the line ends up).

 

Thanks in advance

Link to comment
Share on other sites

Hi, If you are just wanting to select one object at one point have a look at the nentselp function in the developer help.

Let me know if you want further assistance.

 

I remember trying the ssget function for a point, though this may be wrong if someone can correct me.

(setq Ent (car(entsel))
    ss (ssget "_X" (list (-4 . "=[color=Red]1,1,1[/color]") (assoc 11 (entget Ent)))))

Link to comment
Share on other sites

Cont.

Or maybe this?

(setq pt2 (getpoint)
     ss (ssget "_X" (list '(-4 . "=,=,=")([color=Navy]cons 11[/color] [color=Red]pt2[/color]))))

Blue is the dxf code, red is the co-ordinate.

 

Or if you wanted to add a fuzz factor:

 

(setq pt2 (getpoint)
     fuz 1.0
     ss (ssget "_X" (list '(-4 . "<,<,<")(cons 11 (list (+ (car pt2) fuz)
                                                        (+ (cadr pt2) fuz)
                                                        (+ (caddr pt2) fuz)
                           ))
                           '(-4 . ">,>,>")(cons 11 (list (- (car pt2) fuz)
                                                        (- (cadr pt2) fuz)
                                                        (- (caddr pt2) fuz)
                           ))
             )))

Link to comment
Share on other sites

I was thinking something like;

 

(ssget Pt)

 

but that selects a single object, may pick line instead of block.

You may need to define a crossing window second point "p2" close by Pt1, then;

 

(ssget "c" (list pt1 pt2) '((0 . "BLOCK")))

Link to comment
Share on other sites

Cont.

Or maybe this?

(setq pt2 (getpoint)
     ss (ssget "_X" (list '(-4 . "=,=,=")([color=navy]cons 11[/color] [color=red]pt2[/color]))))

Blue is the dxf code, red is the co-ordinate.

 

Hey thanks Steve, your reply gave me enough to get sorted. I couldn't get the structure right for the code and kept getting errors. Such a relief when someone gives you the right info! Cheers!:D

 

This was my final line I inserted

 

 (setq ins (ssget "_X" (list '(-4 . "=,=,=")(cons 10 pt2)(cons 0 "insert"))))

 

I tried your your above one but as the coordinates were the same for the end of the line (cons 11 instead of cons 10).. all of the lines changed but I might actually use this somewhere else.. so adding the filter "insert" made sure there was no confusion with the command (I think :unsure:)

 

Thanks again

Link to comment
Share on other sites

Great! glad it worked for you :) I wouldn't be surprised if there's a better way of presenting it that I'm not aware of.

 

CarlB, I wasn't aware of that way of using ssget on a point, thanks.

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...