Query labware visibility based on labwareId not sequence

I’m trying to get carrier/template visibility at runtime. Unfortunately since HSLLabwareStateLib::GetLabwareVisibility requires a sequence and cannot accept a labwareId, I have to query the labware on the carrier, then use the default sequence of the first labware on the carrier to get the visibility of the carrier. This seems a bit roundabout so I was wondering if there was a more direct way to query carrier visibility directly. Thanks in advance!

Hi @pthatcher ,

Here is the logic that can be used to query that value. I would recommend making a local submethod and putting in the following hsl code to query it. This will return the labware visibility for both racks and templates.

{
object objRackDataParams;
object objDecklayout;
object objLabware;
object objEditLabware6;

objRackDataParams.CreateObject("HXPARAMSLib.HxPars");
objDecklayout = ML_STAR.GetDeckLayoutObject();
objLabware = objDecklayout.Labware(i_str_LabID);

objLabware.GetObject("IEditLabware6", objEditLabware6);

int_LabwareVisibility = objEditLabware6.Visible();

objRackDataParams.ReleaseObject();
objDecklayout.ReleaseObject();
objLabware.ReleaseObject();
objEditLabware6.ReleaseObject();
}

2025-08-22 12:18:07.618 SYSTEM : Start method - complete; 
2025-08-22 12:18:07.621 SYSTEM : Execute method - start; Method file C:\Program Files (x86)\HAMILTON\Methods\Test\Get Labware Visibility\GetLabwareVisibility.hsl
2025-08-22 12:18:07.671 USER : Trace - complete;      Labware:  PLT_CAR_L5AC_A00_0001 - 1
2025-08-22 12:18:07.672 USER : Trace - complete;      Labware:  PLT_CAR_L5AC_A00_0002 - 0
2025-08-22 12:18:07.673 USER : Trace - complete;      Labware:  PCR_96_0001 - 1
2025-08-22 12:18:07.674 USER : Trace - complete;      Labware:  PCR_96_0002 - 0
2025-08-22 12:18:07.682 SYSTEM : Execute method - complete; 
2025-08-22 12:18:07.693 SYSTEM : End method - start; 

2 Likes

This worked beautifully, thank you!!

2 Likes

@BrandonBare_Hamilton Is it possible to set labwareId visibility in a similar manner?

Hi @pthatcher ,

You actually can use the default HSLDeckVisualize library to update labware visibility state. Either UpdateUsedLabware or UpdateLoadedLabware should do the job.

1 Like