Community
I'm trying to set the ActiveUCS, but when i do i get an error
System.Runtime.InteropServices.COMException = {"Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))"}
Autocad 2012, VB.net, i use late binding. doc is of type IAcadDocument
Dim ucs As Object = Nothing Dim origin(2) As Double If (doc.GetVariable("UCSNAME") = String.Empty) Then 'No UCS found, make one Dim ucsorg As Object = doc.GetVariable("UCSORG") Dim ucsx As Object = doc.Utility.TranslateCoordinates(doc.GetVariable("UCSXDIR"), 1, 0, 0) Dim ucsy As Object = doc.Utility.TranslateCoordinates(doc.GetVariable("UCSYDIR"), 1, 0, 0) ucs = doc.UserCoordinateSystems.Add(ucsorg, ucsx, ucsy, "OriginalUCS") Else ucs = doc.ActiveUCS End If 'Set the origin origin(0) = point.X origin(1) = point.Y origin(2) = point.Z ucs.origin = origin doc.ActiveUCS = ucs
Hi,
You can try setting it this way :
Dim params() As Object = {ucs} doc.GetType().InvokeMember("ActiveUCS", Reflection.BindingFlags.SetProperty, Nothing, doc, params, Nothing, Nothing, Nothing)