Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
AMCr2
84 Views, 1 Reply

Detect if selected part was created as as Custom Content Center

Hi.

 

The  macro below successfully detects if the current selected part is a content center part, but not if it was created with Content Center (As Custom). Example: a tube with the "Change Size" option enabled, saved as Custom.

 

I couldn't find any way to detect if it has the "Change Size" option enabled on the part. Any idea how to fix this?

 

On Error Resume Next

Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oCount As Integer = oDoc.SelectSet.Count
Dim oPane As BrowserPane = oDoc.BrowserPanes.ActivePane

If oDoc.DocumentType <> kAssemblyDocumentObject Or oCount = 0 Then Exit Sub
	
'If oDoc.SelectSet.Item(1).PropertySets.Item("ContentCenter").Item("IsCustomPart").Value = 1 then msgbox ("SIM")

If oCount > 1 Then 
	ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyReplaceCmd").Execute2(True)
	Exit Sub
End If

If oDoc.SelectSet.Item(1).IsiPartMember Or oDoc.SelectSet.Item(1).IsiAssemblyMember Then
	Dim oNode As BrowserNode = oPane.GetBrowserNodeFromObject(oDoc.SelectSet.Item(1))
		oNode.Expanded = True
	Dim oTableNode As BrowserNode = oNode.BrowserNodes.Item(1)
		oDoc.SelectSet.Clear
		oTableNode.DoSelect
	ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyChangeComponentCmd").Execute
	Exit Sub
End If

If oDoc.SelectSet.Item(1).DefinitionDocumentType <> kAssemblyDocumentObject Then
	If oDoc.SelectSet.Item(1).Definition.IsContentMember Then 
		ThisApplication.CommandManager.ControlDefinitions.Item("CCV2ChangeSizeButton").Execute2(True)
		Exit Sub
	End If
End If

ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyReplaceCmd").Execute2(True)