I have part of my rule that I select documents from within the assembly.
The rule is fine (i.e., the selected document gets highlighted at the time of selecting). But the color is different from default blue.
Could someone help to fix this issue! Thanks.
Public Class RWEI_0023A Sub main() Dim iL_NO As String = "0025A" Dim iL_Name As String = "Highlighted Multiple Selections" Dim iL_FFN As String = "Rule " & iL_NO & ": " & iL_Name Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oLFN_Pos As Long Dim oFFN As String 'Full file name (with extension) Dim oLFN As String 'Local file name (with extension) Dim oSelectionOptions As New ArrayList Dim oComp As String = "Component" Dim oPart As String = "Part" Dim oCancell As String = "Cancel" oSelectionOptions.Add(oComp) oSelectionOptions.Add(oPart) oSelectionOptions.Add(oCancell) Dim oSelectedSet As Inventor.HighlightSet oSelectedSet = oDoc.CreateHighlightSet oSelectedSet.Clear Dim oEntities As ObjectCollection oEntities = ThisApplication.TransientObjects.CreateObjectCollection Dim oOccurrence As ComponentOccurrence oSelection = InputListBox("SELECT", oSelectionOptions, oSelectionOptions(0), Title := iL_NO & ": COMPONENT SELECTION", ListName := iL_NO & ": Selection List") If oSelection = oCancell Then Exit Sub While True If oSelection = oComp Then oEntity = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, iL_NO & ": Select Component:") Else If oSelection = oPart Then oEntity = ThisApplication.CommandManager.Pick(kAssemblyLeafOccurrenceFilter, iL_NO & ": Select Part:") End If If IsNothing(oEntity) Then Exit While oSelectedSet.AddItem(oEntity) oEntities.Add(oEntity) End While oSelectedSet.Clear i = 1 For Each oEntity In oEntities ' oDoc_Entity = oEntity.Definition.Document ' oFFN = oDoc_Entity.FullFileName ' oLFN_Return = oName_Doc_Local(oFFN, oLFN_Pos, oLFN) ' MessageBox.Show("Name - Occurrence: " & oEntity.Name _ ' & vbLf & "Name - LFN: " & oLFN_Return _ ' & vbLf & "Name - FFN: " & oDoc_Entity.FullFileName, iL_FFN) '' i += 1 Next End Sub Function oName_Doc_Local(oFFN As String, oLFN_Pos As Double, oLFN As String) oLFN_Pos = InStrRev(oFFN, "\", -1) oLFN = Mid(oFFN, oLFN_Pos + 1, Len(oFFN) - oLFN_Pos) Return oLFN End Function End Class
Solved! Go to Solution.
Solved by chandra.shekar.g. Go to Solution.
Hi,
Maybe I don't understand, but I don't see any code that changes the color!!
Regards,
Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
I understand now...
I will see.....
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
I am still struggling with the color too.
Think that it also could be a api bug.
But I am not sure.
A tried to change the color to ie red but also not working.
🤔🤔🤔
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Hoping that below settings in Application options may be helpful.
Thanks and regards,
Thanks for the reply. It opened me some where I totally neglected.
But, it not not yielding the results I expect. But, good to explore. Thanks.
Hi,
Still think there is an API bug here.
I tried to change the color by .SetColor(255,0,0), but this is not working.
So to my opinion maybe a bug!!!!
Maybe Autodesk can confirm this?
Regards,
Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Thanks for the reply.
You are right.
For now, it is OK because it is highlighted any way (@ a weird color).
I have a humble request. In my other post, I need to have the bom structure including the items made referenced from within assembly. Do you think, could you shed some light on this! Thanks.
I have tried this with no result...
oSelectedSet = oDoc.CreateHighlightSet Dim r As Byte = 250 Dim g As Byte = 0 Dim b As Byte = 0 oSelectedSet.Color.SetColor (r,g,b) MsgBox (oSelectedSet.Color.Red & "-" & oSelectedSet.Color.Green & "-" & oSelectedSet.Color.Blue)
Result is always 240 0 0
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Try below code to change the color of highlighted sets. @bradeneuropeArthur is provided valuable hint to change the color of selection.
Public Class RWEI_0023A Sub main() Dim iL_NO As String = "0025A" Dim iL_Name As String = "Highlighted Multiple Selections" Dim iL_FFN As String = "Rule " & iL_NO & ": " & iL_Name Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oLFN_Pos As Long Dim oFFN As String 'Full file name (with extension) Dim oLFN As String 'Local file name (with extension) Dim oSelectionOptions As New ArrayList Dim oComp As String = "Component" Dim oPart As String = "Part" Dim oCancell As String = "Cancel" oSelectionOptions.Add(oComp) oSelectionOptions.Add(oPart) oSelectionOptions.Add(oCancell) Dim oSelectedSet As Inventor.HighlightSet oSelectedSet = oDoc.CreateHighlightSet oSelectedSet.Clear Dim r As Byte = 0 Dim g As Byte = 0 Dim b As Byte = 250 Dim oColor As Color oColor = ThisApplication.TransientObjects.CreateColor(r,g,b) oSelectedSet.Color = oColor Dim oEntities As ObjectCollection oEntities = ThisApplication.TransientObjects.CreateObjectCollection Dim oOccurrence As ComponentOccurrence oSelection = InputListBox("SELECT", oSelectionOptions, oSelectionOptions(0), Title := iL_NO & ": COMPONENT SELECTION", ListName := iL_NO & ": Selection List") If oSelection = oCancell Then Exit Sub While True If oSelection = oComp Then oEntity = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, iL_NO & ": Select Component:") Else If oSelection = oPart Then oEntity = ThisApplication.CommandManager.Pick(kAssemblyLeafOccurrenceFilter, iL_NO & ": Select Part:") End If If IsNothing(oEntity) Then Exit While oSelectedSet.AddItem(oEntity) oEntities.Add(oEntity) End While oSelectedSet.Clear i = 1 For Each oEntity In oEntities ' oDoc_Entity = oEntity.Definition.Document ' oFFN = oDoc_Entity.FullFileName ' oLFN_Return = oName_Doc_Local(oFFN, oLFN_Pos, oLFN) ' MessageBox.Show("Name - Occurrence: " & oEntity.Name _ ' & vbLf & "Name - LFN: " & oLFN_Return _ ' & vbLf & "Name - FFN: " & oDoc_Entity.FullFileName, iL_FFN) '' i += 1 Next End Sub Function oName_Doc_Local(oFFN As String, oLFN_Pos As Double, oLFN As String) oLFN_Pos = InStrRev(oFFN, "\", -1) oLFN = Mid(oFFN, oLFN_Pos + 1, Len(oFFN) - oLFN_Pos) Return oLFN End Function End Class
Thanks and regards,
Thanks a lot Chandra.Shekar.
It is doing well.
At this moment, I thank @bradeneurope|Arthur as well - was so much helpful.
That did the trick:
Dim r As Byte = 0 Dim g As Byte = 0 Dim b As Byte = 250 Dim oColor As Color oColor = ThisApplication.TransientObjects.CreateColor(r,g,b) oSelectedSet.Color = oColor
Well done
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
@bradeneuropeArthur wrote:
That did the trick:
Dim r As Byte = 0 Dim g As Byte = 0 Dim b As Byte = 250 Dim oColor As Color oColor = ThisApplication.TransientObjects.CreateColor(r,g,b) oSelectedSet.Color = oColorWell done
Yes, this is what needed to assign color to selectset.
Thanks and regards,
Can't find what you're looking for? Ask the community or share your knowledge.