Thursday, 28 February 2019

Revit Server Files

Recently I was setting up a dataset for analysis. The files were placed on a Revit server and later I noticed I should have saved them with a different file name. 

The save way and recommended way of doing this is by opening the file and saving it as a new central file on the Revit server, but that is also tedious and no fun.

Since my projects aren't live and basically I don't get in trouble for messing up my own files let's turn the safeties off and go free riding.

Disclaimer Do not do this at home work. It is only tested on my own configuration! From here on you are responsible for what you do with this information. 

If you go to your Revit server and where it save the files:
Notice the path and you see this thing that looks like a folder? If you rename this to for example this below:

Press F5 on your RevitServerAdmin, you will see it updates to the new names

The real test is ofcourse, does it open?
  1. Yes it does! (All of them are loadable)
  2. Do the links load?
  3. Yes they do! No reloading links or pointing to new files necessary.
  4. Do the files synchronise?
  5. Yes they do.

See the admin console below


Is this a good idea?

Probably not! But it was nice and quick for me though!




Monday, 18 February 2019

Numbers to Strings

I often run into the situation in Dynamo that I need to convert numbers to strings. Most of the time I end up with strings containing many decimals like .000000

Of course I can fix that with dynamo nodes but one python script node is handier. The only thing is I can't get the system locale working atm.

# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

"""
import locale
langlocale = locale.getdefaultlocale()[0]
locale.setlocale(locale.LC_ALL, langlocale)
dp = locale.localeconv()['decimal_point']
"""

if isinstance(IN[0], list):
    numbers = (IN[0])
else:
    numbers = [(IN[0])]

output = []

for n in numbers:
    tmp = str(n)
    # You might have to change the splitting character to work with your system regional settings
    splist = tmp.split(".")[0] # now the splitter is hard coded
    # splist = tmp.split(dp)[0] only use this line if locale is working     
    # split generates two items in a list this one gets the first
    output.append(splist)

OUT = output