×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Determining weather an object is within another object using a VBA scr

Determining weather an object is within another object using a VBA scr

Determining weather an object is within another object using a VBA scr

(OP)
I wish to determine if a circle, arc or line is contained within a polyline using VBA procedure. I have investigated the intersect command but this only works for 3D objects, my objects will be 2d objects.

Any ideas?

Thanks,
Eric

RE: Determining weather an object is within another object using a VBA scr

'ANALYZING A POLYLINE FOR ARCS AND LINES
'
'www.homescript.com
'
'Improvised in one hour exclusively for Mr. FlyCast
'Polyline: this method will fail if the polyline Type property is not acSimplePoly.
'The bulge is the tangent of 1/4 of the included angle for the arc
'between the selected vertex and the next vertex in the polyline’s vertex list.
'A negative bulge value indicates that the arc goes clockwise
'from the selected vertex to the next vertex.
'A bulge of 0 indicates a straight segment, and a bulge of 1 is a semicircle.

Sub AnalysePoly()
 ' Begin the selection
    Dim returnObj As AcadObject
    Dim basePnt As Variant
    Dim OldColor As Variant
    On Error Resume Next
    ' The following example waits for a selection from the user
RETRY:
    ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
    If Err <> 0 Then
        Err.Clear
        MsgBox "Good Bye.", , "GetEntity Example"
        Exit Sub
    Else
        OldColor = returnObj.Color
        returnObj.Color = acRed
        returnObj.Update
        
        If returnObj.EntityName = "AcDbPolyline" Then
        msgy = returnObj.EntityName & vbCrLf
        Dim retCoord As Variant
        retCoord = returnObj.Coordinates
        
        For i = LBound(retCoord) To UBound(retCoord)
        'Debug.Print retCoord(i)
        Next
        
        verticio = i / 3
        
        For j = 1 To verticio
        If returnObj.GetBulge(j) = 0 Then
            typo = " Line"
            Else
            typo = " Arc"
        End If
        msgy = msgy & vbCrLf & "bulge " & j & " = " & returnObj.GetBulge(j) & typo
        Debug.Print "bulge " & j & " = " & returnObj.GetBulge(j) & typo
        Next
      
        Debug.Print "coordinates " & i
        Debug.Print "Vertices " & i / 3
        returnObj.Color = OldColor
        returnObj.Update
        Else
        msgy = "No PolyLine!Object is " & returnObj.EntityName
        End If
        MsgBox msgy, , "www.homescript.com";
     End If
    GoTo RETRY
End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources