Open Replace Content Center Part Form with VBA

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I replace some content center parts in my assembly by replace by row.
'This iLogic demo replaces the given standard component 'with another member from same family. ' row number of the new family member . Dim NewRow As Integer = Length 'active assembly s Dim oMainAsm As AssemblyDocument = ThisDoc.Document Dim oAsmDef As AssemblyComponentDefinition = oMainAsm.ComponentDefinition ' get the occurrence by its position in the occurrences collection Dim oOcc As ComponentOccurrence = oAsmDef.Occurrences.Item(1) Dim oDef As PartComponentDefinition = oOcc.Definition Dim oDoc As PartDocument = oDef.Document 'reference to the CC properties - oProps Dim oPropSets As PropertySets = oDoc.PropertySets Dim oProps As PropertySet = oPropSets.Item("Content Library Component Properties") ' family id Dim oProp As Inventor.Property = oProps.Item("FamilyId") Dim FamilyId As String = oProp.Value 'MsgBox("FamilyId: " + FamilyId) 'reference to the ContentFamily Dim oContentCenter As ContentCenter = ThisApplication.ContentCenter Dim oFamily As ContentFamily = oContentCenter.GetContentObject("v3#" + FamilyId + "#") 'MsgBox("Content Family DisplayName: " + oFamily.DisplayName & vbNewLine & _ ' "Rows in Family: " & oFamily.TableRows.Count ) 'create new member file Dim ErrorType As MemberManagerErrorsEnum Dim strContentPartFileName As String Dim strErrorMessage As String strContentPartFileName = oFamily.CreateMember(NewRow, ErrorType, strErrorMessage) 'replace the existing component with the new one oOcc.Replace(strContentPartFileName, False) Beep '---------------------------------------
But we use some PMMA parts and I want to add them into CC. As we use different sizes, I added a ipart in CC. Now we can change the size and get a new CC Part. But the new CC part doesnt have a row. Because it is a custum content center ipart!
What I now want is to open the "replace with CC part" button and the form of the CC part selected in inventor by VBA.
Or an ilogic form with an input for the sizes.
I know that I can make a simple ipart and could change the size for the ipart in ilogic, but we need often to copy assemblys in vault and its much easyer, if we dont need to unselect the iparts. And it is much more save for new members. CC parts are unselected by default for copy in vault.
Thanks for any help. Because I couldnt find any infos in google or the api help. Maybe I searched wrong or for wrong keyword?