Mea culpa. Double post. But I think this Brainy Bunch might have some suggestions. '( :Is there a method of dynamically sliding an object (like a vehicle or a :building) along a trajectory, keeping 2 points of the object aligned to the :trajectory? I believe there's a vehicle turning program out there that does :something like it -- but I'm not really ready to buy a major program just :for that convenience. ) In further clarification, I want to drag the object with the mouse but have it align to the curve continuously. I'm thinking 1) a mouse reactor and 2) an alignment of the 2 object hot points perpendicular to the curve, every so many units moved. The increment would have to be pretty small so as to not permit the user to drag the object all over kingdom come -- but large enough so that the constant interruption from the program would not become a pita. Any suggestions? rs
If, perchance, simple single curves like arcs and circles are all you need to do this with (a slim chance, but possible, considering the Subject line of your message), you can of course just Rotate the object(s) using the center-point of the arc or circle as the rotation base point, and possibly using the Reference option for the extent of rotation. But I assume you're talking about something more complicated (such as maybe a polyline that changes direction, or something). If so, sorry -- I don't have any bright ideas.
Right. I was careful to say "curve" so as to include any object with a variable dy/dx. What the hey, make it dy/dx/dz. Me, too, bro. I haven't had a bright idea in a 'coon's age*. Wonder what it's like. rs *4-5 years. : If, perchance, simple single curves like arcs and circles are all you need : to do this with (a slim chance, but possible, considering the Subject line : of your message), you can of course just Rotate the object(s) using the : center-point of the arc or circle as the rotation base point, and possibly : using the Reference option for the extent of rotation. But I assume you're : talking about something more complicated (such as maybe a polyline that : changes direction, or something). If so, sorry -- I don't have any bright : ideas. : -- : Kent Cooper : : "tcebob" wrote... : > Mea culpa. Double post. But I think this Brainy Bunch might have some : > suggestions. : > '( : > :Is there a method of dynamically sliding an object (like a vehicle or a : > :building) along a trajectory, keeping 2 points of the object aligned to : > the : > :trajectory? I believe there's a vehicle turning program out there that : > does : > :something like it -- but I'm not really ready to buy a major program just : > :for that convenience. : > ) : > : > In further clarification, I want to drag the object with the mouse but : > have : > it align to the curve continuously. I'm thinking 1) a mouse reactor and 2) : > an alignment of the 2 object hot points perpendicular to the curve, every : > so : > many units moved. The increment would have to be pretty small so as to not : > permit the user to drag the object all over kingdom come -- but large : > enough : > so that the constant interruption from the program would not become a : > pita. : > : > Any suggestions? : > rs : :
Several years ago I created drawings for Turning Radius of Bus, Truck & 3 Semi's of various size. I don't remember exactly where I found the specs for the drawings, but I did locate the files. I then had a lisp routine to insert the block showing the vehicle and the tire tracks. You could then rotate the block to see if the tracks fit inside the area required. This seemed to work pretty well. If you want to select an object to dynamically "slide" along a curve you, then pseudo code I would suggest is - Select Entities the make up the vehicle (all ready in the Zero Degree orientation) Copy the entities and turn into a block (unless 1 object selected and is all ready a block) User select Arc/Circle for path Insert block using Xscale, Yscale, Zscale & "Protate" properties This will allow you to see the Object(s) and allow you to dynamically rotate
Hi (Bob? rs?), I've always wanted to do this and been too intimidated by it (didn't think I could). I just couldn't stay away though. Here's my shot at it. Much simpler than I thought it would be... This is my first attempt at using grread though, so if I've done something wrong or even just silly with it, I hope someone will let me know. This is rough code to use as a starting point only (i.e. no error checking, etc. etc.) BTW, I know this isn't exactly what you asked for, but it could be adapted for your purpose. Code: (defun c:DragAndPlace (/ blk code curve doc ins ms pck rot) (setq doc (vlax-get (vlax-get-Acad-Object) 'ActiveDocument) ms (vlax-get doc 'ModelSpace) blk (getstring "\nEnter block name to insert. ") curve (entsel "\nPick curve to attach block to. ") ins (cadr curve) curve (car curve) blk (vlax-invoke ms 'InsertBlock ins blk 1 1 1 0) ) (redraw (vlax-vla-object->ename blk) 3) (prompt "\nPick a point to place the block. ") (while (not pck) (setq code (grread t 1 1) pck (cond ((= (car code) 3) (cadr code) ) ((/= (car code) 5) ins ) ) ins (cond (pck) ((cadr code)) ) ins (vlax-curve-getclosestpointto curve ins) rot (vlax-curve-getparamatpoint curve ins) rot (vlax-curve-getfirstderiv curve rot) rot (angle '(0 0 0) rot) ) (vlax-put blk 'InsertionPoint ins) (vlax-put blk 'Rotation rot) ) (redraw (vlax-vla-object->ename blk) 4) (princ) )
Wow. I will try it after supper. rs "James Allen" <JamesA~AA~mwengrs~DD~com> wrote in message : Hi (Bob? rs?), : : I've always wanted to do this and been too intimidated by it (didn't think I : could). I just couldn't stay away though. : : Here's my shot at it. Much simpler than I thought it would be... This is : my first attempt at using grread though, so if I've done something wrong or : even just silly with it, I hope someone will let me know. This is rough : code to use as a starting point only (i.e. no error checking, etc. etc.) : : BTW, I know this isn't exactly what you asked for, but it could be adapted : for your purpose. : : Code: : (defun c:DragAndPlace (/ blk code curve doc ins ms pck rot) : (setq doc (vlax-get (vlax-get-Acad-Object) 'ActiveDocument) : ms (vlax-get doc 'ModelSpace) : blk (getstring "\nEnter block name to insert. ") : curve (entsel "\nPick curve to attach block to. ") : ins (cadr curve) : curve (car curve) : blk (vlax-invoke ms 'InsertBlock ins blk 1 1 1 0) : ) : (redraw (vlax-vla-object->ename blk) 3) : (prompt "\nPick a point to place the block. ") : (while (not pck) : (setq code (grread t 1 1) : pck (cond ((= (car code) 3) : (cadr code) : ) : ((/= (car code) 5) : ins : ) : ) : ins (cond (pck) : ((cadr code)) : ) : ins (vlax-curve-getclosestpointto curve ins) : rot (vlax-curve-getparamatpoint curve ins) : rot (vlax-curve-getfirstderiv curve rot) : rot (angle '(0 0 0) rot) : ) : (vlax-put blk 'InsertionPoint ins) : (vlax-put blk 'Rotation rot) : ) : (redraw (vlax-vla-object->ename blk) 4) : (princ) : ) : : -- : James Allen, EIT : Malicoat-Winslow Engineers, P.C. : Columbia, MO : : : > Mea culpa. Double post. But I think this Brainy Bunch might have some : > suggestions. : > '( : > :Is there a method of dynamically sliding an object (like a vehicle or a : > :building) along a trajectory, keeping 2 points of the object aligned to : the : > :trajectory? I believe there's a vehicle turning program out there that : does : > :something like it -- but I'm not really ready to buy a major program just : > :for that convenience. : > ) : > : > In further clarification, I want to drag the object with the mouse but : have : > it align to the curve continuously. I'm thinking 1) a mouse reactor and 2) : > an alignment of the 2 object hot points perpendicular to the curve, every : so : > many units moved. The increment would have to be pretty small so as to not : > permit the user to drag the object all over kingdom come -- but large : enough : > so that the constant interruption from the program would not become a : pita. : > : > Any suggestions? : > rs : > : > : :
PS: My friend calls me "Hey, uh, whatsyrface." All others may employ any sobriquet they feel appropriate, as long as ". . . dinner's on the table" is appended. "Bob" works fine. rs
If you are on subscription, you may want to wait and check out dynamic blocks in 2006. You can add an alignment parameter (grip) to a block and have it behave exactly like this. When you use this grip, the block will automatically align itelf to geometry and you can then drag it along a curve.... Joel Roderick www.watertechnologyinc.com
Sweeeeet!! Just like contour labels in LDT! -- I support two teams: The Red Sox and whoever beats the Yankees.
Thanks again, James. I'll let you know in a few minutes. rs "James Allen" <JamesA~AA~mwengrs~DD~com> wrote in message : Hi again Bob, : I got a little free time and just couldn't stay away (nor wait for 2k6). I : think this one's closer to what you were really asking for. Same : disclaimers apply... : Thanks for the inspiration, : -- : James Allen, EIT : Malicoat-Winslow Engineers, P.C. : Columbia, MO : : Code: : (defun c:DragAndPlace (/ ActiveDocument AlignAng : AttchAng AttchDst blk circle : code curve ins nAlign : nAttch oAlign pck rot : ) : (setq ActiveDocument (vlax-get (vlax-get-Acad-Object) 'ActiveDocument) : blk (getstring "\nEnter block name to insert. ") : blk (cond ((vl-catch-all-error-p : (vl-catch-all-apply : 'vla-Item : (list (vla-get-Blocks ActiveDocument) blk) : ) : ) : (findfile (strcat blk ".dwg")) : ) : (blk) : ) : curve (entsel "\nPick curve to attach block to. ") : ins (cadr curve) : curve (vlax-ename->vla-object (car curve)) : blk (vlax-invoke : (vlax-get ActiveDocument 'ModelSpace) : 'InsertBlock ins blk 1 1 1 0 : ) : nAttch (getpoint "\nPick an attachment point. ") : nAlign (getpoint "\nPick an alignment point. ") : AlignAng (angle nAttch nAlign) : AttchAng (- (angle nAttch ins) AlignAng) : AttchDst (distance nAttch ins) : oAlign nAlign : ) : (entmake (list '(0 . "CIRCLE") : (cons 10 nAttch) : (cons 40 (distance nAttch nAlign)) : '(60 . 1) : ) : ) : (setq circle (vlax-ename->vla-object (entlast))) : (prompt "\nPick a point to place the block. ") : (while (not pck) : (setq code (grread t 1 1) : pck (cond ((= (car code) 3) : (cadr code) : ) : ((/= (car code) 5) : nAttch : ) : ) : nAttch (cond (pck) : ((cadr code)) : ) : nAttch (vlax-curve-getclosestpointto curve nAttch) : ) : (vlax-put circle 'Center nAttch) : (setq nAlign (vlax-invoke : circle : 'IntersectWith : curve : acExtendOtherEntity : ) : nAlign (NearestPointTo (list oAlign (ListPoints nAlign))) : rot (angle nAttch nAlign) : ins (polar nAttch (+ rot AttchAng) AttchDst) : rot (- rot AlignAng) : oAlign nAlign : ) : (vlax-put blk 'InsertionPoint ins) : (vlax-put blk 'Rotation rot) : (vla-Highlight blk :vlax-True) : ) : (vla-Delete circle) : (vla-Update blk) : (princ) : ) : (defun ListPoints (arglst / i pt pts) : (setq i 0) : (repeat (length arglst) : (setq pt (cons (car arglst) pt) : arglst (cdr arglst) : i (1+ i) : ) : (if (= i 3) : (setq pts (cons (reverse pt) pts) : pt nil : i 0 : ) : ) : ) : (reverse pts) : ) : (defun NearestPointTo (arglst / dst pt pts) : (mapcar 'set '(pt pts) arglst) : (setq dst (mapcar '(lambda (a) (distance pt a)) pts)) : (nth (vl-position (apply 'min dst) dst) pts) : ) : : : : "James Allen" <JamesA~AA~mwengrs~DD~com> wrote in message : : > Hi (Bob? rs?), : > : > I've always wanted to do this and been too intimidated by it (didn't think : I : > could). I just couldn't stay away though. : > : > Here's my shot at it. Much simpler than I thought it would be... This is : > my first attempt at using grread though, so if I've done something wrong : or : > even just silly with it, I hope someone will let me know. This is rough : > code to use as a starting point only (i.e. no error checking, etc. etc.) : > : > BTW, I know this isn't exactly what you asked for, but it could be adapted : > for your purpose. : > : > Code: : <snip> : > : > -- : > James Allen, EIT : > Malicoat-Winslow Engineers, P.C. : > Columbia, MO : > : > : : > > Mea culpa. Double post. But I think this Brainy Bunch might have some : > > suggestions. : > > '( : > > :Is there a method of dynamically sliding an object (like a vehicle or a : > > :building) along a trajectory, keeping 2 points of the object aligned to : > the : > > :trajectory? I believe there's a vehicle turning program out there that : > does : > > :something like it -- but I'm not really ready to buy a major program : just : > > :for that convenience. : > > ) : > > : > > In further clarification, I want to drag the object with the mouse but : > have : > > it align to the curve continuously. I'm thinking 1) a mouse reactor and : 2) : > > an alignment of the 2 object hot points perpendicular to the curve, : every : > so : > > many units moved. The increment would have to be pretty small so as to : not : > > permit the user to drag the object all over kingdom come -- but large : > enough : > > so that the constant interruption from the program would not become a : > pita. : > > : > > Any suggestions? : > > rs : > > : > > : > : > : :
Hi again Bob, I got a little free time and just couldn't stay away (nor wait for 2k6). I think this one's closer to what you were really asking for. Same disclaimers apply... Thanks for the inspiration, -- James Allen, EIT Malicoat-Winslow Engineers, P.C. Columbia, MO Code: (defun c:DragAndPlace (/ ActiveDocument AlignAng AttchAng AttchDst blk circle code curve ins nAlign nAttch oAlign pck rot ) (setq ActiveDocument (vlax-get (vlax-get-Acad-Object) 'ActiveDocument) blk (getstring "\nEnter block name to insert. ") blk (cond ((vl-catch-all-error-p (vl-catch-all-apply 'vla-Item (list (vla-get-Blocks ActiveDocument) blk) ) ) (findfile (strcat blk ".dwg")) ) (blk) ) curve (entsel "\nPick curve to attach block to. ") ins (cadr curve) curve (vlax-ename->vla-object (car curve)) blk (vlax-invoke (vlax-get ActiveDocument 'ModelSpace) 'InsertBlock ins blk 1 1 1 0 ) nAttch (getpoint "\nPick an attachment point. ") nAlign (getpoint "\nPick an alignment point. ") AlignAng (angle nAttch nAlign) AttchAng (- (angle nAttch ins) AlignAng) AttchDst (distance nAttch ins) oAlign nAlign ) (entmake (list '(0 . "CIRCLE") (cons 10 nAttch) (cons 40 (distance nAttch nAlign)) '(60 . 1) ) ) (setq circle (vlax-ename->vla-object (entlast))) (prompt "\nPick a point to place the block. ") (while (not pck) (setq code (grread t 1 1) pck (cond ((= (car code) 3) (cadr code) ) ((/= (car code) 5) nAttch ) ) nAttch (cond (pck) ((cadr code)) ) nAttch (vlax-curve-getclosestpointto curve nAttch) ) (vlax-put circle 'Center nAttch) (setq nAlign (vlax-invoke circle 'IntersectWith curve acExtendOtherEntity ) nAlign (NearestPointTo (list oAlign (ListPoints nAlign))) rot (angle nAttch nAlign) ins (polar nAttch (+ rot AttchAng) AttchDst) rot (- rot AlignAng) oAlign nAlign ) (vlax-put blk 'InsertionPoint ins) (vlax-put blk 'Rotation rot) (vla-Highlight blk :vlax-True) ) (vla-Delete circle) (vla-Update blk) (princ) ) (defun ListPoints (arglst / i pt pts) (setq i 0) (repeat (length arglst) (setq pt (cons (car arglst) pt) arglst (cdr arglst) i (1+ i) ) (if (= i 3) (setq pts (cons (reverse pt) pts) pt nil i 0 ) ) ) (reverse pts) ) (defun NearestPointTo (arglst / dst pt pts) (mapcar 'set '(pt pts) arglst) (setq dst (mapcar '(lambda (a) (distance pt a)) pts)) (nth (vl-position (apply 'min dst) dst) pts) )