Jump to content
David

How to make dynamic contents in feature definition arguments

Recommended Posts

Hello, everyone.

I have a problem implementing some functions while making a feature definition.

When creating an input values of a feature definition, I want to create or show a new item according to the initial input value. 

I think this is called "dyanmic contents" 

For example, if I enter "2" in first input values, two new empty input spaces are created. 

Perhaps if the "Is Hidden Condition" or "Is Enabled Condition" in the "Advanced" Column in arguments are met, the function will work.

But I don't know how to write or code it.

I would appreciate it if you could give me an example of this.

Thank you for your reply in advance.

Share this post


Link to post
Share on other sites

Hi David,

You are on the right track 🙂 In the "Advanced" Edit Menu of the input Arguments you can set the "Is Hidden Condition". 

You need to make sure that each time you insert a first input value, your editor gets refreshed. So for your first input argument you toggle the "refreshes editor" button (see screenshot).

2022-12-21_10h17_40.png.3698ed5347bc5563bf7a8de84855ae70.png

 

For the following dynamic input fields you can reference the first input value for example with

this.getARGUMENTNAME()

and add a condition to it.

 

2022-12-21_10h18_08.png.b1ca8e090aaae42268669c1063682468.png

 

I will attach a simple example feature definition here for you to test.

DynamicArguments.fdf

I hope this helps.

Cheers,

Hedi

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for your answer.

I have one more question.

For user convenience, I would like to put the value calculated from the previously entered value into the input dialog.

For example, if I enter "10" in the radius column, I want to see the "314.15" area of the circle in the specific column below.

The reason is that I want to use the value shown to estimate the next input value.

Ex.

Radius           | 10 

Area of Circle | 314.15 (uncorrectable, show-only values, calculated from Radius)

New Value     | 300

 

And in addition, is there a way to choose various options like the Lists used in Excel?

I want to make it possible to calculate with the selected method A, B, and C.

Of course, I can enter it directly as a number(1,2,3...) or letter(A,B,C...) in input, but the selection of the list is likely to be the simplest.

Thank you very much for your kind reply.

Have a nice day.

 

Share this post


Link to post
Share on other sites

Hi David,

You can display calculated values in the input dialog by defining an additional argument and editing the advanced settings of the feature argument. 

Here is a video tutorial on how to show result values in the input dialog.

 

image.png.76bb803d747ce9892b4fddfd515bca37.png

 

 

Drop down list for input values

In addition, you can use String Options to choose an input value from a drop down list. Make sure you switch off the field "Allow Expression" when you use it.

image.thumb.png.ab43d98b1ac6f9ce0f899f3fa8a00444.png

 

By using a "switch" you can define the method you would like to use for your calculations.

FString chosenmethod(method)

switch (chosenmethod)
case "A"
  echo("using calculation method A")
  
case "B"
  echo("using calculation method B")
  
case "C"
  echo("using calculation method C")
  
endswitch

 

Here is the feature definition example that includes the result values in the input dialog and the switch cases with the string options for your reference.

DynamicArguments_WithResultField_DropDownListOptions.fdf

Have a nice day.

Hedi

 

  • Upvote 1

Share this post


Link to post
Share on other sites
On 2/15/2023 at 3:00 AM, Hedi Boettcher said:

Hi David,

You can display calculated values in the input dialog by defining an additional argument and editing the advanced settings of the feature argument. 

Here is a video tutorial on how to show result values in the input dialog.

 

image.png.76bb803d747ce9892b4fddfd515bca37.png

 

 

Drop down list for input values

In addition, you can use String Options to choose an input value from a drop down list. Make sure you switch off the field "Allow Expression" when you use it.

image.thumb.png.ab43d98b1ac6f9ce0f899f3fa8a00444.png

 

By using a "switch" you can define the method you would like to use for your calculations.


FString chosenmethod(method)

switch (chosenmethod)
case "A"
  echo("using calculation method A")
  
case "B"
  echo("using calculation method B")
  
case "C"
  echo("using calculation method C")
  
endswitch

 

Here is the feature definition example that includes the result values in the input dialog and the switch cases with the string options for your reference.

DynamicArguments_WithResultField_DropDownListOptions.fdf 2.72 kB · 0 downloads

Have a nice day.

Hedi

 

Your reply was very helpful.

I really appreciate it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...