Example #1
0
        // OnViewBegin marks the beginning of a 3D view to be exported.
        public RenderNodeAction OnViewBegin(
            ViewNode InViewNode             // render node associated with the 3D view
            )
        {
            // Set the level of detail when tessellating faces (between -1 and 15).
            InViewNode.LevelOfDetail = LevelOfTessellation;

            // Initialize the world transform for the 3D view being processed.
            WorldTransformStack.Push(Transform.Identity);

            // Create an empty Datasmith scene.
            if (DirectLink != null)
            {
                DirectLink.OnBeginExport();
                DatasmithScene = DirectLink.DatasmithScene;
            }
            else
            {
                DatasmithScene = new FDatasmithFacadeScene(HOST_NAME, VENDOR_NAME, PRODUCT_NAME, ProductVersion);
            }

            DatasmithScene.PreExport();

            View3D ViewToExport = RevitDocument.GetElement(InViewNode.ViewId) as View3D;

            if (DatasmithFilePaths != null && !DatasmithFilePaths.TryGetValue(ViewToExport.Id, out CurrentDatasmithFilePath))
            {
                return(RenderNodeAction.Skip);                // TODO log error?
            }

            // Keep track of the active Revit document being exported.
            PushDocument(RevitDocument);

            // Add a new camera actor to the Datasmith scene for the 3D view camera.
            AddCameraActor(ViewToExport, InViewNode.GetCameraInfo());

            // We want to export the 3D view.
            return(RenderNodeAction.Proceed);
        }