CADTutor: The best free help for AutoCAD on the web

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Go Back   AutoCAD Forums > AutoCAD > AutoLISP, VBA, the CUI & Customisation

Reply
 
Thread Tools
Old 1st Nov 2009, 06:59 pm   #1
Randolph
Full Member
 
Using: AutoCAD 2009
 
Join Date: Sep 2009
Posts: 86
Default Move objects to match x (y,z) -coordinate of another point

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.

Code:
 
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 ... ?
Randolph is offline   Reply With Quote
Old 1st Nov 2009, 07:40 pm   #2
alanjt
Super Member
 
alanjt's Avatar
 
Using: Civil 3D 2009
 
Join Date: Apr 2008
Posts: 1,488
Default

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.

Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...
its pretty funny seeing two AutoCAD Gods give each other flak...
alanjt is offline   Reply With Quote
Old 1st Nov 2009, 07:53 pm   #3
alanjt
Super Member
 
alanjt's Avatar
 
Using: Civil 3D 2009
 
Join Date: Apr 2008
Posts: 1,488
Default

Is this what you are shooting for?
MXY.gif

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.
Code:
(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

Last edited by alanjt : 2nd Nov 2009 at 12:03 am.

Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...
its pretty funny seeing two AutoCAD Gods give each other flak...
alanjt is offline   Reply With Quote
Old 1st Nov 2009, 08:01 pm   #4
Randolph
Full Member
 
Using: AutoCAD 2009
 
Join Date: Sep 2009
Posts: 86
Default

Edit: Bad example.

Last edited by Randolph : 1st Nov 2009 at 08:12 pm.
Randolph is offline   Reply With Quote
Old 1st Nov 2009, 08:06 pm   #5
Randolph
Full Member
 
Using: AutoCAD 2009
 
Join Date: Sep 2009
Posts: 86
Default

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.

Last edited by Randolph : 1st Nov 2009 at 08:18 pm.
Randolph is offline   Reply With Quote
Old 1st Nov 2009, 09:02 pm   #6
alanjt
Super Member
 
alanjt's Avatar
 
Using: Civil 3D 2009
 
Join Date: Apr 2008
Posts: 1,488
Default

Quote:
Originally Posted by Randolph View Post
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?

Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...
its pretty funny seeing two AutoCAD Gods give each other flak...
alanjt is offline   Reply With Quote
Old 1st Nov 2009, 09:11 pm   #7
Randolph
Full Member
 
Using: AutoCAD 2009
 
Join Date: Sep 2009
Posts: 86
Default

Mostly 3D Solids, but also 2D objects. Multiple would be better, as the "table" might consist of several solids.
Randolph is offline   Reply With Quote
Old 1st Nov 2009, 09:30 pm   #8
alanjt
Super Member
 
alanjt's Avatar
 
Using: Civil 3D 2009
 
Join Date: Apr 2008
Posts: 1,488
Default

So it's no different than selecting an object, picking a point, using .XY filter, then picking another point to get the Z value?

Code:
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

Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...
its pretty funny seeing two AutoCAD Gods give each other flak...
alanjt is offline   Reply With Quote
Old 1st Nov 2009, 09:41 pm   #9
alanjt
Super Member
 
alanjt's Avatar
 
Using: Civil 3D 2009
 
Join Date: Apr 2008
Posts: 1,488
Default

This?
TZP.gif

........

Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...
its pretty funny seeing two AutoCAD Gods give each other flak...
alanjt is offline   Reply With Quote
Old 1st Nov 2009, 10:24 pm   #10
Randolph
Full Member
 
Using: AutoCAD 2009
 
Join Date: Sep 2009
Posts: 86
Default

"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 is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
List coordinate by select point group jason tay AutoLISP, VBA, the CUI & Customisation 37 27th Apr 2009 12:36 am
How to retrive 3D coordinate information of any object from AutoCAD VBA Kshirsagar AutoLISP, VBA, the CUI & Customisation 3 11th Nov 2008 11:59 am
Block, Object/Match properties question. p1nkninja AutoCAD Beginners' Area 4 12th Oct 2008 03:22 am
PHOTO MATCH - how to start with single point perspective? Strix SketchUp 4 27th Aug 2007 11:35 pm
how to move origin point ? airs AutoCAD Beginners' Area 2 20th Nov 2006 12:52 am

Why Donate?


All times are GMT +1. The time now is 11:29 am.

RSS Feed for AutoCAD ForumsValid XHTML 1.0!Valid CSS!Creative Commons Licence