This one has been needed and begged for since the very beginning.
There needs to be a new Property or Method added to the API for Parameter type (Class) objects (Parameter, UserParameter, ModelParameter, ReferenceParameter, DerivedParameter, TableParameter), that will Get the Value of the Parameter in the Parameter's own Units, instead of in ‘database units. If I typed the numerical value of 13.77 into the Equation column cell of a UserParameter in the Parameters dialog box, and the units of that UserParameter in the dialog box is set to “in” (Inches), I want to get that exact numerical value (not String) back from that UserParameter, in those exact units, without it being automatically converted to something else, when I retrieve it from that UserParameter in my code using the API route. This is so outrageously irritating, inefficient, and illogical. This shouldn’t be that difficult to accomplish for a company as massive as Autodesk.
Something like this:
Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
oVal = oPartDoc.ComponentDefinition.Parameters.Item("MyParam1").ValueInParameterUnits
Because Parameter.Value and Parameter.ModelValue both return the value in database units.
I am aware of the iLogic Snippets:
Parameter("d0") = 1.2
Parameter("Part1:1", "d0") = 1.2
Parameter(MakePath("SubAssem1:1", "Part1:1"), "d0") = 1.2
I know that this snippet accesses the Parameter’s Value, and gets/sets its value in the parameter’s units. But these are Properties of the iLogic Add-in’s IParamDynamic Interface, and not true API object Properties, and they have never been fully explained anywhere, in all the years they have been available. When you want to access a parameter in another document, the first ‘input variable’ requested is named “componentOrDocName”, and is defined as an Object, not a String. This variable has never been fully and specifically documented anywhere that I have ever seen. It is very unclear at best. And the fact that it is defined as an Object, leads us to believe that might accept something other than a String type value, but I have never seen any other object/data type used in that position, other than a String. In the case where you want to access a parameter in an assembly component, I have come to understand (through experience, not documentation) that it wants the same value as is returned from the ComoponentOccurrence.Name (also the same as is shown in the assembly’s model browser). But in the case where you want to access a parameter in another document (not an assembly component), I have learned that it wants the file name (without path & with file extension), but this is also not documented anywhere, and often times that doesn’t even work. Also, it seems like the Document.DisplayName will work there, but that is a Read/Write property, and doesn't always work either.
'local' = in the same document that the rule is saved within
And I’m also aware of using the unquoted name of a ‘local’ parameter in a ‘local’ rule, and that it will represent the direct value of the parameter in the parameter’s units, but this only works in ‘local’ rules, not in external rules or other external code.
Show More