×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Hide/Show UDF output
3

Hide/Show UDF output

Hide/Show UDF output

(OP)
Hi dear all
I'm new in this forum, I have a question.
I have done a UDF with several output (look at the attached image).
Can I hide or show output feature by a reaction when i change plug parameter?

RE: Hide/Show UDF output

you can include the reaction inside the UDF. That should do the job...

Eric N.
indocti discant et ament meminisse periti

RE: Hide/Show UDF output

(OP)
Itsmyjob Thank you for the answer.
I try to write a reaction like this (I write from my smartphone, I have not the UDF at hand):
If plug= "Yes"
{
Z942.show= true
}
Else
{
Z942.show= false
}
When I initialize the UDF, it doesn't work.
Have you any idea?

RE: Hide/Show UDF output

3
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 --> EKL

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 --> EKL

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 --> EKL

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 --> 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

RE: Hide/Show UDF output

(OP)
Thank you so much itsmyjob for your explanation. It's the first time that someone has explained that so clearly. When i return to work on wednesday i will try to modify the UDF as you have explained to me. I will let you know if everything is OK.
Best regards
Carl77

RE: Hide/Show UDF output

the following code works for me.

CODE --> EKL

let myUDF (UserFeature)
set myUDF =PartBody\Foro_HF_Punto_Angolo .Owner

let myList (List)
myList =myUDF.Query ("VolumeGeo", "x.Name == \"Z942\" ")

let myUDFOutput (VolumeGeo)
set myUDFOutput  = myList[1]

myUDFOutput.Show = `Foro_HF_Punto_Angolo\Geometrical Set.2\Parameteri_Foro\Plug2` 


After changing the code I had to pass it to the definition of the UDF by updating the UDF



Also I published the boolean parameter Foro_HF_Punto_Angolo\Geometrical Set.1\Parameteri_Foro\Plug2

Result is fine:




Not sure why line 2 would fail. Remove all lines in your code, and add one line at a time to see when the problem is. I had some problem with some code before and the solution was to delete the Action or the Reaction and make a new one.

Have fun... Stay safe.

Eric N.
indocti discant et ament meminisse periti

RE: Hide/Show UDF output

(OP)
Itsmyjob thanks for your quick reply.
I'm not sure but I think the problem colud be vindows 8.1, maybe some .Net framework aren't updated.
Tomorrow I'll try on windows 10.
Thank you very much.
Have a nice day.

RE: Hide/Show UDF output

i am using 3dx21X on win10

Eric N.
indocti discant et ament meminisse periti

RE: Hide/Show UDF output

works on R28

regards,
LWolf

RE: Hide/Show UDF output

Eric, since this was fun, I tried to incorporate color into the reaction...
with mixed success...
It works IF I only have one color, but when I add "else" the whole thing stops responding to the color request... any reason why? I want to change the color of the entire UDF; hence
let myUDF (UserFeature)
set myUDF =UDF_prep\Assemble.1 .Owner

let myList (List)
myList =myUDF.Query ("VolumeGeo", "x.Name == \"Z942\" ")

let myUDFOutput (VolumeGeo)
set myUDFOutput = myList[1]

myUDFOutput.Show =UDF_Body\Parameters.2\BoxAttached

if UDF_Body\Parameters.2\BoxAttached
myUDF.Color="Green"
else
myUDF.Color="Yellow"
this does not work... but removing else and its contents will change the color to green (once)

regards,
LWolf

RE: Hide/Show UDF output

Edit: Yesterday it did NOT work, I tried rewriting the if-syntax in 10+ different ways, without success.
Today though, it WORKS. Anybody has any clue to WHY I get this random behaviour?!

regards,
LWolf

RE: Hide/Show UDF output

Quote:

Yesterday it did NOT work, I tried rewriting the if-syntax in 10+ different ways, without success.
Today though, it WORKS. Anybody has any clue to WHY I get this random behaviour?!

Did you try restarting CATIA yesterday?

RE: Hide/Show UDF output

Little Cthulhu, no... that is one thing I did not.

regards,
LWolf

RE: Hide/Show UDF output

Quote:

Little Cthulhu, no... that is one thing I did not.

Then I suppose it's just a bug possibly caused by a state CATIA was in.

As always, if you manage to reproduce it, send a report to DS.

RE: Hide/Show UDF output

I like to start CATIA in the morning..... It's a good day.

Eric N.
indocti discant et ament meminisse periti

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

White Paper - Strategies to Secure Connected Cars with Firewalls
White-hat hackers have demonstrated gaining remote access to dashboard functions and transmissions of connected vehicles. That makes a firewall a vital component of a multilayered approach to vehicle security as well as overall vehicle safety and reliability. Learn strategies to secure with firewalls. Download Now
White Paper - Model Based Engineering for Wire Harness Manufacturing
As complexity rises, current harness manufacturing methods are struggling to keep pace due to manual data exchanges and the inability to capture tribal knowledge. A model-based wire harness manufacturing engineering flow automates data exchange and captures tribal knowledge through design rules to help harness manufacturers improve harness quality and boost efficiency. Download Now
White Paper - What is Generative Design and Why Do You Need It?
Engineers are being asked to produce more sophisticated designs under a perfect storm of complexity, cost, and change management pressures. Generative design empowers automotive design teams to navigate this storm by employing automation, data re-use and synchronization, and framing design in the context of a full vehicle platform. Download Now
eBook - Simulation-Driven Design with SOLIDWORKS
Simulation-driven design can reduce the time and cost of product development. In this engineering.com eBook, we’ll explore how SOLIDWORKS users can access simulation-driven design through the SOLIDWORKS Simulation suite of analysis tools. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close