Pipe Support - Python Custom Script Component - Show Calculated Value in Plant3D Component Properties

Pipe Support - Python Custom Script Component - Show Calculated Value in Plant3D Component Properties

sebastian.oleksy
Explorer Explorer
1,397 Views
4 Replies
Message 1 of 5

Pipe Support - Python Custom Script Component - Show Calculated Value in Plant3D Component Properties

sebastian.oleksy
Explorer
Explorer

Hello,

 

I created custom pipe support with python scripting, everything is working ok, I have my input values:

sebastianoleksy_0-1654860595427.png

And here is the result:

sebastianoleksy_1-1654867400507.png

 

Based on the entered by user "L" , the script is calculating "PL" length of the inner profile, it changes in increments of 50mm as those are prefabricated inner profile lengths. 

sebastianoleksy_0-1654867369392.png

I'm aware that is probably not the most elegant way of writing this in code 🙂 But it works and it changes inner profile length in desired way, and everything checks out on model. My problem is following, now I need some way to return this calculated “PL” value to show it in Plant3D component properties, and make it so it would update when I change the "L" value. 

 

Is there any way to do that? 

 

 

0 Likes
1,398 Views
4 Replies
Replies (4)
Message 2 of 5

George.Endrulat
Advisor
Advisor

You can add as many functions to the file as you want, just put it above the main functions 'activate'.

George

If my post offers a solution, please click "Accept as Solution"
0 Likes
Message 3 of 5

sebastian.oleksy
Explorer
Explorer

thank you very much George for reply, but I'm not seeing how I could use that in my case. Maybe you could explain it a little bit more, it might be that I'm not seeing something obvious since my coding experience is close to zero.

 

My "PL" value is calculated based on variables defined as @Anonymous, and from what I know in order to show it on Plant3D I would need to define the "PL" as @Anonymous with some initial value. But by doing this the "PL" won't update based on calculations and will just stay with that initial value.

 

Are you suggesting to move calculating the "PL" to the function before the "activate", and then use that value when I define "PL" as @Anonymous? But then how to use the variables defined in @Anonymous that are used to calculate "PL"?

0 Likes
Message 4 of 5

alexandru_stroeV3CKE
Contributor
Contributor

Hello!Did you found any solution?

0 Likes
Message 5 of 5

jeremypatterson
Participant
Participant

Hello, I would also like to know if have found the solution for this as well?

0 Likes