Codeblock function not running: Other DesignScript works fine

Hi All,

I’m trying to create a function to create a track in Dynamo, with the eventual aim of being able to reference points in the Revit massing environment so I can send the completed geometry back in. I’ve made a Designscript object which does what I want, but when I try to run it as a function I get nothing. The code is pretty much identical in both instances. The attached file shows my predicament. The grouped objects are the ones not working (on either of my computers) both running Dynamo 0.8.1 Any help would be much appreciated.

 

GoKartTrackAsDef

 

Your function doesn’t seem to return anything.

If you want the Track_Surface results

return=Track_Surface;

If you want the Track_Surface and Track_Volume

return={Track_Surface,Track_Volume};

Thanks for the fast reply! Unfortunately it didn’t seem to work, the Code block that calls it up still outputs a list of four null values. All that shows up in the preview are the four Point.ByCoordinates that I define as the inputs. The new version I’ve attached has Track_Volume as a return quantity but the watch node still has nothing.

 

GoKartTrackAsDef2

The problem lies in the geometry generated, not in the function.

If you pass the same values to the function, it works. (See attached file)

File: GoKartTrackAsDef21.dyn

You. Are a legend. Thank you so much. I notice that you’ve made it say

<span style=“color: #8c5eaa;”>def</span> racetrack (points:<span style=“color: #8c5eaa;”>var</span>[]…[], trackwidth, trackdepth, params:<span style=“color: #8c5eaa;”>var</span>[]…[])

 

What does the :var[]…[] section do? does that mean it’s asking for a list of values?

Sorry to be a pest, very new to this

:slight_smile:

" var[]…[] is used for arbitrary rank array, that means array can be of any dimension. So when this type is used, function will not replicate. "

Got that explanation from Sharad Jaiswal here

Another discussion in this forum that throws some light on this is here