View Full Version : SSGET - select block by coordinates
scubastu
30th Oct 2009, 02:06 am
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
SteveK
30th Oct 2009, 05:14 am
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 . "=1,1,1") (assoc 11 (entget Ent)))))
SteveK
30th Oct 2009, 05:31 am
Cont.
Or maybe this?
(setq pt2 (getpoint)
ss (ssget "_X" (list '(-4 . "=,=,=")(cons 11 pt2))))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)
))
)))
CarlB
30th Oct 2009, 05:32 am
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")))
scubastu
30th Oct 2009, 09:49 am
Cont.
Or maybe this?
(setq pt2 (getpoint)
ss (ssget "_X" (list '(-4 . "=,=,=")(cons 11 pt2))))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
SteveK
30th Oct 2009, 11:47 am
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.
Powered by vBulletin™ Version 4.1.2 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.