Highlight Selection while using ilogic

Highlight Selection while using ilogic

Anonymous
Not applicable
1,038 Views
5 Replies
Message 1 of 6

Highlight Selection while using ilogic

Anonymous
Not applicable

I have an illogic code that I have to select geometry on the drawing, is it possible to highlight my selections as I pick them so they stand out on screen?

0 Likes
1,039 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Are the selected items being selected entirely by the code, or is there an interactive portion that allows you to manually pick them with your mouse.

Perhaps if there was more info here, such as a copy of your code so far, and/or screen captured images of what your looking at.

These would probably help drive more and better replys.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

Anonymous
Not applicable

@WCrihfieldIt's an on screen selection with the mouse. I can paste code in a while.

0 Likes
Message 4 of 6

JelteDeJong
Mentor
Mentor

you could do something like this:

Dim doc As DrawingDocument = ThisApplication.ActiveDocument
Dim highlightSet As HighlightSet = doc.HighlightSets.Add()
highlightSet.Color = ThisApplication.TransientObjects.CreateColor(255, 0, 255)

Dim line1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select line")
highlightSet.AddItem(line1)

Dim line2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select line")
highlightSet.AddItem(line2)

Dim line3 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select line")
highlightSet.AddItem(line3)

MsgBox("3 lines are highlighted")

highlightSet.Clear()

MsgBox("highlightSet is cleared")

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 5 of 6

Anonymous
Not applicable

@JelteDeJongHow would that work with the following code?

 

Dim oDoc As DrawingDocument= ThisDoc.Document
Dim oView As DrawingView
Dim oSegment As DrawingCurveSegment
Dim oCcName As String

 

Dim comps As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
Dim comp As Object

While True
comp = ThisApplication.CommandManager.Pick(16914, "Pick tangent edges TO KEEP, press ESC when finished.")
If IsNothing(comp) Then Exit While
comps.Add(comp)
End While

For Each comp In comps
oSegment = comp
oView = oSegment.Parent.Parent
oCcName = oSegment.Parent.ModelGeometry.Parent.Parent.name
For Each oCurve As DrawingCurve In oView.DrawingCurves
If oCurve.EdgeType = 82694 Then
If oCurve.ModelGeometry.Parent.Parent.name = oCcName Then
For Each DCSeg As DrawingCurveSegment In oCurve.Segments
DCSeg.Visible = False
Next
End If
End If
Next
Next

For Each comp In comps
oSegment = comp
oSegment.Visible =True
Next

0 Likes
Message 6 of 6

JelteDeJong
Mentor
Mentor

something like this. I have colored my changes red. (I changed 2 numers for there enums for more easy reading)

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oView As DrawingView
Dim oSegment As DrawingCurveSegment
Dim oCcName As String
Dim highlightSet As HighlightSet = oDoc.HighlightSets.Add()
highlightSet.Color = ThisApplication.TransientObjects.CreateColor(255, 0, 255)


Dim comps As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
Dim comp As Object

While True
    comp = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Pick tangent edges TO KEEP, press ESC when finished.")
    If IsNothing(comp) Then Exit While
    comps.Add(comp)
    highlightSet.AddItem(comp)
End While

For Each oSegment In comps
    oView = oSegment.Parent.Parent
    oCcName = oSegment.Parent.ModelGeometry.Parent.Parent.Name
    For Each oCurve As DrawingCurve In oView.DrawingCurves
        If oCurve.EdgeType = DrawingEdgeTypeEnum.kTangentEdge Then
            If oCurve.ModelGeometry.Parent.Parent.Name = oCcName Then
                For Each DCSeg As DrawingCurveSegment In oCurve.Segments
                    DCSeg.Visible = False
                Next
            End If
        End If
    Next
Next

For Each comp In comps
    oSegment = comp
    oSegment.Visible = True
Next
highlightSet.Clear()

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes