Jump to content

Move objects to match x (y,z) -coordinate of another point


Randolph

Recommended Posts

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) ([b]x2[/b],y1,z1)

 

Alan ... please ... o:)?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

(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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

"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.

Link to comment
Share on other sites

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?

 

TZP-2.gif

 

 

(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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

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 ...

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...