Colour assignment in multi body part does not translate when that body is sent out as a separate part

Colour assignment in multi body part does not translate when that body is sent out as a separate part

AnthonyHarris90842
Collaborator Collaborator
748 Views
16 Replies
Message 1 of 17

Colour assignment in multi body part does not translate when that body is sent out as a separate part

AnthonyHarris90842
Collaborator
Collaborator

I have a multi body part and I assign different colours to the the various bodies.
Then I use the make part command and click link face colour to the bodies.

When I open the new parts that are derived from the the multi body part the face colour is right but when I section that part it takes on the colour of the template that was used.

Then I have to individually go and assign that part with the face colour and this takes so much time when you have lots of bodies and many projects 

Please fix this so that what ever colour you assign to the body or face it comes thru exactly like in the multibody part and we don't have to repeat the process.

INVENTOR 2.jpg

749 Views
16 Replies
Replies (16)
Message 2 of 17

kacper.suchomski
Mentor
Mentor

I think you can submit this idea on Idea Station.


Kacper Suchomski

EESignature


YouTube - Inventor tutorials | LinkedIn | Instagram

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.


0 Likes
Message 3 of 17

AnthonyHarris90842
Collaborator
Collaborator
Thank you KACPER
0 Likes
Message 4 of 17

johnsonshiue
Community Manager
Community Manager

Hi Anthony,

 

I think you are talking about the ability to link material style. The graphical section honors the material appearance style. The active material style in the part template you selected to do Make Components (Make Parts) dictates the coloring of the section. I guess you could build templates with different active material style. When you do Make Components, select the desirable template file accordingly.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 5 of 17

AnthonyHarris90842
Collaborator
Collaborator

How can you even think that is a solution when I have a few hundred parts that I need to send out. 

Should I have a few hundred templates?

0 Likes
Message 6 of 17

johnsonshiue
Community Manager
Community Manager

Hi Anthony,

 

Unfortunately, that is the solution I can think of without using iLogic. Another way is to create an elaborated iLogic rule to make such changes automatically.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 7 of 17

AnthonyHarris90842
Collaborator
Collaborator
Hi Johnson

I cant see why this is so difficult.
I assign a colour to a body and then when I make part the part takes on that colour so that when you section it the same colour shows inside and not the template colour
0 Likes
Message 8 of 17

johnsonshiue
Community Manager
Community Manager

Hi Anthony,

 

The behavior you are seeing is due to the fact that the section color depends on the material appearance. But, when you use Make Components to push the bodies as individual parts, the the material style associated with the source part isn't "derived" or carried over to the pushed parts.

This behavior shows two major deficiencies. 1) Inventor does not support material style per body. You cannot assign material style to a body as other CAD tools do. 2) Except in a sheet metal part, the material style in the source part isn't derived or linked to the derived part.

Another deficiency is that the sectioned face color is based on material appearance, not the body appearance. There is no option to allow that.

I fully agree with you that the behaviors are not desirable. However, I personally cannot offer any better solution than merely explaining the behaviors. I am sorry.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 9 of 17

AnthonyHarris90842
Collaborator
Collaborator
Hi Johnson
Thank you for trying.
Is it possible for someone to write a ilogic routine that will open all my parts, check what the colour was that was assigned and on the surface and them change the derived part to that colour much as I would do it manually.
0 Likes
Message 10 of 17

johnsonshiue
Community Manager
Community Manager

Hi Anthony,

 

I believe it is doable. Essentially, the iLogic rule will be like a robot automating the otherwise manual process.

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 11 of 17

cadman777
Advisor
Advisor

I'm using Inventor 2010 and now beginning to remember why I never use MBPs.

It's b/c there are too many caveats for my workflow.

This is one of them.

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 12 of 17

A.Acheson
Mentor
Mentor

Here is a post that should get you 50% of the way there. It will access the parent part from the child part and loops through the solid bodies. You then need to find the solid body common between the two. I haven't explored this yet but if you can pin point the correct solid body through a common name etc you can drill back to the appearance on the surface. Hope that helps a bit. It would be handy if a button was set up for this very purpose within the .ale component dilaogue. Push appearance or material to all derived parts.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 13 of 17

BDCollett
Advisor
Advisor

I have always just used the material in combination with the BOM editor to mass select the parts I need and apply the specific material/appearance that way. If you have hundreds of different colors and materials for whatever reason that's still going to be annoying.

 

0 Likes
Message 14 of 17

A.Acheson
Mentor
Mentor

Here is a rule that will update material of derived component from the appearance of the Parent solid body. I would test this on a small non production assembly to ensure it is working as it should be.

AAcheson_0-1677366588742.png

 

Dim Doc As Document = ThisDoc.Document
If Doc.DocumentType = kPartDocumentObject Then
MessageBox.Show("This rule can only be run in an assembly file - exiting rule", "iLogic")
Return
End If

For Each RefDoc As Document In Doc.AllReferencedDocuments
	
	'Look at ony part files.
	If RefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then 
		
		Dim RefPartDoc As PartDocument = RefDoc 
		
		'Logger.Info(RefPartDoc.DisplayName)
		Dim DPComps As DerivedPartComponents = RefPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents
		
		For Each DPComp As DerivedPartComponent In DPComps

			'Logger.Info(DPComp.ReferencedDocumentDescriptor.FullDocumentName)
			For Each Sb As ReferenceFeature In DPComp.SolidBodies
'				Logger.Info(Sb.Name)
'				Logger.Info(Sb.Appearance.Name)
				
				'[Bring the correct material to the part. Appearance names must match material Names, if not use option filter!
				Dim MaterialName As String = Sb.Appearance.DisplayName
				
				'Option Filter: If Appearance names don't match material Names.
				'Dim MaterialName As String = "Gold"
				'If Sb.Appearance.DisplayName = MaterialName Then
				
'					'Create Reference To another material Library
'					Dim AssetLib As AssetLibrary = ThisApplication.AssetLibraries.Item("Inventor Material Library")
'					'Set The Active Library
'					ThisApplication.ActiveMaterialLibrary = AssetLib
					
					'Create Reference To the active material Library.
					Dim AssetLib As AssetLibrary = ThisApplication.ActiveMaterialLibrary
					Dim LocalMaterial As MaterialAsset
				 	Try
					    Try
							LocalMaterial  = RefPartDoc.MaterialAssets.Item(MaterialName)
					 	Catch Ex As Exception
					    	Dim LibMaterial As MaterialAsset = AssetLib.MaterialAssets.Item(MaterialName)
							LibMaterial.CopyTo(RefPartDoc)
							LocalMaterial = RefPartDoc.MaterialAssets.Item(MaterialName)
						End Try
							RefPartDoc.ActiveMaterial = LocalMaterial
					Catch Ex As Exception
						Logger.Info("No Material available")
					End Try
					RefPartDoc.Update
					']
					'End If
			Next
		Next
	End If
Next

Doc.Update

 

In addition here is an optional rule to derive the parent part and make an assembly. This automates the make components command.  

Sub Main()
    
    'Set a reference to the active partdocument
    Dim ParentDoc As PartDocument = ThisDoc.Document

    'Dim DPTemplate As String = "C:\Templates\SHEET METAL.ipt"
	Dim DPTemplate As String = Nothing
    
	'Set the folder for the new files
	Dim Folder As String = ThisDoc.Path
    
    'Create an object collection to store the parts to put in assembly
    Dim PartCol As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
    
    For Each Sb  As SurfaceBody In ParentDoc.ComponentDefinition.SurfaceBodies
    
        'Create a new part to derive the solid body in.
        Dim PartDoc As PartDocument = ThisApplication.Documents.Add(kPartDocumentObject,DPTemplate, True)
        
		'Set a reference to the derivedpartcomponents.
        Dim Dpcs As DerivedPartComponents = PartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents
                    
        'Create the scale definition.
        Dim Dpd As DerivedPartUniformScaleDef = Dpcs.CreateUniformScaleDef(ParentDoc.FullFileName)
                
        'Set the Derived Part settings. 
        DerivedPartSettings(Dpd, Sb)
        Dpcs.Add(Dpd)
       	PartCol.Add(PartDoc)
  
        'Set the part title to the solidbodies name.
        PartDoc.PropertySets.Item("Inventor Summary Information").Item("Title").Value = Sb.Name
  
        ' Save the part
		ThisApplication.SilentOperation = True
        Try
			PartDoc.SaveAs(Folder & "\" & Sb.Name & ".ipt", False)
        Catch
		End Try
		ThisApplication.SilentOperation = False
		
    Next Sb

    'Use a template for a new assembly.
	'Dim AssyDoc As AssemblyDocument = ThisApplication.Documents.Add(kAssemblyDocumentObject,, True)
	
	'Find opened assembly in which the sketch part is.
    Dim AssyDoc As AssemblyDocument = ThisApplication.Documents.Open(Folder & "\House" & ".iam")
	
    'Place in assembly.
    For Each PartDoc In PartCol
		
        ' create an empty matrix
        Dim mx As Matrix = ThisApplication.TransientGeometry.CreateMatrix()
        
        Dim Occ As ComponentOccurrence = AssyDoc.ComponentDefinition.Occurrences.AddByComponentDefinition(PartDoc.ComponentDefinition, mx)
        PartDoc.Close(True)
        
    Next

End Sub


Sub DerivedPartSettings(ByRef Dpd As DerivedPartUniformScaleDef, Sb As SurfaceBody)
   
    'Set the derive style.
    Dpd.ExcludeAll
    
    'Include solid, exclude the others
    For Each Dpe As DerivedPartEntity In Dpd.Solids
        If Dpe.ReferencedEntity.Name = Sb.Name Then
            Dpe.IncludeEntity = True
        End If
    Next
        
End Sub

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 15 of 17

AnthonyHarris90842
Collaborator
Collaborator
Hi Alan

I have never used rules before so don't know where to start.
Any chance you do a little video to show me how to use your rule

0 Likes
Message 16 of 17

A.Acheson
Mentor
Mentor

Here is a nice video to show you where to set the external rules folder and how to create a rule then simply copy and paste and run. The ilogic tab is just located off the model browser tab simply press the + button. The ilogic logger is also there which will allow you to see usefull  information while the rule runs. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 17 of 17

AnthonyHarris90842
Collaborator
Collaborator
Thank you so much Alan
Highly appreciated