I want to exclude certain figures from the figures selected in CAD graphic editing commands (e.g., MOVE)

Asked 2 years ago, Updated 2 years ago, 445 views

We are developing using VB.NET (.NET API) in IJCAD 2020.
We have implemented a process that excludes specific figures from the figures selected in the raw IJCAD command.

Specifically, within the function below (Replace Editor.PromptedForSelection), we have determined a particular figure from the selection set, obtained a new selection set excluding the particular figure, and set it in the Editor.

Below is a sample code.

Private SubEditor_PromptedForSelection (ByVal sender As Object, ByVale As PromptSelectionResultEventArgs)
    If Application.DocumentManager.MdiActiveDocumentIsNot Nothing Then
        'Dimed As Editor = DirectCast (sender, Editor)
        Dimed As Editor= Application.DocumentManager.MdiActiveDocument.Editor
        DimicdSSetNewAsSelectionSet=Nothing' New Selection Set (except certain figures)
        DimicdSSetOrg As SelectionSet=Nothing' Original Selection Set
        IcadSelSet_Clear(icdSSetOrg)
        Try
            'Retrieves selected figure from Editor class instance
            DimgcSSPrompt As PromptSelectionResult=ed.SelectImplied()
            If Not gcSSPrompt.Value Is Nothing Then
                icdSSetOrg=gcSSPrompt.Value
                DimsIdsNew As New ObjectIdCollection
                Using icdTransAsTransaction=icdDoc.Database.TransactionManager.StartTransaction
                    'Exclude target from selection set
                    For Each selobj As SelectedObject InicdSSetOrg
                        DimidEntAsEntity=IcadTrans_GetObject(icdTrans, selobj.ObjectId, OpenMode.ForRead)
                        IfidEnt Is Nothing Then Continue For
                        Try
                            If  Then Continue For
                            If NotesIdsNew.Contains(icdEnt.ObjectId) Then
                                ssIdsNew.Add (icdEnt.ObjectId)
                            End If
                        Catch ex As System.Exception
                            
                        finally
                            If NoticdEnt Is Nothing ThenicEnt.Dispose()
                        End Try
                    Next

                    'ssIdsNew→icdSSetNew
                      
                End Using
            End If
        Catch ex As System.Exception
            
        End Try

        'Reset selection set to Editor
        ed.SetImpliedSelection(icdSSetNew)

    End If                                                                                                                                      
End Sub

Separately, Document.ImpliedSelectionChanged was able to exclude certain figures from selection with similar coding.

I would appreciate it if you could give me some advice.

Thank you for your cooperation.

.net ijcad arx autocad

2022-09-30 22:01

1 Answers

The following events can be used to replace the selection set:
·Event that occurs when the Editor.PromptForSelectionEnding selection operation is completed
·Editor.SelectionAddedEvent that occurs when an object is added to the current selection set

Also, you can remove certain figures using the Selection*****EventArgs.Remove() method.

The Editor.SelectImplied() method retrieves the selection set with pre-selected.

If you want to limit yourself to specific edit commands, such as MOVE commands,
You can use it with the Document.CommandWillStart event.


2022-09-30 22:01

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.