Error in OPSE: UILink is invalid or contains no instances. UILink must contain instances to be displayed in PropertyUI.

Hello

I am develloping new placement procedures in OpenPlant Support Engineering V8i (SELECTseries 6) Version 08.11.11.235 Windows 7 x64

I have very simple script:

Object1 = BESM.agr.CreateInstance("Class_1")                                                  # Create 1st instance

UILink.InstanceList.Add(Object1)                                                                          # Add object to instance list      
BESM.agr.CreateInstanceModelessUI()                                                                # Display property UI.    Press CANCEL button in this dialog
newObject1 = UILink.InstanceList.ActiveInstance                                                 # Get updated instance.  newObject1 == None (because the dialog was cancelled)

Object2 = BESM.agr.CreateInstance("Class_2")
UILink.InstanceList.Add(Object2)
BESM.agr.CreateInstanceModelessUI()                                                               # ERROR !!!

# --------------------------------------------------------------------------------------------------

I would like to display two dialogs in series. If the 1st dialog is closed with CANCEL button, then I have the error in second one.

However If the 1st dialog is OK, the second window will show without any errors. Does anybody explain me what's wrong?

How to disable Cancel buttton (any button) in object's properties dialog? I have no programming guides.

With best regards

Nickolay Agafonov, Kazan, Russia

  • Hi Nickolay, 

    Did you figure out this issue? 

    HTH

    Regards,

    Rahul Kumar

    Product Engineer – Global Technical Support | Community Moderator

  • Hi Rahul

    Unfortunately no. After user presses Cancel button I terminate placement script. This is not good approach and very rough but there no erros in this case

    Regards,

    Nickolay Agafonov

  • Hello Nickolay,

    May i know what exactly are you trying to achieve from a user perspective?

    I have never seen these lines of code in user scripts. The CreateInstance function is used internally to access the modelObject which in turn is used to access properties on the dialog. 

    The manual provided at the following path is a good starting point for customizing the scripts.

    C:\Program Files (x86)\Bentley\OPSE\Documentation\OPSE Content Development Manual.chm

    HTH,

    thanks,

  • Hi Gaurav,

    Yes, you are right,  the manual OPSE Content Development Manual.chm is very good and useful starting point.

    But at this moment I have fully rewritten all Bentley's placement procedures. I loaded new data in Briefcase database and created 3D models drawing procedures. About twenty five new complex frames were added to Briefcase database.

    Now all support frames are placed according to current LOAD values in supports under pipes. Number of supports are not limited, it means that frame could be set under unlimited number of supports (pipes). The Bentley's schema was extended to perform this task.

    If this brings clarity to the situation, I can send you a video of our procedures for placing frames. How we use them
    Due to the deep penetration into the process of building 3d models and placement,
    there are several questions that I will formulate in the near future
    I run the following code to set frame parameters:

    Sometimes I need show two or more parameters dialog in series to set parameters before and after frame streaching prosess

    frameProperties = FrameProperties(orient, structDepth, horzLedge)
    fpObj = GetFPObject("FP", frameProperties)

    if (fpObj is None):
        Message("%s User has cancelled frame placement !" %(dt))


        # Attention!!! If I continue execution here, the next UILink dialog window won't be shown
        # The ERROR occurs:
        # "UILink is invalid or contains no instances. UILink must contain instances"
        return
    else:
        orient = fpObj.GetStringValue("ORIENT", "Left")
        structDepth = fpObj.GetRealValue("STRUCTDEPTH", structDepth, uom)
       horzLedge = fpObj.GetRealValue("HORZLEDGE", horzLedge, uom)

    # ------------------------------------------------------------------------------------------

    def GetFPObject(className, frameProperties):

    # Create a new instance and add to our UILink
    fpObj = BESM.agr.CreateInstance(className)

    if (frameProperties is not None):
    for fp in frameProperties:
    fpObj.AddTempProperty(BESM.agr.CreateTempProperty(fp['PropertyName'], fp['Properties']))

    UILink.InstanceList.Add(fpObj)
    UILink.InstanceList.HideMatchProperties = True

    BESM.agr.CreateInstanceModelessUI() # Display property UI

    fpNewObj = UILink.InstanceList.ActiveInstance # Get updated instance

    UILink.InstanceList.Clear()
    return fpNewObj

    # ------------------------------------------------------------------------------------------
    def FrameProperties(orient, structDepth, horzLedge):

    opts = LocalStr("Options")

    pyOLR = "Orientation L/R" # Orientation
    pySD = "Struct Depth" # Depth of structural element
    pyHL = "Horizontal Offset" # Horizontal offset from base pipe

    frameProperties = [
    {'PropertyName':'HORZLEDGE','Properties': {'UIcategory':opts, 'DisplayLabel':pyHL, 'DataType':'Double', 'Default':horzLedge, 'UOMType': 'LENGTH', 'options':'Temporary', 'ordinal' : 253}},
    {'PropertyName':'STRUCTDEPTH','Properties': {'UIcategory':opts, 'DisplayLabel':pySD, 'DataType':'Double', 'Default':structDepth, 'UOMType': 'LENGTH', 'options':'Temporary', 'ordinal' : 254}},
    {'PropertyName':'ORIENT', 'Properties' : {'UIcategory':opts, 'DisplayLabel':pyOLR, 'DataType':'string', 'Default':orient, 'options':'Temporary',
    'controltype' : 'Grid', 'SourceType': 'Query', 'SourceName' : 'STLORIENT', 'ordinal' : 257}},
    ]

    return frameProperties

    -----------------------------------------------------------------------------------------

    Regards,

    Nickolay Agafonov

  • Hello Nickolay,

    This looks like a big customization. Mau ask you why would you require 2 sets of property dialogs? Can you not incorporate all the property changes in one single dialog which is provided by OPSE?

    Of course you can change the placement methods but you have to maintain and migrate those changes by yourself when you move to next OPSE version.

    I would be very much interested in understanding what you have done and please send us a video. We would like to know why you had to do so much of customizations and improve our product.

    Thanks,