Posts: 14
Registered: ‎01-09-2013
Message 1 of 2 (210 Views)

vb.net COM late binding setting ActiveUSC gives an error

210 Views, 1 Replies
01-21-2013 12:28 AM

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")
                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


ADN Support Specialist
Posts: 700
Registered: ‎03-21-2011
Message 2 of 2 (160 Views)

Re: vb.net COM late binding setting ActiveUSC gives an error

01-31-2013 08:56 AM in reply to: pderuiter77



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)


Developer Technical Services
Autodesk Developer Network

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.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.