Pass X or Y as an argument to StartPoint in a function

Hello,

I am building a script that will set out dimensions between walls and grids.
In one of the functions I would need to be able to pass an X-, or Y-value as an argument to StartPoint so I could get either StartPoint.X or StartPoint.Y:

image

I have tried to do similar functions as the one above without it working.
Have any of you done something similar and got it working?

Best regards,
Mikael

You can’t define a property as a variable like that. Why do you need it to be one function anyway? As you have it written you still need to supply the X or Y component, which effectively gives you two options. Just use an If statement with two options for either StartPoint.X or StartPoint.Y.

1 Like

here 2 example


However, the if statement remains a good option

3 Likes

Hello @Nick_Boyts ,

Thanks for the reply :slight_smile:

I made a solution temporarily with an if statement but want to get rid of it as it creates an unnecessary amount of code so I think in this case it is better to be able to pass X or Y as an argument.

Hello @c.poupin ,

Thanks for the help!

That was exactly the solution I was looking for.
Now the code is much cleaner.