[Tutor] How to create array of variants?
Krasyn
mndrk at mail.ru
Thu Sep 11 20:38:31 CEST 2008
Kelie-2 wrote:
>
> Hello group,
>
> I'm trying to translate the following VB code into Python and not sure how
> to
> create an array of variants.
>
> Thanks for your help!
>
> VB Code:
> Sub SetXdata()
> Dim lineObj As AcadLine
> Set lineObj = ThisDrawing.ModelSpace.Item(0)
>
> Dim DataType(0 To 1) As Integer
> Dim Data(0 To 1) As Variant
>
> DataType(0) = 1001: Data(0) = "Test_Application"
> DataType(1) = 1070: Data(1) = 600
>
> lineObj.SetXdata DataType, Data
> End Sub
>
> Python code
> import array
> import comtypes.client
>
> def SetXData():
> activedoc =
> comtypes.client.GetActiveObject("AutoCAD.Application").ActiveDocument
> line = activedoc.ModelSpace.Item(0)
>
> dataType = array.array('i', [1001, 1070])
> dataValue = array.array('?', ['Test_Application', 600]) #What should I
> use
> for the type code?
>
> line.SetXData(dataType, dataValue)
>
> if __name__ == "__main__":
> SetXData()
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
dataType = array("h",[1001,1070])
dataValue = VARIANT(['Test_Application', 600])
--
View this message in context: http://www.nabble.com/How-to-create-array-of-variants--tp18331322p19441514.html
Sent from the Python - tutor mailing list archive at Nabble.com.
More information about the Tutor
mailing list