Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
spencer
913 Views, 3 Replies

Using the Content Center though a VB.NET add-in

Hello all, I've been working on automating design processes using a custom Inventor add-in, but I'm stumped with regards to the content center.

One of the key features is a command I have setup that inserts new assemblies composed of content center parts, but the handling of the content center is not going well.

 

So far everything seems to work aside from the way the parts are put in, and I've tried several ways with mixed results. Below is the pre-insert process

 

- User input form gives the ok, passes back a collection of parameters to the builder module

- Builder module gets the parameters and generates a filename, then checks if filename exists in the project

-- If it does, that file is inserted and the function is done

-- If not, it creates a new assembly, maps all parameters to the assembly user parameters, then inserts assembly, saves, and triggers the build process

 

- Build process does stuff, determines assembly "family" and loops through all ContentFamily's in the applicable content center tree node

- For each part, generates a filename and a NameValueMap with the needed parameters (Same names as part params) for that part

- For each part check if file already exists

-- If it does, simply insert said part

-- If not, insert part from content center

 

 

Which is where things go bad, I've tried several methods but can't seem to get any to work, and the lack of info on the details of these methods doesn't help

 

Attempt 1:

 

ContentFamily.CreateMember(1{Rows and Columns not used in these parts}, Err, FailMessage,,True, FileName, Params))

Result:

Part is inserted, Params is not passed whatsoever so the end result is a default-size part that's locked from editing

The names in params are the same as the parameter names they're supposed to map to, but there no docs on how this command works so it's up in the air if I've even got the right format

 

Attempt 2:

ContentFamily.CreateMember(1{Rows and Columns not used in these parts}, Err, FailMessage,,True, FileName))
insertPart()
oDoc as PartDocument = document of inserted part

Dim tDCT As CommandTypesEnum = oDoc.DisabledCommandTypes
Dim tDST As String = oDoc.SubType

oDoc.DisabledCommandTypes = 0
oDoc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}"

Loop
Assign Params values to oDoc parameters

oDoc.Update()
oDoc.Save2()

oDoc.DisabledCommandTypes = tDCT
oDoc.SubType = tDST

Result:

Part is inserted with proper name and default values, is changed to a standard part, parameters are overwritten by stored Params, part is updated, saved, and changed back to original type

This works approximately 1/3rd of the time and runtimes + crashes Inventor the other 2/3rds, and there seems to be no rhyme or reason as to when it will be ok and when it won't

 

Attempt 3:

Tried to do a setup that hijacked user commands from the command manager, not sure if it's possible but is going to take a lot of trial and error to even find out.

 

 

Any suggestions on making this work? I don't even know if I'm simply calling functions wrong or if some of these don't work as advertised/intended

 

Including a picture of my user form, since pictures are good for attracting attention and it gives a better idea of what I'm going for. Depending on the Panel Type selected, different parameters and different parts are used to make the assembly

ie. Double panels have a cover on top that other types don't, but because of that they can't have an eyebrow, but both use the same base panel in their construction, just with different flags set, etc.

 

ContentCopy.PNG