scubastu Posted October 30, 2009 Share Posted October 30, 2009 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 Quote Link to comment Share on other sites More sharing options...
SteveK Posted October 30, 2009 Share Posted October 30, 2009 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))))) Quote Link to comment Share on other sites More sharing options...
SteveK Posted October 30, 2009 Share Posted October 30, 2009 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) )) ))) Quote Link to comment Share on other sites More sharing options...
CarlB Posted October 30, 2009 Share Posted October 30, 2009 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"))) Quote Link to comment Share on other sites More sharing options...
scubastu Posted October 30, 2009 Author Share Posted October 30, 2009 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! 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 ) Thanks again Quote Link to comment Share on other sites More sharing options...
SteveK Posted October 30, 2009 Share Posted October 30, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.