Tuesday 2 October 2012

Creating a 3D View

In my previous post, I explained that I was having trouble with creating a 3D view as I needed the viewfamilytypeid of the 3D view, which I believe can be different for each project, I figured out that I needed to create a collection of the viewFamilyTypes within the project and go through this until I found the ThreeDimensional viewfamily, so here is how I did it:


Using tx As New Transaction(doc)
            tx.Start("Create 3D View")
            Dim ThreeDViews As ICollection(Of Autodesk.Revit.DB.Element) = coll.OfClass(GetType(ViewFamilyType)).ToElements()
            For Each VFT As ViewFamilyType In ThreeDViews
                If VFT.ViewFamily = ViewFamily.ThreeDimensional Then
                    Dim ThreeDView As ViewFamilyType = VFT
                    Dim view3D As View3D = view3D.CreateIsometric(doc, ThreeDView.Id)
                    view3D.Name = "Drew's QTO Export View"
                    tx.Commit()
                    tx.Dispose()
                    uidoc.ActiveView = view3D
                End If
            Next
        End Using

Seems to work, so now to figure out how to isolate a category in the new view.... anyone have an idea?

1 comment: