Message 1 of 1
how to replace one dimension type (say bad) w/ another (say good) and delete/purge bad one
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i want to change non-standard dimension types to standard one and delete/purge non-standard ones, below is my attempt, "ChangeTypeId" will throw exception, any insight?
IEnumerable<DimensionType> dts = new FilteredElementCollector(doc).OfClass(typeof(DimensionType)).Cast<DimensionType>();
DimensionType good = dts.Where(q => q.Name.Equals("good")).First();
List<DimensionType> bads = dts.Where(q => q.Name.Contains("bad")).ToList();
foreach (DimensionType bad in bads)
using (Transaction t = new Transaction(doc))
{
t.Start("myTransaction");
bad.ChangeTypeId(good.Id); // 'This Element cannot have type assigned.'
t.Commit();
}
edit: figured out via Dimension instead of DimensionType, still wonder if doable via DimensionType directly?