Export Parameter setting lost after adding user parameter to a custom parameter group

By Wayne Brill

Issue

I create a Custom Parameter Group to contain certain user parameters. The custom parameter group is created correctly however the user parameters do not retain the export parameter setting. (This applies to the 2009 release of Inventor).

Solution

A workaround is to restore the export parameter property by setting the ExposedAsProperty property of the parameter object (the equivalent to this export parameter check mark in the Parameters dialog) after it is added in the custom parameter group. The below VB.Net code demonstrates this suggestion:

Sub CreateCustomParaGroup()             Dim oCustomParameterGroup As CustomParameterGroup        Dim oParams As Parameters        Dim oDoc As PartDocument             oDoc = _invApp.ActiveDocument        oParams = oDoc.ComponentDefinition.Parameters             oCustomParameterGroup = oParams. _       CustomParameterGroups.Add("LVA_VCC", "LVA_VCC")             Dim oParameter As UserParameter        For Each oParameter In oParams.UserParameters                 Dim oStr As String = oParameter.Comment            oStr = oStr.Substring(0, 3)                 If oStr = "LVA" Then                     Dim oExported As Boolean                oExported = oParameter.ExposedAsProperty                oCustomParameterGroup.Add(oParameter)                oParameter.ExposedAsProperty = oExported                 End If        Next         End Sub

Comments

One response to “Export Parameter setting lost after adding user parameter to a custom parameter group”

  1. Hello Wayne,
    I see this is an old post, but this is closest I got to my issue doing google-search. It’s clear, how to create a customparametergroup and add a parameter to it. But I didn’t find a way, to remove them from the userparameter-group. So I have the same Parameter shown in two groups. I thought, the point with custom groups was to collect and group my Userdefined Parameter as needed… I understand that parameters have to be assigned to Parameter types (model, user, reference), but if I add them to a group I was expecting a way to “hide” them in the Group of their “real type” (actually they may disappear automatically in my eyes…). I inspected the parameter object, the parameters object and did not find an option “remove”, or “hide”. So I can’t see the advantage if they are still shown as userparameters too (either in API, nor in Inventor)… It’s just blowing up the fx-table…
    Could you please provide me some information on this?
    Did I miss something on the concept…?
    Thanks in advance,
    Daniel
    PS: I’m programming for Inventor 2014 in this case (customer has this version)

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading