The Tekla API is not very open - one of my peeves is that you cannot access a drawing's revision number, because it is not exposed. Not to worry, you can access it with a hack:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Tekla.Structures.Drawing;
using Tekla.Structures.Model;
namespace BensExtensions
{
public static class DrawingExtensions
{
// Use it like this:
// drawing.RevisionNo(); where drawing is of type Drawing
public static string RevisionNo(this Drawing drawing)
{
PropertyInfo PI = drawing.GetType().GetProperty("Identifier", BindingFlags.Instance | BindingFlags.NonPublic);
object value = PI.GetValue(drawing, null);
Tekla.Structures.Identifier Identifier = (Tekla.Structures.Identifier)value;
Beam b = new Beam();
b.Identifier = Identifier;
string revisionMark = String.Empty;
b.GetReportProperty("REVISION.MARK", ref revisionMark);
return revisionMark;
}
}
}
// and use it like this
drawing.RevisionNo(); // where drawing is of type Drawing
// Unfortunately, AFAIK, c# does not permit property extensions.