Jump to content
OMRON Forums

PERL: Make Datums Linkable


Recommended Posts

Below and attached sample show how to make the datum's linkable.

In the PreRun subroutine
 
 # make sure that all input datums can be linked
 $i = 0;
 my $thisDm = 0;
 for ($i =0;$i< 4;$i++)
 {
  $thisDm = perlutil::get_datum(0, $i);
  $currentFlags = Composite::GetEditability($thisDm);
  Composite::SetEditability( $thisDm , $currentFlags | $EM_CAN_MODIFY_AT_RUNTIME );
 }
 
The $EM_CAN_MODIFY_AT_RUNTIME variable is 0x2000 - I now include the following in all of my scripts just after the
 
perlutil::register("myScriptName"); 
 
line
 
BEGIN {
#
# STATUS FLAGS.   Used with Composite::SetStatusFlags() call.
#
 *ST_TRAINABLE   = \0x00000001; # step or datum is trainable
 *ST_TRAINED   = \0x00000002; # step or datum has been trained
 *ST_PARTCREATE   = \0x00000004; # step creates a part
 *ST_STOP_ON_TRAIN  = \0x00000008; # step needs to be set up (or moved) before training
 *ST_IS_EMBEDDED   = \0x00000010; # composite is embedded in parent
 *ST_THREADED   = \0x00000020; # step is threaded
 *ST_NEED_STAT_TRAIN  = \0x00000040;
 *ST_CAN_TUNE_PARAMS  = \0x00000080;
 *ST_DIRTY   = \0x00000100; # composite is "dirty"
 *ST_ENABLED   = \0x00000200; # composite is enabled
 *ST_INCLUDED_IN_RESULTS  = \0x00000400; # composite is included in results uploaded from target
 *ST_USES_MONSTER  = \0x00000800; # uses monster resource. ### NO LONGER AVAILABLE!###
 *ST_VIRGIN   = \0x00001000; # composite has never been run
 *ST_FIELD   = \0x00002000; # composite is a field
 *ST_DISABLE_PRECHECK  = \0x00004000; # disable prechecking on this step/datum
 *ST_INCLUDED_IN_STREAM  = \0x00008000; # do not stream this composite to disk/network
 *ST_SKIP_REGEN   = \0x00010000;  # do not attempt to follow references when building regen list
 *ST_HIDDEN   = \0x00020000; # hide this object in the tree view (but show children)
 *ST_TIMING_ENABLE  = \0x00040000; # this step contains timing diagnostics
# editability mask bits. Used with Composite::SetEditability() call.
 *EM_DATUM   = \0x01; # editable as a datum
 *EM_REFDATUM   = \0x02; # editable as a reference to a datum
 *EM_CANROTATE   = \0x04; # valid for steps and shapes
 *EM_CANMOVE   = \0x08; # valid for shapes
 *EM_CANSIZE   = \0x10; # valid for shapes
 *EM_CANMASK   = \0x20; # valid for steps
 *EM_RESULT   = \0x40; # valid for output datums
 *EM_ENABLEREFEDIT  = \0x80; # if ref editable, enable the reference editing
 *EM_NOUSERUPLOAD  = \0x100; # if no user upload, the user can't select the
       #   datum as a result to upload, but it's automatically
       #   included in the uploaded results.
 *EM_VOLDATUM   = \0x200; # datum is volatile, can be changed at runtime
 *EM_ALWAYSUPLOAD  = \0x400; # always upload datum @ results upload time, even if step or datum has an error
 *EM_CANSCALE   = \0x800; # can shape be scaled
 *EM_CANSTRETCH   = \0x1000; # can shape be stretched linearly (rhombus)
 *EM_CAN_MODIFY_AT_RUNTIME = \0x2000; # can be modified by the user at runtime - no questions asked
 *EM_ASK_MODIFY_AT_RUNTIME = \0x4000; # ask parent step if datum can be modified at runtime
 *EM_ARRAYDATUM   = \0x8000; # this datum is part of an array record
# Useful defines for IOListDm Types
 *IO_INPUT    = \1;
 *IO_OUTPUT    = \2;
 *IO_BOTH    = \3;
 *AVPIOTYPE_ALL   = \0; 
 *AVPIOTYPE_PHYSICAL  = \1; 
 *AVPIOTYPE_VIRTUAL  = \2; 
 *AVPIOTYPE_SENSOR  = \3; 
 *AVPIOTYPE_STROBE  = \4;
 *AVPIOTYPE_ANALOGOUT  = \5;
 *AVPIOTYPE_SLAVESENSOR  = \6;
 *AVPIOTYPE_TTLINPUT  = \7;
 *AVPIOTYPE_TTLOUTPUT  = \8;
 *AVPIOTYPE_RS422INPUT  = \9;
 *AVPIOTYPE_RS422OUTPUT  = \10;
# Useful defines for Datum list Types
 *INPUT_DATUM   = \0; 
 *OUTPUT_DATUM   = \1; 
 *RESOURCE_DATUM   = \2; 
 *INPUT_DATUMLIST  = \0;
 *OUTPUT_DATUMLIST  = \1;
# Useful defines for Debug Info Types
 *DWM_INFO   = \1;
 *DWM_WARNING   = \2;
 *DWM_SERIOUS   = \4;
 *DWM_LEVEL   = \15;
 *DWM_SHOWMSG   = \0x00010000;
 
#smart camera sensor resolutions
 *WVGA_WIDTH   = \752;
 *WVGA_HEIGHT   = \480;
 *SXGA_WIDTH   = \1280;
 *SXGA_HEIGHT   = \960;
 *WUXGA_WIDTH   = \2048;
 *WUXGA_HEIGHT   = \1088;
}
 
Attached Visionscape AVZ includes PERL step "StringCompareToLinkedString.pm" using this feature.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...