SetXdata Problem with getentity objec

Discussion in 'AutoCAD' started by lindsay, Sep 22, 2004.

  1. lindsay

    lindsay Guest

    "Runtime error:2145320939(80210015)"
    invalid argument type in setxdata method gives that error.
    our code shown below:
    ThisDrawing.Utility.GetEntity anEntity, pp, "Select an entity:"
    anEntity.GetXData "", xtipi, xd
    If Err = 0 Then
    startPt = anEntity.StartPoint
    endPt = anEntity.EndPoint

    DataType(0) = 1001: data(0) = "stringvalue"
    DataType(1) = 1000: data(1) = "anotherstringvalue"
    DataType(2) = 1070: data(2) = integervalue
    DataType(3) = 1010: data(3) = startPt
    DataType(4) = 1011: data(4) = endPt

    anEntity.SetXData DataType, data
    I explain what I want to do.I want to select any obj on the screen and change the xdata with vba macros.But when the compile that code,I got that errors.
    How can fixed the problem.
    Any suggestion appreciated.
     
    lindsay, Sep 22, 2004
    #1
  2. lindsay

    lorier Guest

    Hope this helps...

    Dim anEntity As AcadEntity
    Dim xtipi As Variant
    Dim xd As Variant
    Dim datatype(0 To 4) As Integer
    Dim data(0 To 4) As Variant

    Sub test()

    ThisDrawing.Utility.GetEntity anEntity, pp, "Select an entity:"
    anEntity.GetXData "", xtipi, xd
    If Err = 0 Then
    startPt = anEntity.StartPoint
    endPt = anEntity.EndPoint

    datatype(0) = 1001: data(0) = "stringvalue"
    datatype(1) = 1000: data(1) = "anotherstringvalue"
    datatype(2) = 1070: data(2) = integervalue
    datatype(3) = 1010: data(3) = startPt
    datatype(4) = 1011: data(4) = endPt

    anEntity.SetXData datatype, data
    End If
    anEntity.GetXData "", xtipi, xd
    MsgBox xd(1)

    End Sub
     
    lorier, Sep 22, 2004
    #2
  3. lindsay

    lindsay Guest

    thank you lorier, the result is success.
     
    lindsay, Sep 23, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.