# Script "\_Dir" Command in Rhino5

**URL:** <https://discourse.mcneel.com/t/script--dir-command-in-rhino5/12832>\
**Category:** Rhino Developer\
**Created:** [October 29, 2014, 12:58pm UTC](https://discourse.mcneel.com/t/script--dir-command-in-rhino5/12832 "2014-10-29T12:58:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julienp](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@Julienp](https://discourse.mcneel.com/u/Julienp)\
**Post date:** [October 29, 2014, 12:58pm UTC](https://discourse.mcneel.com/t/script--dir-command-in-rhino5/12832/1 "2014-10-29T12:58:37Z")

</div>

Hi there,

I have successfully written a script in Rhino4 that contains the following line:  
Call Rhino.Command("\_Dir F S \_Enter")  
It flips the directions on a surface and then swap them. This works nicely.

For some reason, this command does not behave in the same way in Rhino5: the S command does not swap the direction but it turns on the grid snap on.

What should be the statement to swap the uv coordinates in Rhino5??

Thank you

---

<div class="post-metadata">

**Author:** ![jordy1989](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jordy1989/32/282567_2.png) [@jordy1989](https://discourse.mcneel.com/u/jordy1989)\
**Post date:** [October 29, 2014, 1:14pm UTC](https://discourse.mcneel.com/t/script--dir-command-in-rhino5/12832/2 "2014-10-29T13:14:25Z")

</div>

I think it should be:

Call Rhino.Command("\_Dir \_F \_Enter")

This will already flip the dir.

---

<div class="post-metadata">

**Author:** ![0netech](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/0netech/32/384385_2.png) [@0netech](https://discourse.mcneel.com/u/0netech)\
**Post date:** [October 29, 2014, 1:33pm UTC](https://discourse.mcneel.com/t/script--dir-command-in-rhino5/12832/3 "2014-10-29T13:33:13Z")

</div>

Call Rhino.Command("\_Dir \_SwapUV \_Flip \_Enter")

---

<div class="post-metadata">

**Author:** ![Julienp](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@Julienp](https://discourse.mcneel.com/u/Julienp)\
**Post date:** [October 29, 2014, 4:47pm UTC](https://discourse.mcneel.com/t/script--dir-command-in-rhino5/12832/4 "2014-10-29T16:47:40Z")

</div>

If use:  
_Call Rhino.Command("\_Dir \_SwapUV \_Flip \_Enter")_  
I have the following statement:  
_Unknown command: \_SwapUV_

---

<div class="post-metadata">

**Author:** ![0netech](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/0netech/32/384385_2.png) [@0netech](https://discourse.mcneel.com/u/0netech)\
**Post date:** [October 29, 2014, 5:47pm UTC](https://discourse.mcneel.com/t/script--dir-command-in-rhino5/12832/5 "2014-10-29T17:47:52Z")

</div>

That’s odd. Do you have this option on command line?

---

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/772979_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [October 29, 2014, 11:14pm UTC](https://discourse.mcneel.com/t/script--dir-command-in-rhino5/12832/6 "2014-10-29T23:14:58Z")

</div>

> [@Julienp](#):
>
> I have the following statement:Unknown command: \_SwapUV

This happens if you start your macro but have no surface(s) preselected. The \_SwapUV command line option is only available inside the \_Dir command. To avoid that, you can use \_Pause after \_Dir, so rhino waits for selection and then starts over if you have something selected and ended your selection with Enter (or right mouse button).

```
_Dir _Pause _SwapUV _Flip _Enter

```

It still works in one shot if you have one or more surface(s) preselected.

- 

c.

---

<div class="post-metadata">

**Author:** ![Julienp](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@Julienp](https://discourse.mcneel.com/u/Julienp)\
**Post date:** [October 30, 2014, 12:10pm UTC](https://discourse.mcneel.com/t/script--dir-command-in-rhino5/12832/7 "2014-10-30T12:10:09Z")

</div>

I found my problem: in my selection I had a point and the surface selected. I had to make sure I select the surface only:

```
		Rhino.Command "_-SelNone", 0 '
		Call Rhino.ObjectName(obj, SurfaceName)
		Call Rhino.SelectObject(obj)
		Call Rhino.Command("_Dir F S _Enter")

```

This works fine.

Thanks for your help.
