Is it possible to get the View Type of view through revit api?

python

#1

Hello, I’m writing a script which basically duplicates a full sheet from one ‘template’ assembly to another assembly (without any sheets or views previously made). When running

AssemblyViewUtils.CreateDetailSection(doc, assembly.Id, AssemblyDetailViewOrientation.SetThisValue)

it requests the assembly detail view orientation (i.e. Elevation Front, Elevation Top, DetailSectionB, etc.).

Is it at all possible to get this data from another viewport? I’ve tried

view.ViewType

and a few others but no luck. Any guidance would be greatly appreciated!


#2

have you seen those?

http://forums.autodesk.com/t5/revit-api-forum/create-sheet-from-assemblyinstance/td-p/7649443


#3

I did come across that while searching for an answer, but, unless I’m missing something, that doesn’t retrieve the AssemblyDetailViewOrientation from a view?


#4

Well post your work so far, so we have something to work with, and preferable also the needed sample files.


#5

I really just want to know how to get the AssemblyDetailViewOrientation of a view that already exists.

When you create a view (for instance, an elevation front view) in revit through the api you use this function:

AssemblyViewUtils.CreateDetailSection(doc, assembly.Id, AssemblyDetailViewOrientation.ElevationFront)

Once you’ve created this view, how could you possibly tell what that value is? (Aside from the name of the view which by default would be “Elevation Front”)

I don’t think any code or samples should be required to answer this, it’s simply a question regarding access to a setting within the method.


#6

Have you tried passing the view.ViewDirection of the view you want to copy from? Haven’t tested this myself, but I imagine it’s looking for a vector.


#7

I think I may end up having to work with that. The tricky bit is that I’ve written another script which re-orients the assembly origin to be in the direction of the wall (which the assembly is based upon) So I suppose I’ll have to modify this script to categorize the view based on the relationship between view direction and the assemblies orientation.

Thanks for the idea!


#8

Just an fyi, the AssemblyDetailViewOrientation doesn’t pull in a vector, it takes in pre-defined objects from a revit api enumerator.

I’m running into the issue of telling the difference between an ElevationTop view and a Horizontal view. Technically they are the exact same but they are created differently. I still can’t believe there’s no way to retrieve this info from a view and yet I haven’t heard of any possible means to do so.