Preserving Materials when going from Revit to Blender

This is an alternate method of converting Revit models into Blender models. You’ll need 3DSMax. It preserves materials (somewhat), using a Max-script I had made two years ago for another (aborted) purpose.

If you’re a Revit user that owns a copy of Max and you haven’t been able to get the Bratwurst builds to work right for you, this might help.

Steps:

  • Export FBX out of Revit
  • Import FBX into Max
  • Run Script
  • Export OBJ
  • Import OBJ into Blender
  • Scale Down

Some material settings will be converted, like color and occasionally transparency. Sometimes not. But it’ll always have the material named properly at least, so fixing them in Blender will be easy.

http://i.imgur.com/AlIB2WG.jpg

I’d show my end result, but so far I’ve only done this to a model at work, and I can’t post it here. I’ll dig up some personal work at home when I get the chance and show that.

You can read more details about the max-script and download it here.

There has been work done on the FBX importer recently… I have used it to take revit into blender via fbx once i had standardised it via fbx converter… that being said i am pretty sure it doesnt bring in materials at all…

Never knew there were other people with a Revit->Max->Blender workflow. I work in infrastructure design and this would’ve saved me quite some time on a recent project. So thanks!

It didn’t for me… I was very disappointed.

Sure! I’m only messing around with the workflow. It seems like Blender’s renderer is a bit faster than the alternative (especially compared to Revit’s internal). And I’m used to it so it works out. I did a freelance gig and chose to skip modeling in Revit and just did the whole thing in Blender just so that I could use Blender’s renderer. That was fun…

I’ll get around to posting some test renders soon, I’ve just been kind of occupied lately.

Here are some images. The building in question is a Post-Modern house design by the late architect Richard B. Ferrier, as seen in “The Big Book of Small House Designs”.

I’m still not finished modeling it, but I wanted to do some more to it before posting my example.

Here it is in Revit:

Here it is in Blender, notice the two materials in the current selection:

And after a small amount of material tweaking here’s the result:

I didn’t bother to add the textures but that wouldn’t be too difficult. The idea here is to avoid having to select faces to apply materials directly. When you have several walls that contain multiple materials, that can be annoying. In larger projects, it can be impossible.

Now all you have to do is edit the materials that are already there.

This script is problematic. It’s better than nothing, but it doesn’t detect all materials and it creates multiple materials with the same name - not ideal. The FBX import, now official, is better in that multiple materials with the same name are given a number. This actually makes the situation a little worse. [edit, nevermind, it always did that, see below]

I have a new (relatively… forgot to post about it), much smaller script that does the same thing better. The old script’s original intention was to convert Architectural materials as best it could to Standard. As the versions progressed past 2011 (most of the work was done by April 2011), new Architectural material types were added. This means that for some materials, the old script fails and completely skips over them.

The new script accepts all materials and assigns a random color that you can fix later… but it still creates multiple materials with the same name. On small projects this should be ok - its the name you want, and you can fix the multiple material problem in Blender if you don’t have too many of them.

I have tested the new Blender FBX importer in the official release. Architectural materials are still completely unsupported. Just like before, Blender will simply not see the material, not even the name. If you have 3DSMax to run the script in, give my workflow a shot, and you’ll be able to work around it.

Edit/Update:

It appears I forgot my own workflow. If you don’t want multiple same-name materials as explained above, you’re still going to have to export to OBJ from Max, and avoid using Blender’s FBX importer. The 3DSMAX OBJ exporter will solve the multiple materials problem.


/*
    Material Converter by Christian Storay
    September 12th, 2013
*/

fn allMats objectsInScene objMatType index =
(   
    if index == -1 then -- IF NOT INSIDE A MULTIMAT
    (
        --remember original name
        originalName = objectsInScene.material.name
        -- change material to Standard
        objectsInScene.material = Standardmaterial ()
        --apply name and random color
        objectsInScene.material.name = originalName
        r = random 0 255
        g = random 0 255
        b = random 0 255
        objectsInScene.material.diffuse = color r g b
    )
    else -- IF INSIDE A MULTIMAT
    ( 
        --remember original name
        originalName = objectsInScene.material.materialList[index].name
        -- change material to Standard
        objectsInScene.material.materialList[index] = Standardmaterial ()
        --apply name and random color
        objectsInScene.material.materialList[index].name = originalName
        r = random 0 255
        g = random 0 255
        b = random 0 255
        objectsInScene.material.materialList[index].diffuse = color r g b
    )
)
for objInScn in geometry do 
(
    matType = objInScn.material as string -- material name and type return as string
    -- Parse Multimaterials by index and apply the same rules above
    if matchPattern matType pattern:"#Multi/Sub-Object:*" then
    (
        indexCount = 1
        for miniMats in objInScn.material.materialList do
        (
            miniMatType = miniMats as string -- this will give a name, like MaterialName:Standard
            -- evaluate in Multimat Mode
            allMats objInScn miniMatType indexCount
            indexCount = indexCount + 1
        )
    )
    else
    (
        -- evaluate
        allMats objInScn matType -1
    )
)

Save to materialconvert18.ms

edit:
scale your final model by 0.08333 (1/12) if you want 1 blender unit = 1 foot. If you don’t, and assuming you didn’t use clamp in the obj importer, 1 unit = 1 inch.

Ya know what?
Just try collada to lumion export plugin for revit, it will make your day. :wink:
Even got the right materials names.

Neat. I believe that will make my day. I’ll have to try it.

Thanks!!! This by far the best tip :wink:
I’ve been killing myself trying to get the workflow to work

[QUOTE=Juancamore01;2570957]Thanks!!! This by far the best tip :wink:
I’ve been killing myself trying to get the workflow to work[/F

FINALLY I have some workable solution:

Revit ->
Linked Revit File ->
DXF export ->
Sketchup import ->
Collada export (triangulate faces) ->
Blender import

No idea why this works, but if you link your revit model into a blank revit file, and export dxf or dwg from that second file, the file retains the material connections. Textures are not preserved, but the “shaded view” color is.

Tried with 3DX MAX 2016 and it works. Revit -> FBX -> 3DS MAX -> run script from this thread -> export FBX from MAX -> import into Blender. Materials are there.

UPDATE> But it creates one material for each object, ending up with a bunch of them :frowning:

UPDATE2> It work when exporting to .OBJ from MAX.

for revit export to obj, for best works revit “3D hologram creator” plugin
https://apps.autodesk.com/RVT/en/Detail/Index?id=2956107774852511363&appLang=en&os=Win64

One more work through - Twinmotion Exporter for Revit plugin (to fbx)
https://twinmotion.abvent.com/en/downloads/

Joins mesh by material, family ir type.
Can include textures in exported material

Thanks Edmis. This one works pretty well. I can also imagine it being pretty useful for game engines.

I never did try that collada plugin cyberjuls mentioned and now it’s a legacy download that isn’t supported anymore… so I feel a little sorry about that, but this new thing seems to work well enough.