Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Document (part or sub-assembly) highlight color is different from default blue c

13 REPLIES 13
SOLVED
Reply
Message 1 of 14
RoyWickrama_RWEI
874 Views, 13 Replies

Document (part or sub-assembly) highlight color is different from default blue c

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

Not Blue.png 

13 REPLIES 13
Message 2 of 14

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 !

Message 3 of 14

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 !

Message 4 of 14

Thanks for taking time to take a look at this.

Message 5 of 14

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 !

Message 6 of 14

@RoyWickrama_RWEI ,

 

Hoping that below settings in Application options may be helpful.

Selection_color.png

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 7 of 14

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.

Message 8 of 14

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 !

Message 9 of 14

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.

 

https://forums.autodesk.com/t5/inventor-customization/bom-structure-assigned-assy-level-not-captured...

 

 

 

Message 10 of 14

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 !

Message 11 of 14

@RoyWickrama_RWEI ,

 

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,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 12 of 14

Thanks a lot Chandra.Shekar.

It is doing well. 

At this moment, I thank @bradeneurope|Arthur as well - was so much helpful.

Message 13 of 14

@chandra.shekar.g 

 

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 Smiley Wink

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 !

Message 14 of 14

@bradeneuropeArthur 


@bradeneuropeArthur wrote:

@chandra.shekar.g 

 

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 Smiley Wink


Yes, this is what needed to assign color to selectset.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report