Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Anchor Section Lines To Objects

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Hugh_Compton
644 Views, 3 Replies

Anchor Section Lines To Objects

Is it possible to 'Anchor' section lines to elements so that when the elements are moved / rotated within a project RVT their sections remain correct?

 

Thanks

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Hugh_Compton

Check your SDK for a sample under
Revit 2016\Samples\DynamicModelUpdate\ called "SectionUpdater.cs" This is an excellent example of how to achieve what you'd like to achieve.

It's not directly applicable but can certainly be modified to create a nice associative section tool
Message 3 of 4
Hugh_Compton
in reply to: Anonymous

 

Hello

 

The sample does work nicely in a session of Revit.  The problem I get is that when I close and reopen Revit it loses the Section / Window associations. 

 

How can I get the sample to register with Revit on startup? I have tried a hack as shown below:

 

 public Result OnStartup(UIControlledApplication a)
        {
            m_sectionUpdater = new SectionUpdater(m_thisAppId);
            m_sectionUpdater.Register(m_document);

            // Register the updater in the singleton 
            // UpdateRegistry class
            UpdaterRegistry.RegisterUpdater(m_sectionUpdater);

            // Set the filter; in this case we 
            // shall work with beams specifically
            ElementCategoryFilter filter
            = new ElementCategoryFilter(
             BuiltInCategory.OST_Windows);
            
            // Add trigger BENS NOTE, I AM NOT SURE HOW TO GET THIS TO WORK - OR IF IT IS NECESSARY!
           UpdaterRegistry.AddTrigger(
              m_sectionUpdater.GetUpdaterId(), filter,
             Element.GetChangeTypeGeometry());
         //   m_sectionUpdater.AddTriggerForUpdater(m_document, idsToWatch, sectionId, sectionElement);

            return Result.Succeeded;
        }
Message 4 of 4
Hugh_Compton
in reply to: Hugh_Compton

Loading_Error_Message.JPG

 

Above is  the error message that I receive.  Revit doesn't remember which section lines are anchored to which windows...

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community