View Full Version : Move objects to match x (y,z) -coordinate of another point
Randolph
1st Nov 2009, 06:59 pm
I'm also looking for a procedure to move an object parallel to an axis and match a start point with the x,y, or z-coordinate af another point while keeping the other coordinates.
defun c: txp (translate in x-direction to a certain point), typ, tzp
select objects
select point 1 (x1,y1,z1)
select point 2 (x2)
move objects (x1,y1,z1) (x2,y1,z1)
Alan ... please ... o:)?
alanjt
1st Nov 2009, 07:40 pm
LoL
I'm not sure I understand what you are asking. Sounds like something that can be solved with point filters. Shouldn't be too terribly difficult. I don't mind helping, but I'm not sure I understand what you want.
alanjt
1st Nov 2009, 07:53 pm
Is this what you are shooting for?
15222
You could also achieve this by turning orthomode on.
Might as well post this. I know it's not what you were looking for, but someone might want it.
(defun c:MXY (/ #SS #Pnt #Choice)
(and (setq #SS (ssget "_:L"))
(setq #Pnt (getpoint "\nSpecity base point: "))
(not (initget 0 "X Y"))
(setq #Choice (getkword "\nAxis filter [X/Y]: "))
(command "_.move" #SS "" "_non" #Pnt (strcat "." #Choice) "_non" #Pnt)
) ;_ and
(princ)
) ;_ defun
Randolph
1st Nov 2009, 08:01 pm
Edit: Bad example.
Randolph
1st Nov 2009, 08:06 pm
OK, a better example. And a real one.
In top view, I've positioned a table in my house model.
As I change to ISO-view, I find that the table hovers somewhere above the floor.
No I would like to enter "tzp", click on any foot of a table leg and then on any corner of the floor.
The table would drop to the floor without changing its position in the ground plan.
I hope that does it. I admit that above descriptions were a bit weird. Thanks for your understanding.
alanjt
1st Nov 2009, 09:02 pm
OK, a better example. And a real one.
In top view, I've positioned a table in my house model.
As I change to ISO-view, I find that the table hovers somewhere above the floor.
No I would like to enter "tzp", click on any foot of a table leg and then on any corner of the floor.
The table would drop to the floor without changing its position in the ground plan.
I hope that does it. I admit that above descriptions were a bit weird. Thanks for your understanding.
1. Will it always be a block?
2. Single or multiple objects?
Randolph
1st Nov 2009, 09:11 pm
Mostly 3D Solids, but also 2D objects. Multiple would be better, as the "table" might consist of several solids.
alanjt
1st Nov 2009, 09:30 pm
So it's no different than selecting an object, picking a point, using .XY filter, then picking another point to get the Z value?
Command: m
MOVE
Select objects: Specify opposite corner: 1 found
Select objects:
Specify base point or [Displacement] <Displacement>: _endp of Specify second
point or <use first point as displacement>: .XY of _endp of (need Z): _endp of
alanjt
1st Nov 2009, 09:41 pm
This?
15223
........
Randolph
1st Nov 2009, 10:24 pm
"So it's no different than selecting an object, picking a point, using .XY filter, then picking another point to get the Z value?"
Yeah, you got it, but in 1 command and also for the other axis (txp, typ, tzp). As I wrote in the first posting:
move objects from point (x1,y1,z1) to point (x1, y1, z2).
It's no more complicated.
Randolph
1st Nov 2009, 10:25 pm
By the way - what does this mean:
"Seann: ...it went crazy ex-girlfriend on me..."
alanjt
1st Nov 2009, 10:43 pm
By the way - what does this mean:
"Seann: ...it went crazy ex-girlfriend on me..."
It was part of some explanation Seann wrote out for a problem he was having. I could not stop laughing at his metaphor.
OK, how about this?
15226
(defun c:TZP (/ #SS #Pnt1 #Pnt2 #New)
(cond
((and (setq #SS (ssget "_:L"))
(setq #Pnt1 (getpoint "\nSpecify base point: "))
(setq #Pnt2 (getpoint "\nSpecify point for new Z value: "))
) ;_ and
(setq #New (vlax-3D-point (list (car #Pnt1) (cadr #Pnt1) (caddr #Pnt2)))
#Pnt1 (vlax-3D-point (list (car #Pnt1) (cadr #Pnt1) 0))
) ;_ setq
(vlax-for x (setq
#SS (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))
) ;_ setq
(vla-move x #Pnt1 #New)
) ;_ vlax-for
(vl-catch-all-apply 'vla-delete (list #SS))
)
) ;_ cond
(princ)
) ;_ defun
Dirty command version:
(defun c:TZP (/ #SS #Pnt1 #Pnt2)
(and (setq #SS (ssget "_:L"))
(setq #Pnt1 (getpoint "\nSpecify base point: "))
(setq #Pnt2 (getpoint "\nSpecify point for Z value: "))
(command "_.move" #SS "" "_non" #Pnt1 ".Z" "_non" #Pnt2 "_non" #Pnt1)
) ;_ and
(princ)
) ;_ defun
Randolph
1st Nov 2009, 10:58 pm
Yes, it's as perfect as it already was before, with the difference that you use the command tzp now. Might I see the code?
alanjt
1st Nov 2009, 11:12 pm
Yes, it's as perfect as it already was before, with the difference that you use the command tzp now. Might I see the code?
Whoops, might help. ;)
Something isn't quite right though.
alanjt
2nd Nov 2009, 12:06 am
I went ahead and posted the original attempt, even thought it was WAAAY off.
http://www.cadtutor.net/forum/showpost.php?p=280023&postcount=3
alanjt
2nd Nov 2009, 12:59 am
So......did it work?
Randolph
11th Nov 2009, 06:17 pm
Yes, it works fine.
I just messed up my "Lisp to unload cui" functionality and overwrote my safety copy - what the hell --- must look for the thread ...
Powered by vBulletin™ Version 4.1.2 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.