Type mismatch problem, please help

Discussion in 'AutoCAD' started by Jim, Apr 28, 2005.

  1. Jim

    Jim Guest

    Could someone please take a look at this code exerpt and tell why I am
    getting a Compile error: 'can't assign to array' with LoopStartPt
    highlighted? Thanks.


    'Globals for this module
    Dim tubeSeed As AcadEntity
    Dim LoopStartPt(0 To 1) As Double

    Public Sub StPoint()

    LoopStartPt = tStartPt(tubeSeed)

    End Sub


    Public Function tStartPt(tubeSeg As AcadEntity) As Double()
    Dim Pt As Variant
    Dim rtnPt(0 To 1) As Double

    Dim Index As Integer

    Select Case tubeSeg.ObjectName

    Case Is = "AcDbPolyline"
    Pt = tubeSeg.Coordinates
    If IsArray(Pt) Then
    rtnPt(0) = Pt(0)
    rtnPt(1) = Pt(1)
    End If

    Case Is = "AcDbLine"
    Pt = tubeSeg.StartPoint
    rtnPt(0) = Pt(0)
    rtnPt(1) = Pt(1)

    Case Is = "AcDbArc"
    Pt = acEntity.StartPoint
    rtnPt(0) = Pt(0)
    rtnPt(1) = Pt(1)

    End Select
    tStartPt = rtnPt

    End Function
     
    Jim, Apr 28, 2005
    #1
  2. Jim

    Wyatt Earp Guest

    LoopStartPt = tStartPt(tubeSeed)

    tStartPt returns a double
    LoopStartPt is an array
    tStartPt either needs to return an array, or LoopStartPt needs an
    indexer.
     
    Wyatt Earp, May 8, 2005
    #2
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.