Automating Family Catalog Thumbnail Preview

Hi,

I wanted to have all my family content to have previews set as 3D view. (15K + files.)
I was doing research on this for the past months and it was not easy to achieve due to the fact that I am C# rookie.

I came back to dynamo and started look to get at least 1 family done automatically and the attached image is how far I got. (Yeah, at this point, I am looking into doing it one by one unfortunately.)

My goal is that 1. renames the 3D view as the company catalog standard view, 2. sets the view in correct orientation and 3. save the file with the updated catalog view. (I got #1 working!)

Could you give me some hints on how to achieve this in Dynamo? I believe I combed through all commands and do not see any “save as” nodes.

Thanks much!

1 Like

Hi @robertkang26

arhci-lab has a node to “ExportImageByView” node to get you started.

1 Like

Thank you for the info.

Do you know of any way we can control below item in Dynamo?

HI,

Curious to know if this went anywhere. Looking to do the exact same thing…

Thanks.

1 Like

Hi,

I didn’t get anywhere yet. I’m not sure about others.

  • Robert.

Thanks.

Must be a way to automate this…I’ve been looking and trying different methods - journals etc, but no luck so far…

Hey, did anyone make progress on this?

I’ve managed to change the view to a 3D, close all hidden windows, save the family…
but the active view is still the floor plan!?

2 Likes

Hi Josh,

I didn’t. I will ask around though.

1 Like

Still no progress on this?

1 Like

No progress. May be faster to develop an add on.

Is there some progress on this?
Looking to do the smame thing.

Thanks

Turns out on our end we need to hire computer language specialist. Could not do it with Dynamo and downloaded packages.

DocumentPreviewSettings documentPreviewSettings = targetFamilyDocument.GetDocumentPreviewSettings();
            if (documentPreviewSettings.IsViewIdValidForPreview(targetView.Id))
            {
                documentPreviewSettings.PreviewViewId = targetView.Id;
                saveAsOptions.PreviewViewId = targetView.Id;
            }
            documentPreviewSettings.ForceViewUpdate(true);

And then when you save as the family:

targetFamilyDocument.SaveAs(familyFile, saveAsOptions);

This is done in C# above and is just an example. If you wanted that in a Dynamo node, you could always create your own or I could roll this in to my package or another package. If you wanted to swap to Python or something, knock yourself out.

From the one graph above, you would have to do the SaveAs “node” if it was created before terminating the application.

Hello, could someone help convert this script above into Python. It would be much appreciated, thank you!

Hello @karolina_kordula and welcome
here an example

import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB


clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
targetView = UnwrapElement(IN[0])
saveAsOptions = SaveAsOptions()
process = False
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

if doc.IsFamilyDocument :
	previewSetting = doc.GetDocumentPreviewSettings()
	if previewSetting.IsViewIdValidForPreview(targetView.Id):
		previewSetting.PreviewViewId = targetView.Id
		saveAsOptions.PreviewViewId = targetView.Id
		previewSetting.ForceViewUpdate(True)
		process = True
TransactionManager.Instance.TransactionTaskDone()
TransactionManager.Instance.ForceCloseTransaction()
doc.Save()
OUT = process

*Note: *
it is better to create a new topic rather than dig up an old one

2 Likes

Built up a full graph with some modified python to iterate over a list of documents found in a directory - this should add a thumbnail to every document in a given directory. As always, use at your own risk (ie: back up your stuff first).
Add thumbnail to all families in given directory.dyn (14.7 KB)

5 Likes

@c.poupin, @jacob.small Thank you so much!

1 Like