×
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

entities nested in polylines

entities nested in polylines

entities nested in polylines

(OP)
Using VBA how would I be able to select all polylines in modelspace and "filter through" them leaving only those with a vertex from another polyline left on the screen.  Any help would be greatly appriciated.

RE: entities nested in polylines

Well, if you know VBA enough. Create a filtered selection set of Polylines in model space. Then you will need to obtain the dimension for the visible screen. This has to be calculated and you will need to grab the center of the Window (VIEWCTR) and the Window width (VIEWSIZE). Then cycle through the vertices of the polylines and pull the ones meeting your criteria. Is this too general or were you looking for code snippets?

"Everybody is ignorant, only on different subjects." — Will Rogers

RE: entities nested in polylines

(OP)
I was actually looking for code snippets because there are a lot of polylines which I need to filter through and also my knowlegde of VBA is not the greatest.  I only know enough to get into trouble.  I'm not sure if I understand exactly the approach that you have mentioned I will have to evaluate that.  If you have any lines of code I would greatly appriciate it as a way to start with this problem.  Thank you.

RE: entities nested in polylines

This should get you started...


Dim acSelSet As AcadSelectionSet
Dim acItem As AcadLWPolyline
Dim vntAcItems As Variant
Dim intCode() As Integer
Dim vntValue() As Variant
Dim vntVerts As Variant
Dim lCnt As Long
'--------------------------------------
ReDim intCode(3): ReDim vntValue(3)
intCode(0) = -4:  vntValue(0) = "<AND"
intCode(1) = 0:   vntValue(1) = "LWPOLYLINE"    'OBJECT TYPE
intCode(2) = 67:  vntValue(2) = 0               'MODELSPACE
intCode(3) = -4:  vntValue(3) = "AND>"

Set acSelSet = ThisDrawing.SelectionSets.Add("PLINESSET")

acSelSet.Select acSelectionSetAll, , , intCode, vntValue
For Each acItem In acSelSet
    '--------------------------------------------------------------------------
    'Get vertice list
    '--------------------------------------------------------------------------
    vntVerts = acItem.Coordinates
    For lCnt = 0 To UBound(vntVerts)
        'Figure out your vertice calcs here
        MsgBox vntVerts(lCnt)
    Next lCnt
Next acItem

"Everybody is ignorant, only on different subjects." — Will Rogers

RE: entities nested in polylines

(OP)
so where do i head from this point.  I threw that code in a simple sub and I am not sure what the result it is returning it seems like it is just returning the lenghths of the segments in the polyline.

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