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)

 

bradeneuropeArthur
in reply to: AMCr2

Dim p As PartDocument = ThisDoc.Document
Dim pps As PropertySet = p.PropertySets.Item("ContentCenter")
Dim pp As Inventor.Property = pps.Item("IsCustomPart")

MsgBox (pp.Value)

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !