Andrew MacIntyre <[EMAIL PROTECTED]> writes:

> from ctypes import c_long
> from comtypes import VARIANT   ### double check
>
> Hope this gets you closer...
>

Andrew, thanks a lot for your help. I think I'm getting closer. But not quite
there yet. The code below is what I tried and I got this error:
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: Cannot put
<__main__.tagVARIANT_Array_2 object at 0x00CE6580> in VARIANT

Btw, I also tried using c_long from ctypes for dataType and got a similar error:
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: Cannot put
<__main__.c_long_Array_2 object at 0x00CE5580> in VARIANT

Do the error message mean that a VARIANT_Array_2 object or c_long_Array_2 object
cannot be assigned to a VARIANT?

Thanks again.

import comtypes.client
from comtypes.automation import VARIANT

def SetXData():
    activedoc =
comtypes.client.GetActiveObject("AutoCAD.Application").ActiveDocument
    line = activedoc.ModelSpace.Item(0)

    dataType = (VARIANT * 2)()
    dataType[0].value = 1001
    dataType[1].value = 1070

    dataValue = (VARIANT * 2)()
    dataValue[0].value = 'Test_Application'
    dataValue[1].value = 600
    
    line.SetXData(dataType, dataValue)

if __name__ == "__main__":
    SetXData()
    print "Done." 



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to