.NET

Reply
Contributor
pderuiter77
Posts: 14
Registered: ‎01-09-2013
Message 1 of 2 (199 Views)

vb.net COM late binding setting ActiveUSC gives an error

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

 

ADN Support Specialist
Balaji_Ram
Posts: 667
Registered: ‎03-21-2011
Message 2 of 2 (149 Views)

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

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

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)

 



Balaji
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

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.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community