Happy New Year 2023!
Topics to begin the new year:
CultureInfoChanger
IFamilyLoadOptions
After moving to the new Mac and switching to Visual Studio 2022, I also needed to update my C# source code colouriser.
The last time was the Copy as HTML update in November 2021 using the Productivity Power Tools 2017/2019.
This time around, I switched to a new extension, Copy as HTML 2022 by Tim Mathias:
Copy selected code in HTML format while preserving syntax highlighting, indentation, background colour and font. Options: Max Height, Title Block, Alternating Lines, Line Numbers, Wrap Lines, Un-indent, Background Colour, Class Names. Converts RTF, outputted by VS, into HTML.
You can see the results of using the new code colouriser immediately below to format the CultureInfoChanger
sample.
I also updated The Building Coder samples for VS 2022, in release 2023.1.153.5.
Luiz Henrique @ricaun Cassettari implemented a nice workaround to solve the problem raised in the Revit API discussion forum thread being unable to size MEP connectors with Revit 2021.
Ekaterina.kudelina.beam noticed that switching the CurrentCulture
from de-DE
to en-EN
makes it possible to change connector size in a project. Ricaun made use of this observation to implement a CultureInfoChanger
derived from IDisposable
that can be used to wrap the setting, temporarily changing CultureInfo
to English and resetting it back to the original when disposed:
The code to use it could be something like this.
An extension should be perfect in this case, some SetRadius
, SetWidth
, and SetHeight
.
The source code for the full extension with a command sample is provided in Ricaun's ConnectorSetValueExtension.cs gist:
Connector Set Value Extension for Revit to 'fix' the ArgumentOutOfRangeException when setting Radius, Width, and Height.
Many thanks to Luiz Henrique for this nice solution!
Luiz Henrique also pointed out an interesting AU class on journal files in the thread on journal step by step:
Question: Any idea how to run a journal file step by step to debug a problem running it?
Answer: Nope. It is all or nothing. For more info, please check The Building Coder articles in the Journal category.
You could look at the Autodesk University class on Revit Journal files: they aren’t just for Autodesk support.
Before Christmas, I had a nice and fruitful conversation
with @Eatrevitpoopcad
on bulk reloading families in a template from a slightly different location,
helping to get started working on a macro to automate the execution of LoadFamily
with an IFamilyLoadOptions
handler and saving a large amount of manual labour.
Chuong Ho shared some exciting news on IronPython3, APS and RPS.
RPS is the beloved RevitPythonShell that adds an IronPython interpreter to Revit and lets you to write plugins for Revit in Python. Even better, it provides you with an interactive shell that lets you see the results of your code as you type it. This is great for exploring the Revit API while writing your Revit Addins, especially in combination with the RevitLookup database exploration tool.
APS is the CADPythonShell, a fork of RevitPythonShell, bringing an IronPython interpreter to AutoCAD as well.
Chuong Ho announced the advent of IronPython 3.4:
I'm very excited because last week the IronPython3 team released 3.4.0. Today, I also quickly brought them to CadPythonShell and RevitPythonShell, which is a great expectation of Python-friendly engineers. Python 3.4 is a big upgrade for engineers to get the most out of the new features that Python brings.
The RevitPythonShell enhancement was submitted, discussed and merged in the PR 136 – support IronPython3.4.
Many thanks to Chuong Ho for implementing this!
Ehsan Iran Nejad added in his comment below:
We added IronPython3 to pyRevit work-in-progress as well...