'Inherits GripOverrule
'From AutoCAD2012NewAPIsSamples
<CommandMethod("GripEx")>
Public Sub GripExample()
Dim doc As Document = Core.Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = doc.Editor
Dim db As Database = doc.Database
Dim dist As Double = Core.Application.GetSystemVariable("USERR3")
Dim tv(0) As TypedValue
tv.SetValue(New TypedValue(DxfCode.Start, "AECC_STRUCTURE_PROFILE_LABEL"), 0)
Dim MyFilter As New SelectionFilter(tv)
Dim Mygrips As Point3dCollection
Dim Mysnaps As IntegerCollection
Dim MygeomIds As IntegerCollection
Try
' Prompt the user to select the first label.
Dim STRLabelRes As PromptEntityResult = ed.GetEntity("Select the first surface label: " & vbCrLf)
If STRLabelRes.Status <> PromptStatus.OK Then
Return
End If
Dim STRLabelId As ObjectId = STRLabelRes.ObjectId
Using tr As Transaction = db.TransactionManager.StartTransaction()
Dim STRLabel As Autodesk.Civil.DatabaseServices.StructureProfileLabel = tr.GetObject(STRLabelId, OpenMode.ForWrite)
' Initialize the collections
Mygrips = New Point3dCollection()
Mysnaps = New IntegerCollection()
MygeomIds = New IntegerCollection()
MyBase.GetGripPoints(STRLabel, Mygrips, Mysnaps, MygeomIds)
MyBase.MoveGripPointsAt(STRLabel, Mysnaps, New Vector3d(4, 4, 4))
tr.Commit()
End Using
Catch
End Try
End Sub