# \#codeblock

**URL:** https://forum.dynamobim.com/tag/codeblock/24.md

[Latest](https://forum.dynamobim.com/latest.md) · [Categories](https://forum.dynamobim.com/categories.md) · [Tags](https://forum.dynamobim.com/tags.md)

---

## [Syntax problem of For / While loops or Imperative block](https://forum.dynamobim.com/t/syntax-problem-of-for-while-loops-or-imperative-block/114427)

<div class="topic-metadata">

**Author:** [@ISECnico](https://forum.dynamobim.com/u/ISECnico)\
**Replies:** 5\
**Last updated:** [April 20, 2026, 7:28am UTC](https://forum.dynamobim.com/t/syntax-problem-of-for-while-loops-or-imperative-block/114427 "2026-04-20T07:28:50Z")

</div>

Hi All, My objective is to produce a correctly ordered and directed sequence of lines. The input lines have draw / selection order that is random and line directions are also inconsistent. I also input the start point …

---

## [Dynamo Script and CodeBlock](https://forum.dynamobim.com/t/dynamo-script-and-codeblock/111541)

<div class="topic-metadata">

**Author:** [@NatashaMK](https://forum.dynamobim.com/u/NatashaMK)\
**Replies:** 2\
**Last updated:** [July 30, 2025, 7:12am UTC](https://forum.dynamobim.com/t/dynamo-script-and-codeblock/111541 "2025-07-30T07:12:35Z")

</div>

I’m trying to create a Dynamo script to apply a specific color to a certain type of pipe. However, the code block I wrote doesn’t seem to be reading the pipe type names correctly — the comparison isn’t working as expecte…

---

## [Struggling with merging sublists in DesignScript in a For loop](https://forum.dynamobim.com/t/struggling-with-merging-sublists-in-designscript-in-a-for-loop/107410)

<div class="topic-metadata">

**Author:** [@trevor.clarkM88RA](https://forum.dynamobim.com/u/trevor.clarkM88RA)\
**Replies:** 4\
**Last updated:** [January 22, 2025, 5:52pm UTC](https://forum.dynamobim.com/t/struggling-with-merging-sublists-in-designscript-in-a-for-loop/107410 "2025-01-22T17:52:38Z")

</div>

I’m very new to Dynamo and have no background in coding, I appreciate everyone’s help and patience! I’m trying to write a code to help with sheeting and positioning Interior Elevations, which are typically done by the r…

---

## [Encountering 'Multiple Definitions' and 'Internal Error' with Code Block](https://forum.dynamobim.com/t/encountering-multiple-definitions-and-internal-error-with-code-block/106880)

<div class="topic-metadata">

**Author:** [@harrieez43](https://forum.dynamobim.com/u/harrieez43)\
**Replies:** 2\
**Last updated:** [December 31, 2024, 12:38am UTC](https://forum.dynamobim.com/t/encountering-multiple-definitions-and-internal-error-with-code-block/106880 "2024-12-31T00:38:41Z")

</div>

I recently upgraded my Civil 3D from the 2024 version to 2025 and am now using Dynamo version 3.3.0. I have encountered an issue while trying to create a Point.ByCoordinates script using a Code Block. It runs with warnin…

---

## [Code Block Question](https://forum.dynamobim.com/t/code-block-question/103397)

<div class="topic-metadata">

**Author:** [@Cesar\_Tolentino](https://forum.dynamobim.com/u/Cesar_Tolentino)\
**Replies:** 3\
**Last updated:** [August 9, 2024, 1:27am UTC](https://forum.dynamobim.com/t/code-block-question/103397 "2024-08-09T01:27:28Z")

</div>

Quick question to all. Am I doing it wrong? I wanted to find names of parameter in a family. If I do a string in a code block, it works. But what if i wanted to look for several words? Sometimes my code works, but this…

---

## [Code Block working with List](https://forum.dynamobim.com/t/code-block-working-with-list/97906)

<div class="topic-metadata">

**Author:** [@Ar.vxv](https://forum.dynamobim.com/u/Ar.vxv)\
**Replies:** 8\
**Last updated:** [February 13, 2024, 2:58am UTC](https://forum.dynamobim.com/t/code-block-working-with-list/97906 "2024-02-13T02:58:11Z")

</div>

Hi! I am trying to use the “IF” function to filter index values in an input list. I’m quite new to Dynamo. I look forward to receiving suggestions or instructions to fix it. Thanks!

---

## [Defining global variable in code block](https://forum.dynamobim.com/t/defining-global-variable-in-code-block/97092)

<div class="topic-metadata">

**Author:** [@Gauzdx](https://forum.dynamobim.com/u/Gauzdx)\
**Replies:** 4\
**Last updated:** [January 12, 2024, 8:09pm UTC](https://forum.dynamobim.com/t/defining-global-variable-in-code-block/97092 "2024-01-12T20:09:46Z")

</div>

I want to define a global variable in a code block and use/call it outside the scope of that node. For example: If I pass x as parameter in func(), then code block will ask x for the parameter which I don’t want it t…

---

## [Code block designscript autocomplete issues](https://forum.dynamobim.com/t/code-block-designscript-autocomplete-issues/93806)

<div class="topic-metadata">

**Author:** [@Brian\_Fraumeni](https://forum.dynamobim.com/u/Brian_Fraumeni)\
**Replies:** 4\
**Last updated:** [September 16, 2023, 12:26am UTC](https://forum.dynamobim.com/t/code-block-designscript-autocomplete-issues/93806 "2023-09-16T00:26:42Z")

</div>

Is there a way to turn off autocomplete for code block design script? In Dynamo Revit: 2.13.1.3891 the DS autocomplete jumps too far and is substantially incomplete in the amount of predictive options. For example: El…

---

## [With which node is it possible to identify a block specifically from the cad link?](https://forum.dynamobim.com/t/with-which-node-is-it-possible-to-identify-a-block-specifically-from-the-cad-link/90283)

<div class="topic-metadata">

**Author:** [@cintiamiranda21](https://forum.dynamobim.com/u/cintiamiranda21)\
**Replies:** 30\
**Last updated:** [June 10, 2023, 9:20pm UTC](https://forum.dynamobim.com/t/with-which-node-is-it-possible-to-identify-a-block-specifically-from-the-cad-link/90283 "2023-06-10T21:20:02Z")

</div>

Can anyone tell me with which node (perhaps GeniusLoci) it is possible to separate, or better identify a block specifically from the cad link? That is, in the linked file I have several blocks, however I want to identify…

---

## [Help with Code Block syntax](https://forum.dynamobim.com/t/help-with-code-block-syntax/86290)

<div class="topic-metadata">

**Author:** [@RevitRobot](https://forum.dynamobim.com/u/RevitRobot)\
**Replies:** 9\
**Last updated:** [February 17, 2023, 2:52pm UTC](https://forum.dynamobim.com/t/help-with-code-block-syntax/86290 "2023-02-17T14:52:59Z")

</div>

Hey quick question. How can I combine lacing of a sequence within a code block? The above works, but how can I make the below work that the lacing is not lost and I don’t have to make referals through xlist and ylis…

---

## [Problem with For Loop inside a Code Block](https://forum.dynamobim.com/t/problem-with-for-loop-inside-a-code-block/82729)

<div class="topic-metadata">

**Author:** [@DavidMena](https://forum.dynamobim.com/u/DavidMena)\
**Replies:** 5\
**Last updated:** [November 4, 2022, 5:24pm UTC](https://forum.dynamobim.com/t/problem-with-for-loop-inside-a-code-block/82729 "2022-11-04T17:24:42Z")

</div>

Hi everyone. I’m having trouble trying to write a simple For Loop inside a Code Block. As seen in the image I have a collection of solids representing exterior areas each one. And a definition for my Green color. What…

---

## [Get parameter values when nulls are present WITHOUT warnings](https://forum.dynamobim.com/t/get-parameter-values-when-nulls-are-present-without-warnings/80875)

<div class="topic-metadata">

**Author:** [@ehall](https://forum.dynamobim.com/u/ehall)\
**Replies:** 10\
**Last updated:** [September 12, 2022, 4:41pm UTC](https://forum.dynamobim.com/t/get-parameter-values-when-nulls-are-present-without-warnings/80875 "2022-09-12T16:41:42Z")

</div>

Given a list of space elements and nulls, I’m trying to report the space name and number (when there is a space), and some text value when there is a null. I have a code block that does exactly what I want (top right), …

---

## [New Point for every run](https://forum.dynamobim.com/t/new-point-for-every-run/80290)

<div class="topic-metadata">

**Author:** [@shahid.shaikh\_C3D](https://forum.dynamobim.com/u/shahid.shaikh_C3D)\
**Replies:** 2\
**Last updated:** [August 25, 2022, 6:12am UTC](https://forum.dynamobim.com/t/new-point-for-every-run/80290 "2022-08-25T06:12:39Z")

</div>

Hello, I am trying to find a way to create a new point (shift in some x,y) direction from existing point for each run of code. will this be possible and what can be the way to do it ? Thanks alot for all the support.

---

## [Diferent behavior for String From Object node vs Code Block](https://forum.dynamobim.com/t/diferent-behavior-for-string-from-object-node-vs-code-block/80237)

<div class="topic-metadata">

**Author:** [@gilberto.arechigaiba](https://forum.dynamobim.com/u/gilberto.arechigaiba)\
**Replies:** 6\
**Last updated:** [August 25, 2022, 6:00am UTC](https://forum.dynamobim.com/t/diferent-behavior-for-string-from-object-node-vs-code-block/80237 "2022-08-25T06:00:33Z")

</div>

Hola amigos buenas, do any of you know why String From Object gives different results in node and code block? when I use it in node it gives me a string with 6 decimals, while when I use it in code block it directly cuts…

---

## [MultipleInputForm++ & Code Block error](https://forum.dynamobim.com/t/multipleinputform-code-block-error/80233)

<div class="topic-metadata">

**Author:** [@AmirGabrielli](https://forum.dynamobim.com/u/AmirGabrielli)\
**Replies:** 12\
**Last updated:** [August 24, 2022, 9:29am UTC](https://forum.dynamobim.com/t/multipleinputform-code-block-error/80233 "2022-08-24T09:29:15Z")

</div>

Hey there. I’m trying to create a UI with Data-Shapes to place all Views on Sheets and as demonstrated in the image, the MultipleInputForm++ is not working and it gives empty list despite having the list properly working…

---

## [String from Object via codeblock](https://forum.dynamobim.com/t/string-from-object-via-codeblock/50774)

<div class="topic-metadata">

**Author:** [@martin.biras](https://forum.dynamobim.com/u/martin.biras)\
**Replies:** 6\
**Last updated:** [August 15, 2022, 7:09pm UTC](https://forum.dynamobim.com/t/string-from-object-via-codeblock/50774 "2022-08-15T19:09:29Z")

</div>

Hey guys, Is there a way to use the String from Object in the Code Block? I want to create something like this (see img) but i m trying to find tha way how to write it only via codeblock line1 = Elements.Element.…

---

## [Nodes into code block](https://forum.dynamobim.com/t/nodes-into-code-block/76832)

<div class="topic-metadata">

**Author:** [@glodwajz](https://forum.dynamobim.com/u/glodwajz)\
**Replies:** 4\
**Last updated:** [May 23, 2022, 8:30pm UTC](https://forum.dynamobim.com/t/nodes-into-code-block/76832 "2022-05-23T20:30:20Z")

</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…

---

## [Purge code block def from dynamo?](https://forum.dynamobim.com/t/purge-code-block-def-from-dynamo/75594)

<div class="topic-metadata">

**Author:** [@Bartholin](https://forum.dynamobim.com/u/Bartholin)\
**Replies:** 1\
**Last updated:** [April 19, 2022, 10:05am UTC](https://forum.dynamobim.com/t/purge-code-block-def-from-dynamo/75594 "2022-04-19T10:05:10Z")

</div>

Hi all. I am experimenting with code block definitions. I’ve revised my definition. But dynamo does not seem to update the formula. Before i used to have 3 variables, but now i only have one. Before i connected 3 li…

---

## [Convert to integer in if statement codeblock](https://forum.dynamobim.com/t/convert-to-integer-in-if-statement-codeblock/74947)

<div class="topic-metadata">

**Author:** [@crapai](https://forum.dynamobim.com/u/crapai)\
**Replies:** 5\
**Last updated:** [March 31, 2022, 4:50am UTC](https://forum.dynamobim.com/t/convert-to-integer-in-if-statement-codeblock/74947 "2022-03-31T04:50:15Z")

</div>

I’ve been trying to figure this out. I can convert doubles to integers with “x:int” or “x:int” but can’t find a way to do that in a if statement code block. Anyone know of a way to get this to work?

---

## [Feature Request: Ability to preview all outputs of a code block](https://forum.dynamobim.com/t/feature-request-ability-to-preview-all-outputs-of-a-code-block/69689)

<div class="topic-metadata">

**Author:** [@Frank\_Loftus](https://forum.dynamobim.com/u/Frank_Loftus)\
**Replies:** 11\
**Last updated:** [October 27, 2021, 10:01pm UTC](https://forum.dynamobim.com/t/feature-request-ability-to-preview-all-outputs-of-a-code-block/69689 "2021-10-27T22:01:40Z")

</div>

When writing designscript, I often find myself creating large code blocks with many outputs. In order to properly debug my graph, I need to see what is happening to data as it flows through the code block, but the node p…

---

## [Oops, I broke Dynamo's conditional logic engine](https://forum.dynamobim.com/t/oops-i-broke-dynamos-conditional-logic-engine/69339)

<div class="topic-metadata">

**Author:** [@haganjake2](https://forum.dynamobim.com/u/haganjake2)\
**Replies:** 5\
**Last updated:** [October 17, 2021, 12:09am UTC](https://forum.dynamobim.com/t/oops-i-broke-dynamos-conditional-logic-engine/69339 "2021-10-17T00:09:19Z")

</div>

Not so much of a problem that requires a solution this one, just wanted to share something bizarre that I just discovered whilst trying to feed a range through an OOTB IF node: Anyone ever seen this before? Is this t…

---

## [If Then code block doesn't work with substring](https://forum.dynamobim.com/t/if-then-code-block-doesnt-work-with-substring/64533)

<div class="topic-metadata">

**Author:** [@SiBj.Opt](https://forum.dynamobim.com/u/SiBj.Opt)\
**Replies:** 4\
**Last updated:** [May 31, 2021, 7:42am UTC](https://forum.dynamobim.com/t/if-then-code-block-doesnt-work-with-substring/64533 "2021-05-31T07:42:26Z")

</div>

Hi, could anyone explain why my code block is behaving the way it is? The two code block is identical and input in both of them is a list so why is the output different and how do i solve this?

---

## [Equation inside Code Block](https://forum.dynamobim.com/t/equation-inside-code-block/64292)

<div class="topic-metadata">

**Author:** [@alaafarhat](https://forum.dynamobim.com/u/alaafarhat)\
**Replies:** 6\
**Last updated:** [May 24, 2021, 7:17pm UTC](https://forum.dynamobim.com/t/equation-inside-code-block/64292 "2021-05-24T19:17:00Z")

</div>

Guys, please Why & How do we add this number as an initial in the code Block

---

## [How can I use While of Code Bblock](https://forum.dynamobim.com/t/how-can-i-use-while-of-code-bblock/63067)

<div class="topic-metadata">

**Author:** [@lwr4026](https://forum.dynamobim.com/u/lwr4026)\
**Replies:** 1\
**Last updated:** [April 20, 2021, 8:41am UTC](https://forum.dynamobim.com/t/how-can-i-use-while-of-code-bblock/63067 "2021-04-20T08:41:40Z")

</div>

I don’t know how can I use While of Code Block Please give me a sample code…

---

## [Code Block if statement error on non-executed portion of statement](https://forum.dynamobim.com/t/code-block-if-statement-error-on-non-executed-portion-of-statement/59923)

<div class="topic-metadata">

**Author:** [@ehall](https://forum.dynamobim.com/u/ehall)\
**Replies:** 2\
**Last updated:** [January 31, 2021, 7:41pm UTC](https://forum.dynamobim.com/t/code-block-if-statement-error-on-non-executed-portion-of-statement/59923 "2021-01-31T19:41:47Z")

</div>

Forgive me if this has already been discussed. I look but couldn’t find anything similar. I’ve had several if statements in code blocks that have been giving me warnings that only pertain to the portion of the statement…

---

## [Dynamo code block function return strange things](https://forum.dynamobim.com/t/dynamo-code-block-function-return-strange-things/58986)

<div class="topic-metadata">

**Author:** [@wslee94577P2VT](https://forum.dynamobim.com/u/wslee94577P2VT)\
**Replies:** 4\
**Last updated:** [January 18, 2021, 3:14am UTC](https://forum.dynamobim.com/t/dynamo-code-block-function-return-strange-things/58986 "2021-01-18T03:14:20Z")

</div>

Hi, I’m currently progress in auto rebar modeling using dynamo for my project. Cause of some reason I use pre-defined code block function for return stirrup rule by column type. I was intend to get \[-480,-780,-1080,-1…

---

## [Counting code block](https://forum.dynamobim.com/t/counting-code-block/57984)

<div class="topic-metadata">

**Author:** [@Seda](https://forum.dynamobim.com/u/Seda)\
**Replies:** 5\
**Last updated:** [December 4, 2020, 4:10pm UTC](https://forum.dynamobim.com/t/counting-code-block/57984 "2020-12-04T16:10:57Z")

</div>

Hi all, I have a question about the following problem. I have a script for counting structural piles in my Revit model. I now want to give a specific number for the first selected pile and the rest should be added up. T…

---

## [How do you use list levels in a code block?](https://forum.dynamobim.com/t/how-do-you-use-list-levels-in-a-code-block/30169)

<div class="topic-metadata">

**Author:** [@shawisrael](https://forum.dynamobim.com/u/shawisrael)\
**Replies:** 5\
**Last updated:** [November 10, 2020, 6:50am UTC](https://forum.dynamobim.com/t/how-do-you-use-list-levels-in-a-code-block/30169 "2020-11-10T06:50:43Z")

</div>

Hi All, Using the get item at index can get a bit bulky, so I often use code blocks. However, I can’t seem to get code blocks to replicate the levels function of the List.GetItemAtIndex node (see image). Do any of you …

---

## [Problem with using def function](https://forum.dynamobim.com/t/problem-with-using-def-function/57039)

<div class="topic-metadata">

**Author:** [@jj06jj](https://forum.dynamobim.com/u/jj06jj)\
**Replies:** 5\
**Last updated:** [November 9, 2020, 11:04am UTC](https://forum.dynamobim.com/t/problem-with-using-def-function/57039 "2020-11-09T11:04:11Z")

</div>

I defined it as a function, but the return value is different from the node above. Please tell me the solution. def CurveVertex(input) { curve = input; param = \[0, 1\]; pt1 = Autodesk.Curve.PointAtParameter(curv…

---

## [All Elements Of Category in a Code Block](https://forum.dynamobim.com/t/all-elements-of-category-in-a-code-block/5399)

<div class="topic-metadata">

**Author:** [@Ryan\_C](https://forum.dynamobim.com/u/Ryan_C)\
**Replies:** 13\
**Last updated:** [October 18, 2020, 8:13pm UTC](https://forum.dynamobim.com/t/all-elements-of-category-in-a-code-block/5399 "2020-10-18T20:13:52Z")

</div>

Does anyone know how to follow up the definition of a codeblock that defines categories, with the codeblock equivalent of All Elements Of Category? For instance: \[Category.ByName("OST\_Walls");\] - \["All Elements Of Cate…

[Next page](https://forum.dynamobim.com/tag/codeblock/24.md?match_all_tags=true&page=1&tags%5B%5D=codeblock)
