0

I have not been able to see how to change a view family type to a different view family name... For example, I have "Detail Views (Detail)", which is the default location in the browser it places a new ViewSection.CreateDetail section. But I want to place the view in another browser location I've created, called "Detail Views (Beam Top Detail Views)".

What I've tried is section.get_Parameter(BuiltInParameter.VIEW_TYPE), which gives me the name it has used, but it will not let me follow that up with .Set(NewViewName) (same transaction). Is there a way to set it directly during the CreateDetail entry, or do I have to run a separate transaction looking for all views of a given pattern, and change the setting there?

arserbin3
  • 6,010
  • 8
  • 36
  • 52
KeachyPeen
  • 147
  • 2
  • 13

1 Answers1

1

When creating the detail you use the ElementId for the correct viewFamilyTypeId for "Detail Views (Beam Top Detail Views)".

Here's a link that might help you from Jeremy Tammik's blog on thebuildingcoder.typepad.com

The Revit 2014 SDK has sample code for ViewSection.CreateDetail method, which you can download on Autodesk's website, if you don't want to install it from the install disk.

ViewFamilyType vt = new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType))
    .Where(q => q.Name == "Detail Views (Beam Top Detail Views)")
    .First() as ViewFamilyType;
ElementId DetailViewId = vt.Id;
ViewSection newDetail = ViewSection.CreateDetail(document, DetailViewId, box);

If you'd like to change the ViewFamilyType after the view is created, this can be done using: newDetail.ChangeTypeId(DetailViewId);

  • Thanks......your suggestion was very helpful, although the string "Beam Top Detail Views" is the value I had to look for (put in parentheses automatically, with prefix of default "Detail View"). The next thing I have to code is creating new "Detail Views" -- which I assume I have to copy, probably from the default type. – KeachyPeen May 13 '14 at 18:23
  • Note also that if the ViewFamilyType q.name result is unpopulated, the addition of the .First() code causes a failure.....there have to be members of that ViewFamilyType, even if it has been created. I'll have to seek a solution that works for the first view created after the ViewFamilyType has been created. – KeachyPeen May 13 '14 at 19:32