Welcome to Aydimir’s Blog

Engineer.

Founder of AYDrafting.

Sharing Civil and Software Engineering insights I find interesting.

If it involves Municipal Infrastructure and calls for Automation — I’m your guy.

Subscribe to my channels to follow the journey:

C# + Revit API: Lesson 6 - `if` Statements

Pseudocode try { try to do this; } catch { if try gets exception, rollback and do this; } Exceptions Exceptions come in many forms and Revit API Docs typically specifies the types of Exceptions we can catch for its methods. There are also system type exceptions. catch // Exception as "e" to print the error { To catch a specific exceptions, catch as e; } catch { To catch all exceptions, do this; // but better to catch specific exceptions, // otherwise you will catch all necessary and unecessary exceptions. } finally { To run a final code regardless of outcome; } Use Don’t Abuse When you first begin using languages, try statements seem great - you can write code, and if you make a mistake your code can continue. THIS IS WRONG! ...

August 8, 2025 · 2 min

C# + Revit API: Lesson 6 - `if` Statements

if // Condition { run if condition is true; } else // If we have no false outcome -> we can skip 'else' branch altogether { run if condition is false; } else if Statement if // Condition { run if condition is true; } else if // Condition { run if there are more conditions; } else // If we have no false outcome -> we can skip 'else' branch altogether { run if condition is false; } Shorthand if Statements value = condition?then:else; Nearly always used for quickly setting another variable to one of two possibilities, using a conditional outcome. Only used if it’s a simple one liner task. ...

August 6, 2025 · 2 min

C# + Revit API: Lesson 5 - Core C# Statements

They control logic and flow in our tools. We will have a good understanding of core statements we can use to build Revit Add-ins. Logical Operators x == y => true if x is equal to y x != y => true if x is not equal to y x > y => true if x is greater than y x < y => true if x is less than y x >= y => true if x greater than or equals to y x <= y => true if x less than or equals to y ...

August 6, 2025 · 1 min

C# + Revit API: Lesson 3 - Fundamental Types of Data in C#

Boolean bool true (1) false (0) Integer int Whole number: 1, 2, 3, etc. Numbers come in different formats but by default they are signable (can be negative). Typically, they use 32 bits based. Double double Decimal number: 0.0, 1.5, 6.592, -5.00, etc. Doubles use 64 bits, and are more common than floats (which use half - 32 bits). In Revit you will typically work with int and double. Characters char ‘a’, ‘b’, ‘c’, etc. ...

August 6, 2025 · 4 min

C# + Revit API: Lesson 2 - Bits & Bytes, ASCII Table, Pointers & Structs - Programming 101

I suggest taking CS50 Course to understand the basics of Programming True & False 0 and 1 Base 2 numbering system 1 0 1 x x x 4 2 1 = 5 In other words: 2 2 2 x x x 2 1 0 4 2 1 = 5 1 0 1 We call these bits Eight bits = 1 byte Memory is addressed into bytes ASCII Tables bring meaning to what various bytes represent: ASCII 48 = 0 (00) 110000 1 * 2^4 = 16 1 * 2^5 = 32 16 + 32 = 48 48 = 0 (in ASCII Table) Pointers = Structs (in C) Pointers are hexadecimal based values that identify an address in computer memory. ...

August 6, 2025 · 4 min

C# + Revit API: Lesson 1 — A Simple Walkthrough of the Command

This post explains one concrete command—line by line—so a beginner can follow without extra abstractions. What this command does when you click your add-in button: Tries to create a sheet (using an invalid title block on purpose → shows how error handling works). Collects up to 10 existing sheets and formats their numbers/names. Displays the result in a WPF dialog via a ViewModel. ✅ This article focuses only on the command. It assumes you’ve already wired a ribbon button (and .addin) that triggers StartupCommand. ...

August 6, 2025 · 4 min

C# + Revit API: Lesson 0

Why C#? Scalability Start with: Install Visual Studio 2022 Community Install .NET SDKs (.NET4.8 & .NET8) Install Nice3Point Templates Solution Start a solution / project Create a new project Choose the Revit Addin (Nic3Point) Template Configure your new project Name of the project Location Solution Name - same as project name (it’s a folder name that holds many projects) Additional Information Add-in type -> Application User Interface -> None IoC -> Disabled Serilog support -> unchecked Explore Visual Studio Properties & Solution Explorer (Project Browser in Revit) Error & Output CSProj -> Preconfigured up to Revit v.2025 .addin -> Change GUID (The rest we will change later) Application Class: Tells your addin how to begin and how to finish when Revit opens and closes. Class: External Application Method: OnStartup() Will run “Create Ribbon()” Creates a Panel Adds a PushButton to that Panel With 2 Icons Our Application OnStartup When it begins, it calls a Function “CreateRibbon()” And CreateRibbon is a defined function below that: Creates a panel This is possible due to pre-configured Revit API that we are using CreatePanel - is a pre-defined method under Revit API that, you guessed it, Creates a Panel in Revit. Creates a button Same for the Button AddPushButton Method in Revit API - Creates a button Commands Folder Core Code Currently: Task Dialog - Shows the name of the addin ExternalCommand, but we should use IExternalCommand This is the part that writes the logic for your button Once you click the button, whatever is under Commands Folder connected to the button will be executed. If you change the TaskDialog.Show(Document.Title, “Hello World”); Once you press the button in Revit it would show “Hello World” Resources: Icons Everything is saved in windows explorer Configurations: Debug and Release Per Revit Version from R20 to R25 References: Under: This PC > Windows (C:) > Program Files > Autodesk > Revit [2025]. DLL Files that you can reference to your project to build something. You could even add an excel package to work with Excel, will do that later. Build and test the first plugin Build the solution by clicking on Run (Play Button) next to Any CPU. Lauches Revit (Version that you pre-configured) Always Load your Addin What happened behind the scenes: VS2022 Added the DLL file and the .addin file into the right folder and launched Revit version that you specified with the Plugin loaded into Revit. That became possible due to preconfigured Visual Studio Nic3Point Template that you ran earlier. Everything is already set and pathed for you for the ease of starting and launching plugins. Go to New Project Find your new panel in the panel tabs on the top of Revit User Interface. Find your Addin / Plugin Click on it And you will get a message with the name of your Tool. Stop Debug Closes Revit & Debug Mode

August 6, 2025 · 3 min