![]() Many frequently-used methods are now marked as obsolete. But it is a good reminder to think about how Revit’s state can affect your add-in, be careful working in the API with newly created elements, and that sometimes by adding a “regenerate” or changing how you are using transactions you can find a solution.Īutodesk made a bunch of changes to the Revit API for Units in 2021. You can work around this by adding a Document.Regenerate() just before changing the wall type. But if the last wall type used in the interface was a Curtain Wall… If the last wall type used was a basic wall, then everything is fine. The problem is that when you create a wall with the Revit API, Revit uses the wall type last used when a wall was created with the user interface. ![]() New FilteredElementCollector(doc).OfClass(typeof(Level)).FirstOrDefault().Id, Using (Transaction t = new Transaction(doc, "test")) FirstOrDefault(q => q.Kind = WallKind.Basic) WallType wt = new FilteredElementCollector(doc) Here’s a really simple bit of code to create a wall and change the wall typeĭocument doc = Utils.illegalViewRangeFailureId = new FailureDefinitionId(Guid.NewGuid()) įailureDefinition.CreateFailureDefinition( UpdaterRegistry.RegisterUpdater(viewScaleUpdater, true) Įlement.GetChangeTypeParameter(new ElementId(BuiltInParameter.VIEW_SCALE))) Utils.ViewScaleUpdater viewScaleUpdater = new Utils.ViewScaleUpdater(application.ActiveAddInId) If you think lessons like there are interesting and helpful, please support Boost Your BIM at Patreon, take one of our video courses on the Revit API, or contact us to discuss how we can work together to make Revit better. You can find all the code here and an explanation in the video below. This can be done with two pieces of Revit API functionality – Updater & Custom Failures. Or something else like that where you’d like to automate the process of checking a user’s change and determining if it should be allowed, prevented, or trigger a warning. Or certain naming conventions that should be used. ![]() ![]() Let’s say there is a specific list of View Scales that you want allowed in your Revit projects.
0 Comments
Leave a Reply. |