0

I am trying to export a 3d Revit model family image for a thumbnail using the Revit API. I have tried to turn on the model edges so that they are displayed as darker lines and I have tried to turn on anti-aliasing so that lines are smoothed. I realise it is probably hopeless to switch on the shadows as this option isn't available in a family doc.
I have exhausted all the image export options properties. The code below has the export image options and the enumerated Revit API properties I have managed to set so far.

    if (view3D != null)
            {
                views.Add(view3D.Id);
                var graphicDisplayOptions = view3D.get_Parameter(BuiltInParameter.MODEL_GRAPHICS_STYLE);
                // Settings for shaded with edges
                graphicDisplayOptions.Set(3);

                var detailLevelOptions = view3D.get_Parameter(BuiltInParameter.VIEW_DETAIL_LEVEL);
                //Settings for view detail, 3 = fine, 2=med, 1=coarse
                detailLevelOptions.Set(3);

            }
        }
        catch (Autodesk.Revit.Exceptions.InvalidOperationException)
        {

        }

        var ieo = new ImageExportOptions
        {
            //Export image file configuration settings
            FilePath = ImageFamModelFileName,
            FitDirection = FitDirectionType.Horizontal,
            HLRandWFViewsFileType = ImageFileType.BMP,
            ShadowViewsFileType = ImageFileType.BMP,
            ImageResolution = ImageResolution.DPI_600,
            ShouldCreateWebSite = false
        };

1 Answers1

0

At this blog post there is a test case for Family documents and the View, please take a look. Below is a piece of it.

#if !VERSION2014
    var direction = new XYZ(-1, 1, -1);
    var view3D = doc.IsFamilyDocument
      ? doc.FamilyCreate.NewView3D(direction)
      : doc.Create.NewView3D(direction);
#else
    var collector = new FilteredElementCollector(
      doc );

    var viewFamilyType = collector
      .OfClass( typeof( ViewFamilyType ) )
      .OfType<ViewFamilyType>()
      .FirstOrDefault( x =>
        x.ViewFamily == ViewFamily.ThreeDimensional );

    var view3D = ( viewFamilyType != null )
      ? View3D.CreateIsometric( doc, viewFamilyType.Id )
      : null;

#endif // VERSION2014
Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
  • Thanx Augusto, I will leave a query there however the post doesn't discuss how to turn on the family doc, families edges nor anti-aliasing. The other issue is that zoom to fit crunches the export images so that they appear to be furniture, specialty equipment from a planet of two earth gravities. – frankjock halliday Aug 13 '15 at 10:56
  • 1
    GetViewDisplayModel() and activeview.SetViewDisplayModel(vdm) i think have the option of vdm.SmoothEdges = true; However I am getting an error. The silhouette line style id is not a valid line style to apply to the view. Parameter name: viewDisplayModel – frankjock halliday Aug 14 '15 at 10:45