Excuse me, I want to take screenshots of revit in C#.But what caused the mistake。。


What is the error message you get?

    if(T)
    {
      var file_name = "";
      if (P != "")
      {
        file_name = P;
        var bitmap = RhinoDoc.ActiveDoc.Views.ActiveView.CaptureToBitmap(false, false, false);
        bitmap.Save(file_name);
      }
    }

its most probably the same function just for revit…

oh, and you probably want to use a button instead of a boolean switch

hope that helps

Ben

Error (CS0103): Name “Revit” does not exist in the current context (line 62)

Camera.gh (8.0 KB)

Thank you. Let me see

But this is a screenshot from Rhino, not Revit

oh, in this case you are missing to import a library like:

using Autodesk.Revit;

or

using Autodesk;

idk the exact reference

Yeah, I thought you need use my code, but replace

RhinoDoc.ActiveDoc

by

Revit.RevitDoc

but in fact you need to add:

using Autodesk;

or change your command to:


 Autodesk.Revit.RevitDoc.ActiveView.CaptureToBitmap(new Size(7620,4380).Save(file);

Ok, I’ll try

It still doesn’t work.

Camera.gh (9.2 KB)

I had a typo, sry.

if(T)
    {
      var file_name = "";
      if (P != "")
      {
        file_name = P;
        var bitmap = Autodesk.Revit.RevitDoc.Views.ActiveView.CaptureToBitmap(new Size(7620,4380));
        bitmap.Save(file_name);
      }
    }


Still no! But can you do screenshots in Revit

whats the error message now?

I guess you did the following steps, right?
https://www.rhino3d.com/inside/revit/beta/guides/rir-csharp

then if you type ‘Revit.’ a list of available commands should appear. If it doesn’t propose ‘RevitDoc’, then ‘Views’ etc, it’s not the correct command.

Yeah, I’ll take a look sometime

Hi @3388160834,

Rhino.Inside comes with this component.

Does it do what your are looking for?

Here the code: