ilogic content center change size

ilogic content center change size

Cadkunde.nl
Collaborator Collaborator
2,247 Views
11 Replies
Message 1 of 12

ilogic content center change size

Cadkunde.nl
Collaborator
Collaborator

Hello,

 

I have used the ContentCenterReplace Script made by @MjDeck a lot.

Found here:

https://forums.autodesk.com/t5/inventor-forum/changing-c-c-component-automation/m-p/3378327

https://forums.autodesk.com/t5/inventor-forum/ilogic-content-center-replace-nuts/td-p/3489692

 

I'm able to replace standard parts, and custom parts. But now I have a special situation.

I have a Pipe from content Center that is saved in content center with modifications:

 

2022-02-07_10-39-15.png

Things that change with this pipe are: Length, Nominal Diameter and hole pattern.

Our content center parts have ERP information. If diameter change, so does the ERP number.

 

I cannot use normal content center replace.

I've tried replace the pipe as custom like this:

				replacer.CreationMode = FileCreationMode.AsCustom
				Dim BarLength As Double = Excel_Aeration1_PipeL
				Dim CustomName As String = FamilyName_PE_Pipe.Replace("L=100", "L="& BarLength)
				Dim newFileName As String = replacer.GetCustomPartFullFileName(FamilyName_PE_Pipe, MemberName_PE_Pipe, CustomName, "B_L", BarLength)
				oOcc.Replace(newFileName, True)

But then I get a new file without my customization (the hole pattern)

What i need is not replace of a custom content center part, but "Change size":

2022-02-07_10-53-56.png

The existing saved and edited pipe needs to change size so that the hole pattern is kept, and the iproperties (for ERP) are controlled by content center.

 

Can this be done?

 

I can also imagine that the script of MJDeck from 2012 is outdated and there are better ways to replace/change size with content center parts.

 

Thanks in advance,

 

Arnold

 

 

 

 

0 Likes
Accepted solutions (2)
2,248 Views
11 Replies
Replies (11)
Message 2 of 12

MjDeck
Autodesk
Autodesk

Hi Arnold,

 

  It might be possible to have a rule change parameters (and maybe iProperties) in the custom pipe part directly, without using the Content Center. Can you do that manually? If so, it could probably be automated.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 12

Cadkunde.nl
Collaborator
Collaborator

Thx for repying.

 

Each diameter material and thickness has a unique ERP number and other properties. CC should be leading this.

 

As a user:

If you saved a content center pipe as custom, add some features, then use 'change size' to pick a different diameter, you do not 'replace' and your added features remain in tact.

 

I need that automated. Is that possible?

0 Likes
Message 4 of 12

MjDeck
Autodesk
Autodesk

I think it's possible, but it looks like there is no dedicated Content Center API function to do it.
Here's a sample VBA script, but it doesn't work on pipe parts.
https://adndevblog.typepad.com/manufacturing/2016/01/inventor-api-change-size-of-cc-component-placed...


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 5 of 12

Cadkunde.nl
Collaborator
Collaborator

Hello @MjDeck ,

 

Thanks for the link.

It's interesting, but too complicated and time consuming (for my experience level) to make that work in my specific scenario.

Is that the only method to update a custom content center pipe in my situation? Because it won't do for me to make such a code for just a small component in the whole scope of the machine I'm working on.

 

I also have a deadline, so making the features on assembly level is in comparison a much faster method.

But a dirty method, assembly features are terrible in configurators, and patterns cutting through multiple parts are even bugged.

 

Is there no easier way to simulate a 'change size' action?

I mean it has to be future proof, it has to find and update all columns (dimensions and iproperties) in the content center table, now and whatever is gonna change in the future.

0 Likes
Message 6 of 12

jan_priban
Alumni
Alumni

Hello Arnold

 

My understanding is same as Mike's ...

 

I think all you need is:

- no replace from Content Center, you need to save your current EPR properties

- you need to identify pipe in Content Center family to get list of available Nominal Diameters

- you need to change parameters defining pipe diameter, length

 

Adam's pages https://adndevblog.typepad.com is my favorite website, there are really nice samples + Brien's Ekins articles as well.

 

My suggestion:

- open pipe you need to modify

- get list of all available diameters

- change parameter OD representing pipe diameter

- change parameter L representing pipe length

 

Snippet to get pipe available diameters (could be improved by iLogic / VBA dialog having listbox filled by all ND values):

Sub GetPipeAllND()
Dim doc As PartDocument
Set doc = ThisApplication.ActiveDocument

Dim sFamily As String
sFamily = doc.PropertySets("Content Library Component Properties").Item("FamilyId").value
Dim oCCFamily As ContentFamily
Set oCCFamily = ThisApplication.ContentCenter.GetContentObject("v3#" & sFamily & "#")

'Exclude duplicities in ND
Dim sCurrentND As String
sCurrentND = "NonExistingND"

For i = 1 To oCCFamily.TableRows.Count
If oCCFamily.TableRows(i).GetCellValue("ND") <> sCurrentND Then
sCurrentND = oCCFamily.TableRows(i).GetCellValue("ND")
Debug.Print oCCFamily.TableRows(i).GetCellValue("ND")
End If

Next
End Sub

 

Regards

 

Jan Priban

 

0 Likes
Message 7 of 12

jan_priban
Alumni
Alumni

Instead of debug.print ND values can populate ListBox control on user form. If you would like something like this, let me know.

 

Jan Priban

PipeParameters1.png

0 Likes
Message 8 of 12

Cadkunde.nl
Collaborator
Collaborator

Thanks Jan,

 

But its for a configurable assembly. We fill in an excel and it pops out a complete tank with lots of pipes, nozzles and stuff fully automated. We dont want extra popup forms. The custom pipe gets new parameters (diameter and length) and with that has to change in content center which stores all iproperties.

 

Ive done that a lot with mjdecks script. But cant get it to work in this specific situation.

 

Is it possible to get all the tablerow fields and match them to their iproperty/parameter?

2022-02-09_20-31-56.png

2022-02-09_20-32-10.png

0 Likes
Message 9 of 12

jan_priban
Alumni
Alumni
Accepted solution

Hi Arnold

 

Yes, Content Center API allows to get entire family table. Once you have ContentFamily object that represents Content Center family, you can iterate thought all rows , all columns. Seems you have experience with iLogic, so work with iProperties / parameters is simply in iLogic. So I am just placing here snippet showing how to get all values for first table row (first member) of the pipe family DIN DIN 2458 Pipe

 

Regards

Jan Priban

 

Sub FirstRowValues()
Dim oFamily As ContentFamily
Set oFamily = ThisApplication.ContentCenter.GetContentObject("v3#" & "dcef2839-8903-4c98-a96c-b861f5d9bb7f" & "#")
Debug.Print "Family Name: " & oFamily.DisplayName
Debug.Print "Table rows: " & oFamily.TableRows.Count
Debug.Print "Table columns: " & oFamily.TableColumns.Count

Dim xCol As ContentTableColumn
Dim sFirstRow As String
sFirstRow = "First row: "

For Each xCol In oFamily.TableColumns
sFirstRow = sFirstRow & oFamily.TableRows(1).GetCellValue(xCol) & vbTab
Next

Debug.Print sFirstRow

End Sub

 

that generate output like

 

Family Name: DIN 2458 Pipe
Table rows: 232
Table columns: 15
First row: 10.2 1.4 ID=7.4 M6 7.4 250 250 10.2 x 1.4 DIN 2458 Pipe 10.2 x 1.4 - 250 10.2 x 1.4 - 250 DIN 2458 Pipe 10.2 x 1.4 - 250 DIN 2458 Pipe 10.2 x 1.4 Steel

Message 10 of 12

Cadkunde.nl
Collaborator
Collaborator

Hi @jan_priban, Thanks,

 

If I understand correctly, i can get all datacells. But I have to hardcode in my script where each columndata goes, either iproperty or dimension.

 

The thing is, things in our content center change, content center is still being worked on, there will be more fields in the future with iproperty information for ERP or other follow ups.

0 Likes
Message 11 of 12

jan_priban
Alumni
Alumni
Accepted solution

Hello,

 

you can "hardcode" column name. So sample bellow lists all family column, display column internal name. Column Internal Name can be hardcoded, so you can get value of e.g. Part Number by oFamily.TableRows(1).GetCellValue("PARTNUMBER")

 

Sub GetPartNumber1stRow()
Dim oFamily As ContentFamily
Set oFamily = ThisApplication.ContentCenter.GetContentObject("v3#" & "dcef2839-8903-4c98-a96c-b861f5d9bb7f" & "#")


Dim xCol As ContentTableColumn

'List of all columns
For Each xCol In oFamily.TableColumns
Debug.Print xCol.InternalName
Next

'Value of Part Number of first row / member in family table
Debug.Print oFamily.TableRows(1).GetCellValue("PARTNUMBER")

End Sub

 

Jan Priban

Message 12 of 12

Cadkunde.nl
Collaborator
Collaborator

Hello Jan,

 

Thanks for your reply.

I will keep your snippets for maybe future projects.

 

But for this project it's not an option for us to write in a ilogic rule which matches columns with iproperties and dimensions.

Our content center is still changing over time, if names or columns change, or new iproperties are required, these scripts will be forgotten and can have unexpected (costly) results.

 

0 Likes