问题描述:

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

};

网友答案:

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
相关阅读:
Top