Function if else with point coordinates

hi everyone,
I am trying to create a function if else with points coordinates.

StartPt and EndPt are points by coordinates.

Probably i am doing a wrong definition of coordinates points.
Any suggestion?

image

Many thanks
Elisabetta

My first thought: Don’t call the function before you define it. Use a separate code block instead.

Could you give an example from what to what you want to get? The code looks fine but I don’t know what’s going into it or what’s supposed to go out of it.

Yes, but there’s no any difference

I would like to have a point…

But maybe i need to call the x y and z of the point in a different way…

Actually now it gives me this error

Index was outside the bounds of the array.

   at ProtoCore.DSASM.Executive.GetProcedureNode(Int32 blockId, Int32 classIndex, Int32 functionIndex)
   at ProtoCore.DSASM.Executive.UpdateMethodDependencyGraph(Int32 entry, Int32 procIndex, Int32 classIndex)
   at ProtoCore.DSASM.Executive.SetupExecutive(Int32 exeblock, Int32 entry)
   at ProtoCore.DSASM.Executive.Execute(Int32 exeblock, Int32 entry, Language language)
   at ProtoCore.DSASM.Executive.Execute(Int32 exeblock, Int32 entry, List`1 breakpoints, Language language)
   at ProtoCore.DSASM.Executive.BounceUsingExecutive(Executive executive, Int32 exeblock, Int32 entry, StackFrame stackFrame, Int32 locals, Boolean fepRun, Executive exec, List`1 breakpoints)
   at ProtoScript.Runners.ProtoScriptRunner.ExecuteLive(Core core, RuntimeCore runtimeCore)
   at ProtoScript.Runners.LiveRunner.Execute(Boolean isCodeCompiled)
   at ProtoScript.Runners.LiveRunner.CompileAndExecute(List`1 astList)
   at ProtoScript.Runners.LiveRunner.CompileAndExecuteForDeltaExecution(List`1 astList)
   at ProtoScript.Runners.LiveRunner.SynchronizeInternal(GraphSyncData syncData)
   at ProtoScript.Runners.LiveRunner.UpdateGraph(GraphSyncData syncData)
   at Dynamo.Scheduler.UpdateGraphAsyncTask.HandleTaskExecutionCore()
   at Dynamo.Scheduler.AsyncTask.Execute()

Using DS might be easier.


You can add another condition if you need elseif.

what happens when you run your original imperative function? returns null?

Try copying your definition portion of the code block to the clipboard, comment out the entire contents (add a /* to the front of the first line, and. */ to the end of the last), and then paste the definition to a new code block, but rename the function something similar. Then call the new definition in a new code block.

If that works then calling the function before defining it corrupted the storage in the dyn. Least that’s how I rationalized it in the past. Deleting the old code block, and then restarting Dynamo should fix this.

Many thanks.
Now it works! :slight_smile:
Thank you