Home Image-Pro Automation (Macros, Apps, Reports)

What IMPORT or REFERENCE is needed to use Overlays.OverlayType.ROIOverlay?

All --

I have a FUNCTION in an OLD PROJECT that works like a champ (see below).

I have copied FUNCTION SELECTROI to a NEW PROJECT and now the PROJECT will not LOAD.

It seems the NEW PROJECT is lacking an IMPORT or REFERENCE.

I have added all of the IMPORTS from the OLD PROJECT to the NEW PROJECT but the error still occurs.

The item that is generating the error is
            Overlays.OverlayType.ROIOverlay
in
            .Overlay = Overlays.OverlayType.ROIOverlay
in
        With Select.Roi.ToolsCommands.Rectangle(SelectRoi)
            .Image = .GetImage("Select.Roi.Tools.Rectangle")
            .Overlay = Overlays.OverlayType.ROIOverlay
            .Tool = Overlays.OverlayToolType.McGraphObjRect
            .Run(doc1)
        End With
What IMPORT or REFERENCE do I need to add to my NEW PROJECT to fix this and what path should I have followed in the HELP FILES to find this myself?

Thanks.

-- Matt

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

    Public Function SelectRoi() As SimpleScript
        SelectRoi = New SimpleScript
        Dim doc1

        With Application.DocumentCommands.Active(SelectRoi)
            .Run(doc1)
        End With

        With Select.RoiCommands.MultipleROIs(SelectRoi)
            .Text = "Multiple ROIs"
            .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Unchecked
            .Run(doc1)
        End With

        With Select.Roi.ToolsCommands.Rectangle(SelectRoi)
            .Image = .GetImage("Select.Roi.Tools.Rectangle")
            .Overlay = Overlays.OverlayType.ROIOverlay
            .Tool = Overlays.OverlayToolType.McGraphObjRect
            .Run(doc1)
        End With

        With Automate.ScriptingCommands.Interaction(SelectRoi)
            .Text = "Select ROI"
            .Image = .GetImage("Select.Roi.Tools.Rectangle")
            .Prompt = "Please create a RECTANGULAR ROI around the SAMPLE AREA then press OK!"
            .Interactive = True
            .Run(doc1, Nothing)
        End With

    End Function

Best Answers

  • Answer ✓
    Matt,

    have you you tried to export and import
    references from the old project or just import all references on the edit tab?

    Pierre
  • Answer ✓
    Matt,

    In addition to references you also have to transfer Imports, which are listed in the beginning of every VB file. Imports (and references) can be transferred using the export/import steps that Pierre recommended.
    In your case the following line was missing:

    Imports MediaCy.Addins.Measurements

    Yuri

Answers

  • Pierre --

    No I have not.

    I was trying to not overload the NEW PROJECT with connections it did not need.

    I can try that if it is the best next move.

    I'll wait to hear from you.

    Thanks.

    -- Matt
  • Pierre --

    I performed the following

        EDIT
        DEPENDENCIES

    and then both

        IMPORT ALL OPERATOR REFERENCES
        IMPORT ALL MEDIA CYBERNETICS REFERENCES

    and it resolved the issue within
           .Overlay = Overlays.OverlayType.ROIOverlay
    Unfortunately I still had an issue with
            McMMOptions.mcmmltTypes.mcmmltNone 
    within
            'Turn off LABELS
            With Measure.MeasurementsCommands.Options(Nothing)
                .LabelType = McMMOptions.mcmmltTypes.mcmmltNone
                .Run(ThisApplication.ActiveDocument)
            End With
    I resolved this by recording the SETTING of this option.

    Thanks.

    -- Matt

  • edited June 2016
    Yuri --

    Thanks for the guidance on that.

    I believe that I did copy all of the IMPORTS from the OLD PROJECT to the NEW PROJECT I did it manually (vb file to vb file) and not with the IMPORT BUTTON on the EDIT RIBBON.  Perhaps I missed one some how.

    What path through the HELP FILES would have led me to a reference that would have provided that same information?

    Thanks.

    -- Matt
Sign In or Register to comment.