Jump to content

Recommended Posts

Posted

Does anyone know how to return the nr of vertices for a qleader? I need some VB code please.

Posted

I’m assuming you mean VB.NET, in which case the number of vertices is directly available as a property of the Leader.

NumOfVertices.jpg

Posted

No, this is an old VB6 application unfortunately. I see there is a GetVertexCount method, but I have no idea how to implement that (or if it is even relevant).

I have a selectionset of leaders, but get an error if I refer to a vertext that does not exist, so I need to know how many there are.

Posted

Ah, yes. In that case the COORDINATES property can provide the vert count, i.e.,

 

 

Sub LeaderPtCount()
Dim varPkPt As Variant
Dim ent As AcadEntity
Dim entlead As AcadLeader
Dim varCoords As Variant
Dim intNumOfVerts As Integer


ThisDrawing.Utility.GetEntity ent, varPkPt, "Select a Leader: "

If TypeOf ent Is AcadLeader Then
Set entlead = ent
varCoords = entlead.Coordinates
intNumOfVerts = (UBound(varCoords) + 1) / 3
MsgBox "The selected leader has " & intNumOfVerts & " vertices."
End If

End Sub

Posted

Thank you so much SEANT, it is working like a dream.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...