Update Custom Content Center Parts (Change Size)

Update Custom Content Center Parts (Change Size)

dalton98
Collaborator Collaborator
210 Views
2 Replies
Message 1 of 3

Update Custom Content Center Parts (Change Size)

dalton98
Collaborator
Collaborator

Hello,

I've created some content center parts for our company, I've since updated the part numbers of these parts. Is there an easy way to mass update all of the content center parts in an assembly? It would be like the refresh standard components for bolts, nuts, etc.

 

Right now what im doing is: right click component > "Change Size..." > wait for dialog box and press enter

Tried something like this to recreate the workflow, but couldnt get it to work.

ThisApplication.CommandManager.ControlDefinitions("CCV2ChangeSizeButton").Execute2(False)

System.Windows.Forms.SendKeys.SendWait("{ENTER}")

Any help would be much apricated. Thanks.

0 Likes
211 Views
2 Replies
Replies (2)
Message 2 of 3

KWarrenCA
Advocate
Advocate

At my company I created a macro that places every part into an assembly where then we can do a bulk refresh. You have to do it for each family but once they are placed they can be saved in a folder to update in the future. You will have to change the check family name on line 22 to the name of the family and change the location of the folder on line 14. Hopefully that helps.

Public Sub PlaceSteelShapesFromContentCenter()
Dim asmDoc As AssemblyDocument
Set asmDoc = ThisApplication.Documents.Add(kAssemblyDocumentObject)

Dim objCustomInput As NameValueMap
Set objCustomInput = ThisApplication.TransientObjects.CreateNameValueMap


Dim asmDef As AssemblyComponentDefinition
Set asmDef = asmDoc.ComponentDefinition

' Get the node in the content browser based on the names of the nodes in the hierarchy.
Dim steelNode As ContentTreeViewNode
Set steelNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Tube & Pipe").ChildNodes.Item("Fittings").ChildNodes.Item("TEES")


' Find a specific family. In this case it's using the display name, but any family
' characteristic could be searched for.
Dim family As ContentFamily
Dim checkFamily As ContentFamily
For Each checkFamily In steelNode.Families
If checkFamily.DisplayName = "TEE - THREADED - BSP - 150" Then
Set family = checkFamily
Exit For
End If
Next

Dim i As Integer
If Not family Is Nothing Then
' Place one instance of each member.
Dim offset As Double
offset = 0
Dim row As ContentTableRow
For Each row In family.TableRows
' Create the member (part file) from the table.
Dim failureReason As MemberManagerErrorsEnum
Dim failureMessage As String
Dim memberFilename As String
objCustomInput.Clear

memberFilename = family.CreateMember(row, failureReason, failureMessage, kRefreshOutOfDateParts, , , objCustomInput)
'Debug.Print failureReason & vbTab & failureMessage
' Place the part into the assembly.
Dim transMatrix As Matrix
Set transMatrix = ThisApplication.TransientGeometry.CreateMatrix
transMatrix.Cell(2, 4) = offset
Dim oCC As ComponentOccurrence
Set oCC = asmDef.Occurrences.Add(memberFilename, transMatrix)
Debug.Print i + 1 & vbTab & oCC.MassProperties.Mass

' Compute the position for the next placement based on the size of the part just placed.
Dim minY As Double
Dim maxY As Double
minY = oCC.RangeBox.MinPoint.Y
maxY = oCC.RangeBox.MaxPoint.Y
offset = offset + ((maxY - minY) * 1.1)
i = i + 1
Next
End If
End Sub

 

Message 3 of 3

dalton98
Collaborator
Collaborator

Thanks for your response. However, i think my problem is slightly different. When i tried your code it created standard parts

 

The content center parts im using are custom structural shapes(angle, channel, etc.) and have many different lengths.

0 Likes