.NET

## .NET

Distinguished Contributor
Posts: 116
Registered: ‎02-26-2009
Message 1 of 4 (133 Views)

# Moving a Circle Z direction along the Current UCS

133 Views, 3 Replies
09-12-2013 04:54 PM

I have a circle that I would like to move ‘Z’ direction along the Current UCS. The Current UCS can be in any 3d plane.

The code that I have only moves the circle 5 units up along the WCS.

```                Dim Zp As New Vector3d(0, 0, 5)
Zp.TransformBy(ed.CurrentUserCoordinateSystem)
myCircle.TransformBy(Matrix3d.Displacement(Zp))```

-J

*Expert Elite*
Posts: 2,078
Registered: ‎04-29-2006
Message 2 of 4 (112 Views)

# Re : Moving a Circle Z direction along the Current UCS

09-13-2013 02:39 AM in reply to: junoj

Hi,

The Vector3d.transformBy() method is a Function (in VB). It returns a new Vector3d object (this is due to the fact Vectors (as Points) are immutable structures).

In your code you do not get the transformed vector and Zp remains (0, 0, 5).

Try:

```Dim wcsZp As New Vector3d(0, 0, 5)
Dim ucsZp = wcsZp.TransformBy(ed.CurrentUserCoordinateSystem)
myCircle.TransformBy(Matrix3d.Displacement(ucsZp))```

or simply:

```Dim Zp As New Vector3d(0, 0, 5)
Zp = Zp.TransformBy(ed.CurrentUserCoordinateSystem)
myCircle.TransformBy(Matrix3d.Displacement(Zp))```

Gilles Chanteau
Distinguished Contributor
Posts: 116
Registered: ‎02-26-2009
Message 3 of 4 (96 Views)

# Re: Moving a Circle Z direction along the Current UCS

09-13-2013 09:41 AM in reply to: junoj

Thank you very much Gilles.

I am surprised that I did not get an error or warning in VS for : Zp.TransformBy(ed.CurrentUserCoordinateSystem)

*Expert Elite*
Posts: 2,078
Registered: ‎04-29-2006
Message 4 of 4 (91 Views)

# Re: Moving a Circle Z direction along the Current UCS

09-13-2013 10:11 AM in reply to: junoj

VS won't display any warning for this kind of unused function returned value with mostly imperative language as VB or C#.

It's the same thing when you use BlockTableRecord.AppendEntity() method which returns an ObjectId and you don't care about it.

`ObjectId id = btr.AppendEntity(ent);`

or:

`btr.AppendEntity(ent);`

With F# which encourages functional programming VS displays a warning if you don't bind the returned value to a symbol. In this case you have to use the 'ignore' keyword.

With AppendEntity

`let id = btr.AppendEntity(ent)`

or:

`btr.AppendEntity(ent) |> ignore`

Gilles Chanteau

### You are not logged in.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.