Message 1 of 7
Adding Points to Point Group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to add points to a point group. The problem that I am having is that creating a StandardPointGroupQuery will overwrite the point numbers already in the group. How do I just ADD to the existing point numbers.
I was thinking of getting all the point numbers and building that back into the new query but I am having no luck with that. Any help would be greatly appreciated.
Public Sub CogoPointNoDisplay() 'Get the current document and database Dim docEd As Editor = Active.Editor Dim curDb As Database = Active.Database Dim civDoc As CivilDocument = Active.CivilDocument Dim cmdloop As Boolean = True Try 'Start command loop Do While cmdloop 'Start selection options Dim acSSPrompt As New PromptEntityOptions(vbLf & "Select a COGO Point to set to _No Display: ") acSSPrompt.SetRejectMessage(vbLf & "Invalid Selection. Selected item is not a COGO point. Please select again." & vbLf) acSSPrompt.AddAllowedClass(GetType(CogoPoint), True) 'Set selection set Dim acSSet As PromptEntityResult = docEd.GetEntity(acSSPrompt) 'If selection is a cogo point If acSSet.Status <> PromptStatus.OK Then Return End If 'Start the transaction Using acTrans As Transaction = curDb.TransactionManager.StartTransaction() 'Set dbobject and open for write Dim acdbObj As Autodesk.AutoCAD.DatabaseServices.DBObject = acTrans.GetObject(acSSet.ObjectId, OpenMode.ForWrite) 'Set and cast point Dim acCogoPoint As CogoPoint = TryCast(acdbObj, CogoPoint) 'Get point number Dim acCogoPointNumber As String = acCogoPoint.PointNumber.ToString() 'Get _No Display point group Dim pointGroupId As ObjectId = civDoc.PointGroups.Item("_No Display") Dim pointGroup As PointGroup = TryCast(pointGroupId.GetObject(OpenMode.ForWrite), PointGroup) '----------------------------------------------------------------------------------------- Dim existPoints As String = pointGroup.GetPointNumbers.ToString() 'Set new query parameters Dim standardQuery As StandardPointGroupQuery = New StandardPointGroupQuery() standardQuery.IncludeNumbers = existPoints & ";" & acCogoPointNumber 'Set query pointGroup.SetQuery(standardQuery) 'Update point group pointGroup.Update() '----------------------------------------------------------------------------------------- 'Save the changes and dispose of the transaction acTrans.Commit() End Using Loop Catch ex As Exception 'Intentionally left out End Try docEd.Regen() End Sub