Volume computations bug still present ?

Volume computations bug still present ?

Anonymous
Not applicable
658 Views
5 Replies
Message 1 of 6

Volume computations bug still present ?

Anonymous
Not applicable

Hi fellow Reviteers,

 

I want to check a project to see if the area volume computations is set. I've searched the net and saw complaints (back to 2011) of this not working. When I try the code below in Revit 2015, it still doesn't seem to work 😞

 

AreaVolumeSettings settings = AreaVolumeSettings.GetAreaVolumeSettings(doc);
if (settings.ComputeVolumes) return; // HERE IT KEEPS ON SAYING ComputeVolumes is false ??
using (Transaction t = new Transaction(doc, "Turn on volume calculation"))
{
t.Start();
settings.ComputeVolumes = true; // AND WHEN I CHECK IT IS SET TO TRY
t.Commit();
}

// when i run this code again, it will say the value is false and set it to true again. Also when I check the GUI dialog, it also isn't set ???

 

 

So, why is this bug still present and is there a workaround ?

 

 

Accepted solutions (2)
659 Views
5 Replies
Replies (5)
Message 2 of 6

stever66
Advisor
Advisor
Accepted solution

I'm not sure about Revit 2015, but this seems to work really well with Revit 2016 and the Macro Editor.  I can set it to true and false, and it stays set and I can verify in the settings dialog box.  Also seems to work fine if I run it a second time with the setting = true.

public void mysharpmac()
        {
            UIDocument uidoc = ActiveUIDocument;
            Document doc = ActiveUIDocument.Document;

            AreaVolumeSettings settings = AreaVolumeSettings.GetAreaVolumeSettings(doc);
            if (settings.ComputeVolumes) return;
            using (Transaction t = new Transaction(doc, "Turn on volume calculation"))
            {
            t.Start();
            MessageBox.Show(settings.ComputeVolumes.ToString ());
            settings.ComputeVolumes = true// AND WHEN I CHECK IT IS SET TO TRY
            MessageBox.Show(settings.ComputeVolumes.ToString ());
            t.Commit();
            }            
        }

Message 3 of 6

Anonymous
Not applicable
Okay, thanks for checking. It seems to be a bug in Revit 2015, since in 2016 the code above works like it shouild. So,Autodesk, please report this bug in 2015 and fix it asap 🙂
0 Likes
Message 4 of 6

stever66
Advisor
Advisor

Remy:

 

I got a chance to try this at the office where we have Revit 2015 too.   It still seems to work when I put it into a SharpDevelop C# Macro.

 

Maybe it works for the Macros, but not an External Command or Application??

 

Is there any chance that part of your code wasn't running for some reason?  Or maybe another line of code was changing this setting back to false??

0 Likes
Message 5 of 6

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Remy,

 

Thank you for your query.

 

As far as I can tell from Steve's contributions, this issue is resolved in both Revit 2015 and Revit 2016.

 

Many thanks to Steve for testing and verifying that!

 

Can you please confirm that it works now for you too?

 

Thank you!

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 6 of 6

Anonymous
Not applicable
Yep, my prayers have been heared 🙂 The last update of 2015 fixed the problem.