Open Replace Content Center Part Form with VBA

Open Replace Content Center Part Form with VBA

Anonymous
Not applicable
1,887 Views
13 Replies
Message 1 of 14

Open Replace Content Center Part Form with VBA

Anonymous
Not applicable

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.

replace_form.png

 platten_center.png


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?

0 Likes
1,888 Views
13 Replies
Replies (13)
Message 2 of 14

bradeneuropeArthur
Mentor
Mentor

What do you mean:

 

But we use some PMMA parts and I want to add them into CC.

Do you need a row with a new material PMMA

 

 

Now we can change the size and get a new CC Part.

But the new CC part doesnt have a row.

What row is missing then? material?

 

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
Message 3 of 14

Anonymous
Not applicable

 

 

But we use some PMMA parts and I want to add them into CC.

Do you need a row with a new material PMMA

 

 

Now we can change the size and get a new CC Part.

But the new CC part doesnt have a row.

What row is missing then? material?



An Content Center iPart doesnt have a rows (only for predefined parts). It uses user-defined parameters, which are entered via a form (the shown one in the screenshot).
I need a code to change the parameters via ilogic or open the form from CC.

0 Likes
Message 4 of 14

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Sorry, But I don't exactly get what you mean.

Can you please explain a little more.

 

because adding the selected material in a additional textbox in CC is easier.

 

But please explain if it is correct that only the possible selection PMMM as Material is missing.

 

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
Message 5 of 14

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

"I need a code to change the parameters via illogic" means, changing the parameters of iPart in Content Center through iLogic form.

 

Below link would help in building iLogic form. Again, same iLogic form code can be extended to replace occurrence in an assembly.

 

https://www.youtube.com/watch?v=GLGlcDzPS_Q

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 6 of 14

bradeneuropeArthur
Mentor
Mentor

Hi,

 

To my understanding Content Center families are NO I-parts.

Content Center Families are based on a template driven by a Table.

 

Why should you use illogic to do something that is per default possible with Content Center Files?

 

Or am I missing something?

 

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

Message 7 of 14

Anonymous
Not applicable

Content Center Files are no iPart!
But you can add iParts into Content Center with user defined parameters.
In example, we have a pmma plate with a size of 500x100x8 mm as Content Center File.

500 mm,100 mm and 8 mm can be changed by input of new data. (Form below)

platten_center.png

The data of length, width are used to generate filename and title and so on. Thats set in the familytable. 
If I change the size from the 500x100x8 to 600x100x8 a new CC part with filename "pmma_600x100x8_001.ipt" is created.

We make custom designs and sizes. Thats why I need custom CC parts. Sometimes we have sizes like 822x610x600 mm or 1590x591x550 mm. And I dont want to set up a matrix with 2300x2300x10 variations in the familytable. That would extremly slow down the system and some sizes would never been used.

I want to open the form to replace part with a new size in ilogic. ( "Change size..." if you right click on an CC part)
Or change the size (marked red) directly via an ilogic form, without opening the Content Center form.
The code for an ilogic form would be better, because we have a mainassembly and open an ilogic form in this mainassembly to change sizes of the complete product.
The mainassembly works as a product template in Inventor and Vault and at the moment we simple need to copy the mainassembly, because all other parts are in CC and not copied. 

I am sry, but my english isnt as good as it could be. Hopefully you understand what I mean.

0 Likes
Message 8 of 14

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

I think, Place iLogic Component may help your requirement. For more details about this, go through the following you tube video link.

 

https://www.youtube.com/watch?v=p7trTFZKTDg

 

Use Place iLogic Component to place a copy of a part or subassembly into the main assembly.

Because the copy is made in the directory of the assembly you are working in, save the assembly before using this command.

 

  1. On the ribbon, click Assemble tabComponent panel, then click the Place drop-down arrow and select Place iLogic Component.
  2. In the file browser, select the component to place. The component displays in a small preview window.

    Note: If you choose a component from one of the Library directories of your project, you can switch between the Library directory and the Workspace directory. Most likely, it is the location of the main assembly.
     
  3. Click Open.

    The component parameters display in a small dialog box that is like the Parameters dialog box. If the component contains Key parameters, then those parameters are the only ones included in the list. Otherwise, all parameters are included.

    All parameters are initially designated as <Free> in the From Assembly column to indicate that assembly parameters do not drive them. You can change the parameter values manually, and the component updates to show your changes.

  4. Click a drop-down arrow in the From Assembly column to display a list of assembly parameters that are available to drive that parameter.

    These parameters must exist in the assembly, so create any that you need before placing the component.

  5. Click OK after making your changes.

    iLogic starts the Place Component command, so you can place the copied component in the main assembly.

 

Please feel free to contact if there is any queries.

 

If solves problem, click on "Accept as solution" / give a "Kudo".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 9 of 14

Anonymous
Not applicable

Thats not helpfull. Sorry.
I know how to add new parts in an assembly and I know iLogic Parts. But I want to change a Content Center Part with custom parameters.

I want to replace the 560x8x560 Content Center Part with the 615x8x510 Content Center Part in example.
The samples in helpfiles only use replace by row. But the custom content center part has only one row and generates new files without a new row in the familytable.

The manual way to do what I want is to right click on the part and select "Change size...". Then change the size in the shown screenshot (red marked).
I need ilogic or vba code to replace the part with changed sizes or open the form used to change it via ilogic or vba (right click "Change size...").


0 Likes
Message 10 of 14

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Try the suggestion provided in the following blog link.

 

http://adndevblog.typepad.com/manufacturing/2016/01/inventor-api-change-size-of-cc-component-placed-as-custom.html

 

Please feel free to contact if there is any queries,

 

If solves problem, click on "Accept as solution" / give a "Kudo".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 11 of 14

Anonymous
Not applicable

Thanks for your replay.

I will check, if the example in the link could help me.
But I see a problem. In the example they doesnt replace the part. They change the part with the options of the CC part.
The part ist a "custom" CC part and they want to change it with the informations of a standard CC part. Thats again done by row.

I will make a video with the parts we have and show, what we have made and how it works manualy at the moment.
I think that what we made isnt wanted from inventor normaly.

0 Likes
Message 12 of 14

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

"If we talk about “Change Size as custom”, there is no existed API to support currently. There is a series of internal logic that are implemented in CC"

 

As per the above statement, there is no direct API to change size.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 13 of 14

Anonymous
Not applicable

Yes, but do not change custom size. I change some key parameter for a norm size.

• Get the target CC table row (yes)

• Get all parameters you need to change (yes)

• Get the new values (yes)

• Batch Edit the parameters (yes)

• …

• Update Part (yes)

I need to access the parameters shown in the form (marked red) and change them.
As I said. Another way to solve the problem could be to open the form with an vba code.
I think that the form should be able to open. Even if no api exists for accessing the information in the form?

0 Likes
Message 14 of 14

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

 

Currently, there is no API to access content center information. As I suggested in the previous post, you can follow the suggestions in below blog link.

 

http://adndevblog.typepad.com/manufacturing/2016/01/inventor-api-change-size-of-cc-component-placed-as-custom.html

 

You can also log wish list at idea station using following link.

 

https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232/tab/most-recent 

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes