# Nodes into code block

**URL:** <https://forum.dynamobim.com/t/nodes-into-code-block/76832>\
**Category:** Revit\
**Tags:** revit, codeblock, dynamo\
**Created:** [May 23, 2022, 7:42pm UTC](https://forum.dynamobim.com/t/nodes-into-code-block/76832 "2022-05-23T19:42:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![glodwajz](https://avatars.discourse-cdn.com/v4/letter/g/7cd45c/32.png) [@glodwajz](https://forum.dynamobim.com/u/glodwajz)\
**Post date:** [May 23, 2022, 7:42pm UTC](https://forum.dynamobim.com/t/nodes-into-code-block/76832/1 "2022-05-23T19:42:14Z")

</div>

Hello, I’m beginner in Dynamo and I created a rather long code. I would like to move the nodes into code blocks. I often get this kind of error. Everything works in one place and don’t work in another. I don’t understand why, can you help me?

 ![forum1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/d/1d033dd81e02d5d2134df4e9ed74358182bec645.jpeg)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 23, 2022, 7:58pm UTC](https://forum.dynamobim.com/t/nodes-into-code-block/76832/2 "2022-05-23T19:58:28Z")

</div>

@glodwajz , hi

Whats the aim of your exercise ? Block to code is practical when later on people use it in player, because every input in a block is not accessable via DPlayerInterface. some shortcuts via designscript are very handy…

KR

Andreas

---

<div class="post-metadata">

**Author:** ![glodwajz](https://avatars.discourse-cdn.com/v4/letter/g/7cd45c/32.png) [@glodwajz](https://forum.dynamobim.com/u/glodwajz)\
**Post date:** [May 23, 2022, 8:11pm UTC](https://forum.dynamobim.com/t/nodes-into-code-block/76832/3 "2022-05-23T20:11:27Z")

</div>

@Draxl_Andreas Hi, thanks for your reply.  
The aim is to practice new coding techniques. Dynamo it’s a new hobby after work 😀

As far as I understand the problem is that DSCore is added to the input and I don’t know how to avoid it.

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 23, 2022, 8:18pm UTC](https://forum.dynamobim.com/t/nodes-into-code-block/76832/4 "2022-05-23T20:18:29Z")

</div>

```auto
Count(x); //input Elements
List.Shuffle(x);
0..Count(x);
x.Parameters[0];
x.Faces;
x.Area; // get area of a surface
x+""; //convert to string
x+0.0; // convert Int to Double
x.Name; //get Type Name
x[23];v//Index at
x[0][3]; // get item in list of a list

```

a.s.o

Operators:

```auto
x == y;
x != y;

```

a.s.o.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [May 23, 2022, 8:30pm UTC](https://forum.dynamobim.com/t/nodes-into-code-block/76832/5 "2022-05-23T20:30:20Z")

</div>

Did you use Node to Code to get the code block? That’s always the best place to start.

If you start typing out the main method you should get intellisense suggestions (most of the time) for the specific namespace if it’s needed. You typically only need to go back as far as necessary if you have DLLs with duplicate libraries. This is why your previous code block has some methods called with the main namespace and others back to `DSCore`. You likely have other packages with `List` and `String` namespaces, so you have to specify the core Dynamo versions.
