Rotate UCS by picking an object

Rotate UCS by picking an object

darkfprh
Advocate Advocate
1,276 Views
6 Replies
Message 1 of 7

Rotate UCS by picking an object

darkfprh
Advocate
Advocate

Hi I need a lisp for rotate UCS.

 

-> http://www.lee-mac.com/cursorrotate.html

 

this lisp is almost same what I want.

But it has unnecessary functions and rotate byt snapang not UCS.

 

1. Pick an Obejct (line, pline or even block by nentsel)

 

2. Rotate USC (not snapang)

 

Please help me.

0 Likes
Accepted solutions (1)
1,277 Views
6 Replies
Replies (6)
Message 2 of 7

ВeekeeCZ
Consultant
Consultant

(Command "_.ucs" "_ob")

?

0 Likes
Message 3 of 7

darkfprh
Advocate
Advocate

Yes It is. But not absolutely.

 

It doesn't work with block.

I want entity's rotate angle, not block's. (not ensel, nentsel)

0 Likes
Message 4 of 7

ВeekeeCZ
Consultant
Consultant
Accepted solution

Then try this one.

 

(defun c:Ucso ( / p)
  (if (setq p (cadr (entsel "\nSelect object: ")))
    (command "_.ucs" "_z" "_non" (osnap p "_end") "_non" (osnap p "_mid")))
  (princ)
  )
0 Likes
Message 5 of 7

Kent1Cooper
Consultant
Consultant

@ВeekeeCZ 's approach is what I would have suggested if I'd gotten in first.  Three refinement questions:

 

Would you ever want to align it with something that doesn't have end- or mid-points, such as Text/Mtext?

 

Would you want the new UCS origin to be on the selected object [or nested object], or only its rotation aligned with it, keeping the current origin?

 

Might there ever be other things close enough to where you pick that Osnap END or MID might "see" something else?  [That can be prevented by temporarily setting the APERTURE System Variable equal to the PICKBOX System Variable, so that if the pick location is unambiguous about which object you want, Osnap will apply itself only to that object.]

Kent Cooper, AIA
0 Likes
Message 6 of 7

darkfprh
Advocate
Advocate

Thank you very much. Perfect!

 

I studied a lot. I've never seen like this code " _non" (osnap p "_end") ". Thank you!

0 Likes
Message 7 of 7

darkfprh
Advocate
Advocate

Ummmm.... I don't speak English well.

 

So I use the google translate and I understand a little bit.

 

1. text / mtext

  - Yes I want it too!

 

2. keep origin

  - Yes! I want 0,0 point.

 

3. ?

  - I didn't quite understand. I want rectangle Pick point like entsel.

0 Likes