Lee Mac Posted March 12, 2010 Posted March 12, 2010 Don't forget about ACET-SS-Drag-Move. I only suggest this to allow the user the ability of being able to utilize OSnaps normally and avoid the annoyances of a right-click if using Move..Pause. However, it does require Express Tools to be loaded. Nice one mate - completely forgot about that one! Quote
Lee Mac Posted March 12, 2010 Posted March 12, 2010 An example for you to play with Sadhu (defun c:test (/ Move ss p1 p2) (vl-load-com) (defun Move (ss p1 p2 / i ent) (setq i -1) (while (setq ent (ssname ss (setq i (1+ i)))) (vla-move (vlax-ename->vla-object ent) (vlax-3D-point p1) (vlax-3D-point p2)))) (if (and (setq ss (ssget)) (setq p1 (getpoint "\nPick Base Point: ")) (setq p2 (acet-ss-drag-move ss p1 "\nSpecify Second Point: " t))) (Move ss p1 p2)) (princ)) Quote
sadhu Posted March 12, 2010 Author Posted March 12, 2010 (defun c:test (/ Move ss p1 p2) (vl-load-com) (defun Move (ss p1 p2 / i ent) (setq i -1) (while (setq ent (ssname ss (setq i (1+ i)))) (vla-move (vlax-ename->vla-object ent) (vlax-3D-point p1) (vlax-3D-point p2)))) (if (and (setq ss (ssget)) (setq p1 (getpoint "\nPick Base Point: ")) (setq p2 (acet-ss-drag-move ss p1 "\nSpecify Second Point: " t))) (Move ss p1 p2)) (princ)) Thanks, I'll work on that. Quote
alanjt Posted March 12, 2010 Posted March 12, 2010 Nice one mate - completely forgot about that one! It's just so useful. Quote
sadhu Posted March 15, 2010 Author Posted March 15, 2010 Not very satisfying but I managed it like this. It selects the last object inserted and moves it. I had to replace "ss" with "ss1" but didn't understand the difference. Is it possible to make "entmakex" invisible ? (and (setq pnt (getpoint "\nPunto di inserimento misura / Specify Text placement point: " ) ) (entmakex (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") ;(cons 8 lay) (cons 1 result) (cons 7 (getvar 'textstyle)) (cons 10 pnt) ;point of insertion (cons 40 0.08) ) ;_ list ) ;_ entmakex ) ;_ and ;------------------------ (defun Move (ss1 p1 p2 / i ent) (setq i -1) (while (setq ent (ssname ss1 (setq i (1+ i)))) (vla-move (vlax-ename->vla-object ent) (vlax-3D-point p1) (vlax-3D-point p2)))) (if (and (setq ss1 (ssget [color=Red]"L"[/color])) ;(setq p1 (getpoint "\nPick Base Point: ")) (setq p2 (acet-ss-drag-move ss1 [color=Red]pnt [/color]"\nSpecify Second Point: " t 0))) (Move ss1 [color=Red]pnt[/color] p2)) (princ) Quote
Lee Mac Posted March 15, 2010 Posted March 15, 2010 I would perhaps rewrite it something like this: (setq dummyss (ssadd)) (and (setq Pt1 (getpoint "\nPunto di inserimento misura / Specify Text placement point: ")) (setq ent (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 1 result) (cons 7 (getvar 'textstyle)) (cons 10 Pt1) ;point of insertion (cons 40 0.08)))) (setq Pt2 (acet-ss-drag-move (ssadd ent dummyss) Pt1 "\nSpecify Second Point: " t 0)) (vla-move (vlax-ename->vla-object ent) (vlax-3D-point Pt1) (vlax-3D-point Pt2))) Quote
alanjt Posted March 15, 2010 Posted March 15, 2010 For a single object, you don't have to worry with creating a stored ssadd variable. (and (setq Pt1 (getpoint "\nPunto di inserimento misura / Specify Text placement point: ")) (setq ent (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 1 result) (cons 7 (getvar 'textstyle)) (cons 10 Pt1) ;point of insertion (cons 40 0.08)))) (setq Pt2 (acet-ss-drag-move (ssadd ent) Pt1 "\nSpecify Second Point: " t 0)) (vla-move (vlax-ename->vla-object ent) (vlax-3D-point Pt1) (vlax-3D-point Pt2))) Quote
sadhu Posted March 15, 2010 Author Posted March 15, 2010 (and (setq Pt1 (getpoint "\nPunto di inserimento misura / Specify Text placement point: ")) (setq ent (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 1 result) (cons 7 (getvar 'textstyle)) (cons 10 Pt1) ;point of insertion (cons 40 0.08)))) (setq Pt2 (acet-ss-drag-move (ssadd ent) Pt1 "\nSpecify Second Point: " t 0)) (vla-move (vlax-ename->vla-object ent) (vlax-3D-point Pt1) (vlax-3D-point Pt2))) Your code is definitely more "elegant", compact and works fine. However it behaves in the same manner as the one I wrote/compiled - it was your code anyway. Thanks a lot . Any suggestions to rotate text - (ent) ? Quote
sadhu Posted March 15, 2010 Author Posted March 15, 2010 Got to thank both of you . This site updates damn too fast. Quote
alanjt Posted March 15, 2010 Posted March 15, 2010 (and (setq Pt1 (getpoint "\nPunto di inserimento misura / Specify Text placement point: ")) (setq ent (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 1 result) (cons 7 (getvar 'textstyle)) (cons 10 Pt1) ;point of insertion (cons 40 0.08)))) (setq Pt2 (acet-ss-drag-move (ssadd ent) Pt1 "\nSpecify Second Point: " t 0)) (not (vla-move (vlax-ename->vla-object ent) (vlax-3D-point Pt1) (vlax-3D-point Pt2))) (setq Rot (acet-ss-drag-rotate (ssadd ent) Pt2 "Specify angle: " T 0)) (vla-put-rotation (vlax-ename->vla-object ent) Rot)) Quote
sadhu Posted March 15, 2010 Author Posted March 15, 2010 Just tried it. Works great. Thanks Alan. Do I have the "quote the code" every time I post a reply - like below ? (and (setq Pt1 (getpoint "\nPunto di inserimento misura / Specify Text placement point: ")) (setq ent (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 1 result) (cons 7 (getvar 'textstyle)) (cons 10 Pt1) ;point of insertion (cons 40 0.08)))) (setq Pt2 (acet-ss-drag-move (ssadd ent) Pt1 "\nSpecify Second Point: " t 0)) (not (vla-move (vlax-ename->vla-object ent) (vlax-3D-point Pt1) (vlax-3D-point Pt2))) (setq Rot (acet-ss-drag-rotate (ssadd ent) Pt2 "Specify angle: " T 0)) (vla-put-rotation (vlax-ename->vla-object ent) Rot)) Quote
sadhu Posted March 15, 2010 Author Posted March 15, 2010 Doesn't seem to work when I add the layer option. [color=Red](setq lay "MEASURE Layer" )[/color] (and (setq Pt1 (getpoint "\nPunto di inserimento misura / Specify Text placement point: ")) (setq ent (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") [color=Red] (cons 8 lay)[/color] (cons 1 result) (cons 7 (getvar 'textstyle)) (cons 10 Pt1) ;point of insertion (cons 40 0.08)))) (setq Pt2 (acet-ss-drag-move (ssadd ent) Pt1 "\nSpecify Second Point: " t 0)) (not (vla-move (vlax-ename->vla-object ent) (vlax-3D-point Pt1) (vlax-3D-point Pt2))) (setq Rot (acet-ss-drag-rotate (ssadd ent) Pt2 "Specify angle: " T 0)) (vla-put-rotation (vlax-ename->vla-object ent) Rot)) Quote
sadhu Posted March 15, 2010 Author Posted March 15, 2010 Sorry for that fast post. It really works with the layer option too. Quote
alanjt Posted March 15, 2010 Posted March 15, 2010 Just tried it. Works great. Thanks Alan. Do I have the "quote the code" every time I post a reply - like below ? You're welcome and no, you don't have to post the same in a reply. 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.