Locked Objects Tekla

Tekla Structures There are locked objects, see report. The operation could not be performedFrom time to time you can get annoying messages says that some objects are locked. Of course, we got official documentation which explains this issue wide enough. And this article is either based on it. But actually, there is a bunch of cases which are not covered by documentation or mentioned not clear enough (from my point of view of course). So let’s go through object locking in Tekla Structures. And obtain some tools to deal with it easily.

 Locking objects

Locking is used to freeze parts of the model from unexpected changes. Such changes appear from time to time because of moving things which shouldn’t be moved or during mass changing properties and UDA. When you select a couple of hundreds of parts, there is a big chance to select something which you not wonder. Such accidentally changes affecting numbering, ruing drawings and reports. That’s why to freeze objects from change is a pretty cool idea. You could freeze your parts, and be sure that no one else modifies it without noticing.

Instead of other CAD application Tekla do not have layer system to froze (Phases doesn’t count). But prevention of changes is applicable for most of the model elements. All that you have to do is set UDA “OBJECT_LOCKED” to true.

Here is a list of things which may be locked:

  • project properties
  • phase properties
  • assemblies
  • parts (separately for beams, columns etc.)
  • bolts
  • welds
  • specific drawing types

UDA “OBJECT_LOCKED”

“OBJECT_LOCKED” actually is a boolean value which could be set to true (1) or false(0). But by default, you do not have such option in your list. You have to add this property in object.inp:

attribute(“OBJECT_LOCKED”, “Locked:”, option, “%s”, none, none, “0.0”, “0.0”)

{

value (“No”,0)

value (“Yes”, 1)

}

And assign this attribute to all or some element from the list above.

After that, you will get a new property in UDA section of an object. Where “Yes” means Lock. And there is no way to modify entity until you reset Lock. Instead of change, you’ll get message “There are locked objects, see report. The operation could not be performed.” and a report on access rights. But sometimes you may get the same message when you do not expect any traps.

You try to modify element, it’s definitely not locked, but you still get this message instead of expected result?

Let’s see what may happen – if any related element is set as locked, it will affect at whole assembly which contains such element. Take a look at scheme bellow

Tekla Structures: There are locked objects scheme

Above we mentioned that not only part could be locked. And if some of this tiny things is locked – it will cause this pretty annoying message each time when you try to modify elements even if it’s not locked.

And we have  a few options to avoid this thing – add OBJECT_LOCKED property to each type of model objects, and then find those which is locked. Or remove lock with API function.

static void CAD_TeklaModelObject_Lock()
        {
            Tekla.Structures.Model.UI.ModelObjectSelector selected = new Tekla.Structures.Model.UI.ModelObjectSelector();
            Tekla.Structures.Model.ModelObjectEnumerator manyO = (selected.GetSelectedObjects() as TSM.ModelObjectEnumerator);
            while (manyO.MoveNext())
            {
                if ((manyO.Current as TSM.ModelObject) != null)
                {
                    TSM.ModelObject pp = manyO.Current as TSM.ModelObject;
                    pp.SetUserProperty("OBJECT_LOCKED", 1);
                    pp.Modify();
                }
            }
            var model = new TSM.Model();
            model.CommitChanges();
        }

 

Tekla Macro to Lock and Unlock all Model Objects

Below provided listing of Tekla Macro Script which could be run from tekla to unlock all selected elements in model. This script could be used to unlock assemblies, but you have to select these as assemblies.

namespace Tekla.Technology.Akit.UserScript
{
    using TSM = Tekla.Structures.Model;
    using System; 
    using System.Windows.Forms;
    
    public class Script
    {
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
        MessageBox.Show(CAD_TeklaModelObject_unLock().ToString());
        }


      static int CAD_TeklaModelObject_unLock()
        {
            Tekla.Structures.Model.UI.ModelObjectSelector selected = new Tekla.Structures.Model.UI.ModelObjectSelector();
            Tekla.Structures.Model.ModelObjectEnumerator manyO = (selected.GetSelectedObjects() as TSM.ModelObjectEnumerator);
        int i=0; 
            while (manyO.MoveNext())
            {
                if ((manyO.Current as TSM.ModelObject) != null)
                {
                    TSM.ModelObject pp = manyO.Current as TSM.ModelObject;
                    pp.SetUserProperty("OBJECT_LOCKED", 0);
                    pp.Modify();
            i++;
                }
            }
            var model = new TSM.Model();
            model.CommitChanges();
        return i; 
        }
    }
}

One thought on “Locked Objects Tekla

Leave a Reply

Name *
Email *
Website