Slickrick2000 Posted December 25, 2005 Posted December 25, 2005 I have written a small lisp that will insert a piece of pipe with a 90 degree fitting on one end. The object is an ObjectARX which was created from a 3rd party program. Basically I want to stretch the piece of pipe from PT1 to PT2. Is there any wa to do this? I have tried entlast and it selects the pipe, but when I try to use the stretch command, autocad wants the item to be selected by fencing it in. I have had no luck in finding any tutorials that tell how to manipulate using grips in autolisp. Please tell me I just haven't looked long enough. I can't think that autodesk wouldn't allow you to use grips in lisp. Rick Quote
CarlB Posted December 25, 2005 Posted December 25, 2005 I couldn't tell if you actually tried using the "stretch" command in lisp. feed information to the (command "stretch" "w" pta ptb etc.....) You'll have to figure what window you'll need to grip the pipe end. Quote
Slickrick2000 Posted December 26, 2005 Author Posted December 26, 2005 Yes I tried using the stretch command in a lisp and (entlast) highlights the pipe as if I selected it, but it then says I need to use a fencing window to select the objects I want to stretch. What I need to do is to have it grip previously selected PT1 and stretch it to previously selected PT2, without having to fence it in a window. Quote
CarlB Posted December 28, 2005 Posted December 28, 2005 If you know where the end of the pipe is you want to stretch (say pt1), and pt2 and pt3 define a window around the end/pt1, and pt4 is where you want to stretch it to...... (command "stretch" "l" "w" pt2 pt3 "" pt1 pt4) Quote
Slickrick2000 Posted December 28, 2005 Author Posted December 28, 2005 Not sure if that would work because PT1 intersects with other objects that I need to be sure absolutely do not have a chance to move. What I have is a Tee with PT1 being the center point of the tee. PT2 is the point of the tee where the end of the pipe needs to end up. When I insert the block, the pipe is a certain length from PT1 to the 90ELL on the other end (6"). I now need to move the end of the pipe at PT1 to PT2 which is the takeoff of the Tee. Since the fitting I insert the pipe into will not always be a Tee, and all of the fittings have different takeoffs, I have to start with the center and figure out how to move the pipe to where it needs to be PT2. PT1 and PT2 will always be known since the user is prompted for both so that the lisp can get both the starting point and direction the pipe needs to be inserted to. So far stretching from the grip is the only way I can figure this will work unless I can select with a window as you say, then DEselect everything but the pipe, which would still be ENTLAST. Quote
Slickrick2000 Posted December 30, 2005 Author Posted December 30, 2005 OK, I was able to select the object and turn on the grips using (sssetfirst nil (ssget "_p")) But now I am not sure how to select a certain grip (which is PT1) and drag it to PT2. Anyone able to help me with this one? Quote
CarlB Posted December 30, 2005 Posted December 30, 2005 Slick, The method I posted works for basic AutoCAD objects, don't know if it'll handle your proxy object. Grips don't need to be on for the stretch command. The following will move the endpoint of the last drawn line from P1 to P2: (command "stretch" "l" "w" p1 p1 "" p1 p2) Quote
thalon Posted December 30, 2005 Posted December 30, 2005 Yes CarlB, BUT, how you you ensure that only the object you want to stretch, namely the last object created, is stretched? What if you have 2 objects that share PT1? Can you deselect all, except the last object created? What about a loop that will remove enteties from the selection set if they do not match the ENTLAST name? This should leave you with a selection set of just the entity (which we want) and still allow for a crossing window selection. Quote
CarlB Posted December 30, 2005 Posted December 30, 2005 The method I used selects just the last item "l", then uses a WINDOW (not crossing) selection at the exact endpoint so it does not select any additional objects, just identifies the endpoint to be stretched. Only if there was a point object at the endpoint would it get moved by the stretch. If you still need to remove items, use something like: (command "stretch" "c" PtA Ptb "r" "all" "a" "l" "" Pt1 Pt2) Quote
Slickrick2000 Posted December 30, 2005 Author Posted December 30, 2005 Yes CarlB, BUT, how you you ensure that only the object you want to stretch, namely the last object created, is stretched?What if you have 2 objects that share PT1? Can you deselect all, except the last object created? What about a loop that will remove enteties from the selection set if they do not match the ENTLAST name? This should leave you with a selection set of just the entity (which we want) and still allow for a crossing window selection. Exactly, that is the dilemma. I have two entities that share PT1 and need to either select the object I want to stretch, or deselect all but the object. I have succeeded in selecting the object, and turning on the grips, but do not know how to activate the grip at PT1 and move it to PT2. BTW, thanks for all the help. I really do try and search out these answers before asking here. Quote
Slickrick2000 Posted December 30, 2005 Author Posted December 30, 2005 Ok, after reading CarlB's last post, I tried it again, and I am embarased to say, that after putting in the correct variables it now works perfect. Working on two different lisps, and I stuck some variables from my other lisp in there and thats why it wasn't working. Thanks for all the help CarlB and thalon Now all I need to do is figure out why I get this at the command prompt at the end of the command. Command: # I think it has something to do with my error trap. I'll see if I can fix it first before asking you guys. Quote
jaylo23 Posted June 24, 2009 Posted June 24, 2009 Hello all, after searching through the forum i was able to find a thread with a problem similar to the one i am having. I have a lisp that will use the stretch command incorporating the x and y point filters. The lisp does everthing i want it to do except that i would like it to work a little more like the built in stretch command whereas it highlights everything before it peforms the stretch and gives you the option of deselecting objects you dont want stretched. I am just barely competent in lisp to slap together one so any help is greatly appreciated. Here is lisp: ;******************************** Stretch Object(s) using .y Point Filter ********************************************* (defun C:yST (/ oldsnap sset1 sset2 sset3 base sec *error*) (setq temperr *error*) (setq *error* XYTTrap) (setq oldsnap (getvar"osmode")) (setvar "osmode" 255) (setq sset1 (getpoint "Select Objects: ")) (setq sset2 (getcorner sset1)) (setq sset3 (ssget "_c" sset1 sset2)) (setq base (getpoint "\nSpecify Base Point: ")) (setq sec (getpoint "\nSpecify Second Point: ")) (setvar "osmode" 0) (command "stretch" 3 "" base ".y" sec "0") (setvar "osmode" oldsnap) (setq *error* temperr) (princ) ) P.S. I didnt write this lisp because i am lazy and dont feel like doing the extra clicks necessary to use point filters, but i have recently dislocated my thumb (looked like something out of a horror movie) and i need to make modeling and designing as pain free and easy as possible. Thanks in advance. Quote
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.