### creating a ucs with 3 points (not with vectors)

#2175 by thomasullmann
Thu Aug 28, 2014 4:41 pm
hallo, once more a Little Problem

i have a drawing with a lot of definied 3d-points. Is it possible to Change
the actual ucs just by using 3 even definied Points?

Sub set_usc_by_points()

Dim KoordListe As UserCoordSystems
Dim NeuKorSys As UserCoordSystem
Dim origin, x_axis, xy_axis as Point

Set MyDok = Application.ActiveDocument
Set KoordListe = MyDok.UserCoordinateSystems

Set origin = Library.CreatePoint(10, 20, 30)
Set x_axis = Library.CreatePoint(100, 20, 30)
Set xy_axis = Library.CreatePoint(10, 20, 100)

### the following doesnt work for shore
Set NeuKorSys = KoordListe.Add(origin, x_axis, xy_axis, "TEMP")
###
ActiveDocument.ActiveUCS = NeuKorSys
End Sub

if this is not possilbe, is there a easy way to get the vectors by using
the 3 definied Points.

Tue Sep 02, 2014 2:42 pm
Dear thomasullmann,

We believe this is a bug. The issue has been forwarded to our developers but we cannot give any ETA at this time for a fix.

Thank you for bringing this to our attention!

Regards,
#2182 by jouni
Fri Oct 03, 2014 11:50 am
Try this example:

Sub Example_GetUCSMatrix()

' This example creates a new UCS and lists its X, Y, and Z Vectors.

' Define a new UCS and turn on the UCS icon at the origin.

Dim origin As Point

Dim xAxisVector As Vector

Dim yAxisVector As Vector

Dim UCSName As String

Set origin = Library.CreatePoint(0, 0, 0)

Set xAxisVector = Library.CreateVector(0, 0, 0, 1, 1, 0)

Set yAxisVector = Library.CreateVector(0, 2, 0, 1, 1, 0)

UCSName = InputBox("Type a name for the user coordinate system:")

Set ucsObj = ThisDocument.UserCoordinateSystems.Add(origin, xAxisVector, yAxisVector, UCSName)

MsgBox "XVector.x = " & ucsObj.Xvector.x & Chr(13) & "XVector.y = " & ucsObj.Xvector.y & Chr(13) & "XVector.z = " & ucsObj.Xvector.z

MsgBox "YVector.x = " & ucsObj.Yvector.x & Chr(13) & "YVector.y = " & ucsObj.Yvector.y & Chr(13) & "XVector.z = " & ucsObj.Yvector.z

MsgBox "ZVector.x = " & ucsObj.Zvector.x & Chr(13) & "ZVector.y = " & ucsObj.Zvector.y & Chr(13) & "ZVector.z = " & ucsObj.Zvector.z

End Sub

It worked with my Progacad 2010.