.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

vb.net COM late binding setting ActiveUSC gives an error

1 REPLY 1
Reply
Message 1 of 2
pderuiter77
681 Views, 1 Reply

vb.net COM late binding setting ActiveUSC gives an error

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

 

1 REPLY 1
Message 2 of 2
Balaji_Ram
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost