Detect if selected part was created as as Custom Content Center

Detect if selected part was created as as Custom Content Center

AMCr2
Participant Participant
280 Views
1 Reply
Message 1 of 2

Detect if selected part was created as as Custom Content Center

AMCr2
Participant
Participant

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)

 

0 Likes
281 Views
1 Reply
Reply (1)
Message 2 of 2

bradeneuropeArthur
Mentor
Mentor
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 & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes