Using a Code Block Function to create Floors

Hi,

I’m new to creating Functions. In the attached image I’m testing my code with creating one floor for a placed room. If I use the Floor.ByOutlineTypeAndLevel node my logic works fine. Can someone please look at my function and how I’m calling it to see where I went wrong?

Thanks,

Dan

CodeBlockFunction

Sorry, I forgot to mention I’m using the latest build: 8.1.912.

Thanks,

Dan

One more thing, just noticed in my calling Code Block I specify floorType then floorTypes in the FloorCreate(). Fixed that, didn’t make a difference.

Hi Dan,

You don’t really need a custom definition for making floors:

Capture1

Thanks Dimitar, that worked great. If I wanted to use a function; maybe more logic would be needed for another purpose. Am I on the right track or is there a good document out there that could help me with this?

Thanks,

Dan

The language guide in the learn section is a good start:

http://dynamobim.org/wp-content/uploads/forum-assets/colin-mccroneautodesk-com/07/10/Dynamo_language_guide_version_1.pdf

Also check out the sample file in Help>Samples>Core>CoreCodeBlocks

Other than that, you could try searching the forum or asking for specific problems here.

From the image above it looks like you’ve got the gist of it.Most likely, you can avoid imperative code in your case. Also you don’t need to worry about transactions inside the main graph 99% of the time. If you stick with the imperative approach, you might consider assigning your newly created floor to a variable and adding that to a list, so that you can return the list of floors instead of just the index.

Dan did you ever figure this one out?

I am running into a similar issue except that the below code block worked for me until I closed and reopened the revit file now I can’t get it to draw the floor areas.

 

dynamo_codeblock_floor outline

bump…

figured this out for those looking the in future the variable used for the curves needs to be declared to match the overall list dimension. So in my case it had to be c:var not c:var.

 

Capture_2