.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Selection set corners

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
238 Views, 2 Replies

Selection set corners

Good morning everyone,
I have a problem, basically I have a selection set
of objects’, and I am trying to find the corners
of the selection. Could anyone give me some
pointers in how to do this, I have tried in vain
but my in-experience is letting me down.

Regards,

Martin Quigley
2 REPLIES 2
Message 2 of 3
jerrywinters
in reply to: Anonymous

Here's one way to do it. The Function GetSSExtents is passed a SelectionSet and returns an Extents3d.
{code}
_
Public Sub SSCorners() ' As Entity
Dim myEd As Editor = DocumentManager.MdiActiveDocument.Editor
Dim myPSR As PromptSelectionResult = myEd.GetSelection()
Dim myExtents As Extents3d = GetSSExtents(myPSR.Value)
MsgBox("Extents are: " & myExtents.ToString)
End Sub

Function GetSSExtents(ByVal SelectionSetIn As SelectionSet) As Extents3d
Dim myExtents As New Extents3d
If SelectionSetIn.Count = 0 Then Return myExtents
Dim myDB As Database = SelectionSetIn(0).ObjectId.Database
Using myTrans As Transaction = myDB.TransactionManager.StartTransaction
For Each myOID As ObjectId In SelectionSetIn.GetObjectIds
Dim myEnt As Entity = myOID.GetObject(OpenMode.ForRead)
myExtents.AddExtents(myEnt.GeometricExtents)
Next
End Using
Return myExtents
End Function
{code}
Jerry
Message 3 of 3
Anonymous
in reply to: Anonymous

Hi Jerry,
thanks loads for your timely response, it
works a treat. Also, thanks for your ace
book, it's what I have been using to learn
VB.net in CAD.. 😉

Regards,

Martin.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report