Well... we wish it would work that way but no.
is Z942 is the geometry you use to define as output in the UDF, then it's not gonna work, you have to get the output element, not the geometry that define the output.
So what I did:
create a GeometricalSet or a Body (I used an Assemble Body)
in you GeoSet or Body make sure you have a parameterSet and a relationSet
create your boolean parameter in your parameterset
create the reaction in the relationset
in the reaction find the UDF with something like this:
Code:
let myUDF (UserFeature)
set myUDF =PartBody\Assemble.1.Owner
now that you have the UDF, go get the output but the trick is that when you create the code the first time you don't have the output yet, you did not defined the UDF yet... so Query the name you will give the output
Code:
let myList (List)
myList =myUDF.Query ("Line", "x.Name == \"HoleAxis\" ")
even if my line in the definition of the geometry is name Axis.7 I search the the output name...
Next is to Hide the Line
Code:
let myUDFOutput (Line)
set myUDFOutput = myList[1]
myUDFOutput.Show = PartBody\Assemble.1\Body.1\Parameters.1\ShowAxis
Here I have my Parameter as boolean and not yes / no but you can use ternary to quickly get what you want:
Code:
myUDFOutput.Show = (plug== "Yes")? True ; False
Now if you change your parameter it will fail and you will have error message because no line is named HoleAxis... not best solution but we're not done yet.
Create the UDF and define the output Line and name it properly and publish the parameter
in the UDF you can change the parameter and again it will fail... don't panic!
instantiate your UDF
change parameter and voila! it works. Etonnant non ?
So why does it fail in the definition? just because we are looking for a line that does not exists yet (the output element)
Why does it fail in the UDF? Because in the UDF the output is not truly a Line, so even if the name is correct, the Type is not.
and it works in the Instantiation of the UDF, because the output is a line with the proper name...
Can we make it work at all level (Definition/ UDF / Instantiation) ?
We almost could... if we make sure the Reaction is looking for the proper element:
in the definition, add some code to check if UDF is Null then change Axis.7.Show Parameter
in the UDF, well the output is a Feature and it seams it does not have Show Attribute, so no
To sum up: the output element is a duplication of the element that defines it, so if you want to change show or color attribute you have to get this output element, if you want to get length of output curve, well it should be the same as the length of the curve that defines it, so you can use the curve.
Enjoy...
Eric N.
indocti discant et ament meminisse periti