Coding Archive

Quickly obtain every file name in a directory with C#

A quick post today showing how we can obtain the file name for every file in a given directory using C#. This might be useful for any kit where reading every file, or every kind of file in a directory is needed – e.g. reading in various data files. In this weeks research work, I

How to stop a Grasshopper component in the middle of calculations

Moving away from the recent work in NodeJS back to Grasshopper has brought me onto a sore point with the majority of calculations I try to perform. Most of my work requires some intense spatial analysis but can take a rather long time to complete. Sometimes I connect incorrect data by mistake and calculations try

How to use sockets to send data from a C# application to a server/webpage

Continuing the current them of working with NodeJS and sockets before I go on holiday for a couple of weeks, this post is going to look at how we can send data from a C# application to a server/webpage using Javascript and NodeJS. Previously in this theme we’ve looked at using NodeJS and Socket.IO to

Using sockets to communicate between Javascript and C# with NodeJS

Previously, we looked at how to create a simple chat application between two web clients using NodeJS and sockets. Those that know me however, know that web development is not my preferred role anymore (not since the days of DW4N, MP101 and my pet project Lobo Malo anyway), so the work in Javascript and NodeJS

How to prevent multiple instances of a Grasshopper component being added to the canvas

Grasshopper components typically have the ability to be added to the canvas multiple times to allow different calculations to be performed depending on what it is your Grasshopper document is doing. However, there may occasionally be a need for your component to only be allowed on the canvas once. There could be many reasons for

How to stop specific outputs of a Grasshopper component from displaying results automatically

In this previous post, a way to stop a component from automatically displaying results on calculation was shown. This put the onus of previewing results directly onto the user. However, there may be a time when you wish for the user to view some results, but not all of them. For example, maybe you have

How to fix the ‘Common Language Runtime was unable to set the breakpoint’ error in Visual Studio projects

When you have multiple projects which link together, it can be handy to have them open in Visual Studio to debug through or work on them. This is especially true if you’re using libraries which contain common code across projects. That is the purpose of a DLL after all (or static library), to provide common

How to obtain minimum and maximum values from lists in Grasshopper – Version 2

In this previous post I showed the ways in which we can obtain the minimum and maximum values from lists of numbers in Grasshopper. I presented three solutions, using native Grasshopper components (with unintuitive naming), building your own using a C# script, or using a component which I offered for download. Since then, I found

How to add custom User Data to Rhino Objects

Objects in Rhino (the 3D modelling software, not the organs of the animal) have the option to attach custom user data that you may wish to share across tools. This might be of particular use in Grasshopper, enabling you to send one piece of geometry down the wires with custom data attached, rather than having

How to stop components from automatically displaying results in Grasshopper

When you run a component in Grasshopper, if there are outputs associated to it, the outputs will be visualised in Rhino without you needing to do much. This is part of the ‘preview’ feature of a component, but sometimes, you might not want the users to automatically see the output. For example, if you have