
Back in 2015, I wrote a blog post detailing some best practice around calculating assembly surface areas for paint or coatings, sadly this post has disappeared from the interwebs, but I did include a reference to it in my AU London class “Need for Speed: 102 Productivity Hacks for Inventor”
The Area iProperty of an Inventor assembly, is a sum of all of the surface areas, of all of the parts in this assembly. This means that mating faces and internal faces are included in the surface area calculation, making it less than ideal for use when looking at paint or coatings.
Below is a copy of my slide from AU London 2018, showing a side by side example of a normal assembly and a Shrinkwrap.
Click me for higher res versionWith this in mind you can easily create a Shrinkwrap Substitute of your assembly (patching holes as required). From here you can look at the iProperties and the surface area will be accurate (for paint or coatings).

What about some iLogic?
I have written a pretty epic iLogic routine to get this information. In the animation below, you can see an assembly file with no mates, the surface area is the same as the normal assembly. When the mates are re-applied, the surface area is reduced, as the mating faces are not part of the surface area calculation.
Click me for higher res versionThe iLogic code does the following:
- Sets the assembly LOD to “Master”.
- Creates a temporary Shrinkwrap LOD.
- Deletes the temporary LOD.
- Extracts the Area info from the temporary Shrinkwrap part.
- Writes the Area values to custom iProperties.
- Deletes the temporary Shrinkwrap part.
- Fires up a message box, telling the user that the job is complete.
The iLogic code is set to not patch any holes in the shrinkwrap geometry, but I have included details for patching holes (commented in the code).
If you are looking for the surface area of hollow framework, my suggestion is to set “HolePatcher” to 88322, which should fill all of the voids and give you a more accurate answer.
'Set Hole Patching HolePatcher = 88321 '(88323 = Range) (88322 = All) (88321 = None) *********************************************************************************************************** MinimumPerimeter = 0.1 MaximumPerimeter = 5
Here is the full iLogic code:
'iLogic code by @ClintBrown3D - UNOFFICIAL INVENTOR BLOG
'Originally posted at: https://clintbrown.co.uk/assembly-surface-areas-For-paint-Or-coatings
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition
oDef = oDoc.ComponentDefinition
Try
'Set the LOD to Master"
Dim doc As AssemblyDocument = ThisDoc.Document
Dim oLOD As LevelOfDetailRepresentation
Dim oAsmCompDef As ComponentDefinition
oAsmCompDef = doc.ComponentDefinition
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("Master")
oLOD.Activate(True)
Catch
MsgBox("Could Not Set LOD")
End Try
' Create a new part document that will be the shrinkwrap substitute
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, , False)
Dim oPartDef As PartComponentDefinition
oPartDef = oPartDoc.ComponentDefinition
Dim oDerivedAssemblyDef As DerivedAssemblyDefinition
oDerivedAssemblyDef = oPartDef.ReferenceComponents.DerivedAssemblyComponents.CreateDefinition(oDoc.FullDocumentName)
' Set various shrinkwrap related options
oDerivedAssemblyDef.DeriveStyle = 80642 '"kDeriveAsSingleBodyNoSeams"
oDerivedAssemblyDef.IncludeAllTopLevelWorkFeatures = 27137 '"kDerivedIncludeAll"
oDerivedAssemblyDef.IncludeAllTopLevelSketches = 27137 '"kDerivedIncludeAll"
oDerivedAssemblyDef.IncludeAllTopLeveliMateDefinitions = 27138'"kDerivedExcludeAll"
oDerivedAssemblyDef.IncludeAllTopLevelParameters = 27138'"kDerivedExcludeAll"
oDerivedAssemblyDef.ReducedMemoryMode = True
'Set Hole Patching
HolePatcher = 88321 '(88323 = Range) (88322 = All) (88321 = None) ***********************************************************************************************************
MinimumPerimeter = 0.1
MaximumPerimeter = 5
Call oDerivedAssemblyDef.SetHolePatchingOptions(HolePatcher, MinimumPerimeter, MaximumPerimeter)
' Name the TEMP part
Dim strSubstituteFileName As String
oTime = Now.ToFileTime' .ToShortTimeString
strSubstituteFileName = "C:\Temp\DeleteMe" & oTime & ".ipt"
Call oDerivedAssemblyDef.SetRemoveByVisibilityOptions(88579, 25)'(kDerivedRemovePartsAndFaces, 25)
' Create the shrinkwrap component
Dim oDerivedAssembly As DerivedAssemblyComponent
oDerivedAssembly = oPartDef.ReferenceComponents.DerivedAssemblyComponents.Add(oDerivedAssemblyDef)
' Save the TEMP part
ThisApplication.SilentOperation = True
Call oPartDoc.SaveAs(strSubstituteFileName, True)
ThisApplication.SilentOperation = True
' Create a substitute level of detail using the shrinkwrap part.
Dim oSubstituteLOD As LevelOfDetailRepresentation
oSubstituteLOD = oDef.RepresentationsManager.LevelOfDetailRepresentations.AddSubstitute(strSubstituteFileName)
oSubstituteLOD.Name = "@ClintBrown3D"
'Set LOD back to Master
Dim doc1 As AssemblyDocument = ThisDoc.Document
Dim oLOD1 As LevelOfDetailRepresentation
Dim oAsmCompDef1 As ComponentDefinition
oAsmCompDef1 = doc1.ComponentDefinition
oLOD1 = oAsmCompDef1.RepresentationsManager.LevelOfDetailRepresentations.Item("Master")
oLOD1.Activate(True)
'Get Vaules from the temporary file
ThisApplication.SilentOperation = False
Dim oModel As PartDocument
aFilePath = strSubstituteFileName
oModel = ThisApplication.Documents.Open(aFilePath, False)
oArea = oModel.ComponentDefinition.MassProperties.Area
'Write the temporary value to iProperties
iProperties.Value("Custom", "PaintAREA cm") = oArea & " cm^2"
iProperties.Value("Custom", "PaintAREA mm") = (oArea * 100) & " mm^2"
iProperties.Value("Custom", "Assembly Area") = iProperties.Area
'Delete Temp LOD
oSubstituteLOD.Delete
'Delete Temporary shrinkwrap file
Try
If System.IO.File.Exists(strSubstituteFileName) Then
My.Computer.FileSystem.DeleteFile(strSubstituteFileName)
End If
Catch
MsgBox("Could Not Delete Temp File")
End Try
MessageBox.Show("Success!" & vbNewLine & vbNewLine &"Paint Area = " & iProperties.Value("Custom", "PaintAREA cm") & vbNewLine & vbNewLine & "This has been written to PaintArea under Custom iProperties", "@ClintBrown3D")
This version of the code was briefly tested with Inventor 2020 & 2019.
Please note that I cannot offer any additional support, this blog post is offered as-is, and is aimed at the more advanced user.
As always, please test all iLogic code extensively on non-production files. Do not use any code in a production environment until YOU have thoroughly tested it and have verified that it works as expected. Always back up any data before running any experimental code. You are ultimately responsible for any iLogic code that you run, so make sure you test it thoroughly!
As this code could have an impact on costings within your business, please ensure that you are 100% happy with the output of the code, and that you have understood the impact of the different hole capping options etc. Make sure you run some tests on known components. This site takes absolutely no responsibility for how you use this code in production (see disclaimer).
You must be logged in to post a comment.