geting the segment of the selected Pline

Discussion in 'AutoCAD' started by juno, Apr 8, 2005.

  1. juno

    juno Guest

    Is their a way I can select a polyline and get it’s: selection point, the entity and the polyline segment that was selected (providing that the Pline has more then one segment?)

    Thank you in advance for the help,

    -J
     
    juno, Apr 8, 2005
    #1
  2. GetEntity method
     
    Paul Richardson, Apr 8, 2005
    #2
  3. GetEntity method
     
    Paul Richardson, Apr 8, 2005
    #3
  4. juno

    David Urban Guest

    J

    You will need to get the entity and then use the explode funtion to
    expolde the pline to an array of entities. This will not disturb the
    orginal entity. then cycle through the exploded enties and go through
    some logic of finding which entitiy you have selected.


    here is a code snipit that I did. I was looking for only the curves.
    this is in LDD so it may be alittle foreign to some. it is not complete
    code so don't try and run it on its own.

    Dim explodeOBJ As Variant, pLine As AcadLWPolyline
    pUtil.GetSubEntity Object, PickedPoint, TransMatrix, ContextData, vbCrLf
    & "Pick CURB return at the intersection: "
    If TypeName(Object) = "IAcadLWPolyline" Then
    Set pLine = Object
    Err.clear: On Error Resume Next
    explodeOBJ = pLine.Explode
    alg.StationOffset PickedPoint(0), PickedPoint(1), pstation,
    offset, pdirection
    On Error GoTo 0
    For i = 0 To UBound(explodeOBJ, 1)
    If TypeName(explodeOBJ(i)) = "IAcadArc" Then
    Set getcurve = explodeOBJ(i)
    Err.clear: On Error Resume Next
    alg.StationOffset getcurve.startPoint(0),
    getcurve.startPoint(1), Station, offset, direction
    alg.StationOffset getcurve.endPoint(0),
    getcurve.endPoint(1), station2, Offset2, Direction2

    If (pstation < Station And pstation > station2 Or
    pstation < station2 And pstation > Station) _
    And (poffset < offset And poffset > Offset2 Or poffset
    < Offset2 And poffset > offset) And Abs(offset - Offset2) < 75 Then
    found = True: Exit For
    End If
    End If
    Next i


    David Urban
     
    David Urban, Apr 8, 2005
    #4
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.