Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Show only
|
Search instead for
Did you mean:
This page has been translated for your convenience with an automatic translation service. This is not an official translation and may contain errors and inaccurate translations. Autodesk does not warrant, either expressly or implied, the accuracy, reliability or completeness of the information translated by the machine translation service and will not be liable for damages or losses caused by the trust placed in the translation service.Translate
I tried making a copy of the "Gross Building" ViewFamilyType and seems to allow it but I'm not sure where it goes.
Edit... i figured out that you can make a copy of the Area Scheme instead...
public void DuplicateAreaScheme()
{
Document doc = this.ActiveUIDocument.Document;
AreaScheme areaScheme = (from v in new FilteredElementCollector(doc).OfClass(typeof(AreaScheme)).Cast<AreaScheme>()
where v.Name == "Gross Building"
select v).First();
if (areaScheme != null)
{
using (Transaction t = new Transaction(doc, "New Area Plan Type"))
{
t.Start();
ICollection<ElementId> newElemIds = ElementTransformUtils.CopyElement(doc, areaScheme.Id, XYZ.Zero);
AreaScheme newVft = doc.GetElement(newElemIds.First()) as AreaScheme;
newVft.Name = "Plannable";
View v = ViewPlan.CreateAreaPlan(doc, newVft.Id, new ElementId(1526));
t.Commit();
}
}
else
TaskDialog.Show("Error", "areaScheme was null");
}
Thanks Micheal for the idea to use ElementTransformUtils.CopyElement to add a new AreaScheme. However, the area plans created using the new scheme don't have a default Color Scheme and the Revit UI doesn't allow adding a new color scheme (you can only duplicate an existing). Any ideas of how to create a new AreaScheme and default Color Scheme for new area plans based on that scheme?
I would imagine that it would be the same, duplicate an existing Color Scheme element using the same method. Then you could set the color scheme to the plan. Changing the properties in that element may not be accessible by the API though. I'm not seeing anything related to Color Schemes in the API help doc.
Thanks Michael, yeah - this isn't supported by the API (yet?).
I can't find any way to get an existing view's color scheme, let alone set it. There is a builtin category named VIEW_SCHEMA_SETTING_FOR_BUILDING for which get_Parameter returns null.
You can find existing color schemes by filtering for BuiltInCategory.OST_ColorFillSchema, but these have no properties pointing back to views. Maybe there's some kind of binding map but it's surely not in the API.
Unfortunately, they will probably never add it. As a potential workaround, you could pre-set the color scheme in a View Template and then apply the template to the view.
@Anonymous @cig_ad I'm not able to access any of the Color Scheme utilities manually in Revit after creating an Area Scheme with the code above. Image below shows everything greyed out, any thoughts?:
Sorry to revise an old thread, but I'm at this point, it seems 2022 has more ColorFillScheme options, but when it comes to creating a default for a new Area Scheme it comes unstuck.
Has anyone figured out a way to generate the initial colour scheme associated to the newly created Area plan / Scheme?