Selecting all occurrences of a part in Inventor drawing to change color

Selecting all occurrences of a part in Inventor drawing to change color

icebot53
Enthusiast Enthusiast
2,487 Views
9 Replies
Message 1 of 10

Selecting all occurrences of a part in Inventor drawing to change color

icebot53
Enthusiast
Enthusiast

Hi guys,

 

I am looking for some solution to select all parts by the name of 2000 x 2000 in an inventor drawing and change the color proprty of all the parts as well as enable the Hidden Line option. 

 

I know that in an assembly you can choose to Select All Occurrences but it doesn't seem available in the drawing file. 

2,488 Views
9 Replies
Replies (9)
Message 2 of 10

Cadmanto
Mentor
Mentor

Are you just wanting to see them to select them or are you looking for a means like through iLogic that when you type in this number, it automatically changes everything with this number to the selected color and line option?

Because, below is available.

FILTER.png

 

EE LOGO.png
Windows 10 x64 -16GB Ram
Intel i7-6700 @ 3.41ghz
nVidia GTS 250 - 1 GB
Inventor Pro 2020

 

Best Regards,
Scott McFadden
(Colossians 3:23-25)


Message 3 of 10

icebot53
Enthusiast
Enthusiast

See. My drawings sometimes have over 2000 of these in one assembly and having to go and click each one becomes very tedious.

 

I know that I can demote the parts in the assembly level and just select that, but based on the type of assembly I'm making, sometimes that is not ideal.

 

If I search for them, I still have to click each one individually to select them and change the properties. 

0 Likes
Message 4 of 10

Cadmanto
Mentor
Mentor

I get it.

Not sure if these threads are an option, but if you place the color you want in the model, it might be.

https://forums.autodesk.com/t5/inventor-forum/how-to-make-some-parts-shaded-in-drawing/m-p/3810809#M... 

https://forums.autodesk.com/t5/inventor-forum/individual-item-shaded-view-possible/m-p/5153372#M5153... 

 

EE LOGO.png
Windows 10 x64 -16GB Ram
Intel i7-6700 @ 3.41ghz
nVidia GTS 250 - 1 GB
Inventor Pro 2020

 

Best Regards,
Scott McFadden
(Colossians 3:23-25)


0 Likes
Message 5 of 10

mcgyvr
Consultant
Consultant

Is it always the same part or different parts you need to do this for?

Do you always need to change them to a certain color or do you need the ability to choose a different color each time you perform this operation on all parts?

Are you always making them hidden lines?

Anything else?

 

If one were to provide code that just allowed you to pick a part and run a rule to change all drawing curves/lines to your set color and make it hidden line type would that be exactly what you need or is there something else?

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 6 of 10

icebot53
Enthusiast
Enthusiast

I don't often play with colors as my parts have predetermined colors. I have read the article but don't know exactly where to find the opacity settings.

 

However, in drawings, I highlight the bracing as blue and the access as green etc (attached image).

 

On some views, I need to use the hidden line command as the parts that I want to color are underneath other parts, but on others it doesn't really matter.  Changing the color only means I must still go and select a lot of parts in the drawing browser and change the hidden line setting.

0 Likes
Message 7 of 10

icebot53
Enthusiast
Enthusiast

Is it always the same part or different parts you need to do this for? - I have an Ipart which gives a different part and name with about 40 different sizes e.g. 1500 x 2000, 2000 x 2000, 2500 x 2000 etc. 

Do you always need to change them to a certain color or do you need the ability to choose a different color each time you perform this operation on all parts? - It would be nice to be able to change the colors as I wish. Different types of bracing get different colors.

Are you always making them hidden lines? - I build scaffolding in inventor and sometimes to show a brace in plan elevation, there are boards above it. If you don't enable the hidden line option it doesn't show. On the sectional elevations I don't need the hidden lines but on the plan drawings I do.

Anything else?

0 Likes
Message 8 of 10

icebot53
Enthusiast
Enthusiast

Anyone else maybe have any ideas?

0 Likes
Message 9 of 10

JelteDeJong
Mentor
Mentor

you can try this iLogic rule. Its not bug free. The first time you run it works fine afther that it started hiding parts each time you run it. (at some point it shows all part again :-S ) i could not find a solution for that. anyway copy past this in 1 ilogic rule and see what happens.

Sub Main()

	Dim oCommandMgr As CommandManager = ThisApplication.CommandManager
	oControlDef = oCommandMgr.ControlDefinitions.Item("DrawingBodyHiddenLinesCtxCmd")
	
    Dim doc As DrawingDocument = ThisApplication.ActiveDocument
    Dim partNameToColor As String = "strip"

    Dim topNode As BrowserNode = doc.BrowserPanes.Item("DlHierarchy").TopNode
    selectPart(topNode, partNameToColor)
End Sub
Public curentView As DrawingView
Public oControlDef As ControlDefinition
Public Sub selectPart(topNode As BrowserNode, name As String)
    For Each node As BrowserNode In topNode.BrowserNodes
        Try
            node.Expanded = True
        Catch ex As Exception

        End Try

        If (TypeOf node.NativeObject Is Sheet) Then
            selectPart(node, name)
        ElseIf (TypeOf node.NativeObject Is DrawingView) Then
            curentView = node.NativeObject
            selectPart(node, name)
        ElseIf (TypeOf node.NativeObject Is AssemblyComponentDefinition) Then

            selectPart(node, name)

        ElseIf (TypeOf node.NativeObject Is ComponentOccurrence) Then
            If (node.BrowserNodeDefinition.Label.Contains(name)) Then
                node.DoSelect()
                oControlDef.Execute()
                colorPart(node.NativeObject, curentView)
            End If
        End If
    Next

End Sub
Public Sub colorPart(foundOccurence As ComponentOccurrence, view As DrawingView)
    Dim drawingCurves As DrawingCurvesEnumerator = view.DrawingCurves(foundOccurence)
    For Each dc As DrawingCurve In drawingCurves
        dc.LineWeight = 3
        dc.Color = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
    Next
End Sub

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

Message 10 of 10

jaime75
Contributor
Contributor

na verdade o que o amigo está querendo é algo que eu também quero a alguns anos e ninguém consegue entender a necessidade.

Seria a mesma opção disponível no ambiente de montagem .iam para o ambiente de desenho .idw 

 

 

 

 

"In fact, what the friend is wanting is something that I have also wanted for a few years and no one can understand the need.

It would be the same option available in the .iam assembly environment for the .idw drawing environment"

Translated by Google
Traduzido por [@clacampos] através do Google Tradutor

 

 

jaime75_0-1696425927500.png