Sorry for the long delay but this topic is interesting enough and we discussed it internally for some time.
If we talk about “Change Size as custom”, there is no existed API to support currently.
There is a series of internal logic that are implemented in CC.
For example,
- Get all parameters need to change
- Get the new values
- Batch Edit the parameters
…
In this case Inventor changes existing part document via Parameters API + iProperties APIs directly. No new part, no replacement. Of course, it is always better to have an appropriate API function, but in this particular case you are able to implement this workflow yourself.
You start with your CC custom component saved locally. You know its row in the CC family table and you know the new target row.
As user parameter names are the same as corresponding ContentTableColumn’s InternalNames you may update the user parameters’ values with the values read from the corresponding cells in the target row. The following function could be used to find the required column number by user parameter name:
Function GetColumnByName(ByRef family As ContentFamily, _
ByVal ColumnName As String) As Integer
'find CC family table column by its name ColumnName
Dim i As Integer
For i = 1 To family.TableColumns.Count
If family.TableColumns.Item(i).InternalName = ColumnName Then
Debug.Print "f-n GetColumnByName: " & i & " " & family.TableColumns.Item(i).InternalName
GetColumnByName = i
Exit Function
End If
Next
GetColumnByName = -1
End Function
You should also update part number, stock number, MemberId, Member Revision and may be other iProperties as well. Finally you should rename component in the browser (name is usually based on part number) and update both part and assembly documents.
It is not easy to implement a general utility that could work with any CC family, but fortunately in most cases you work with several particular families (e.g., structural shapes – angles, channels, I-beams, etc.). This could simplify this implementation.
Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network