ProcessPlanning

new ProcessPlanning()

The process planning API object. This is only available if enableProcessPlanning was set to true in the ANARKCOREDATA constructor - when enabled, there will be a property of ANARKCOREDATA called processPlanning (ex: anarkCoreData.processPlanning).

Methods

getAssociatedParts(processStep, includeSubSteps) → {Array}

Get the parts that are added by a process step. Does not include parts that are removed.

Parameters:
Name Type Description
processStep string The name of a process step.
includeSubSteps boolean Set to true to include parts added in sub-steps of the specified step (includes the specified step and all sub-steps). False will provide the parts that are added only in the specified step.
Returns:
Array Returns an array of objects in the form of { name: componentName, id: componentCadEntityId, quantity: componentCount }
Example
var listBoxItems = [];
  var associations = document.anarkCoreData.processPlanning.getAssociatedParts("step 1", true);

  for (var i = 0; i < associations.length; i += 1)
  {
      var partName = associations[i].name;
      var id = associations[i].id;
      var quantity = associations[i].quantity;

      listBoxItems.push([quantity > 1 ? partName + " (x" + quantity + ")" : partName, id]);
  }

getIdsAssignedToProcessStep(processStep) → {Array}

Gets the ids of part occurrences that are being added or removed in the specified process step.

Parameters:
Name Type Description
processStep string The name of a process step.
Returns:
Array Returns an array of occurrence ids.

moveToStep(lastProcessStep, processStep) → {Array}

Called to switch from one process step to another. Provides all of the information needed to update the occurrence buildout, camera settings, annotation visibility, animations associated with the process step, etc.. Initially, you should pass null for lastProcessStep. Passing null for lastProcessStep is essentially like a "reset" so that you get the full hide/show list so that the visibility states can be properly initialized. Keeping track of the lastProcessStep will enable better performance because only the relevant changes between lastProcessStep and processStep will be included. If the visibility states or the scene is updated by the user or by other code, you should pass a null for lastProcessStep to get back to the correct visibility state.

Parameters:
Name Type Description
lastProcessStep string The current process step that is being viewed - pass null the first time or if the current visibility state does not necessarily match the process buildout.
processStep string The process step to move to.
Returns:
Array Returns an array of objects in the form of: { workInstructionData: extraRowData, workInstructionCells: cells, animations: animations, entityIdsToHide: idsToHide, entityIdsToShow: idsToShow, camera: camera, placement: placementInfo }. Note that camera and placementInfo may be null if there is no change to the camera or placement.
Example
var stepInfo = anarkCoreData.processPlanning.moveToStep(lastProcessStep, processStep);
  lastProcessStep = processStep;

  // stepInfo.animations contains an array of animationData - you can use animationData.animation.name and animationData.index to populate a listbox

  // Additional information from the source datatable (if present) will be available in the stepInfo.workInstructionData property.
  updateSafety(stepInfo.workInstructionData.Safety);
  updateTools(stepInfo.workInstructionData.Tools);

  resetAllPlacement();

  for (i = 0; i < stepInfo.entityIdsToHide.length; i += 1)
      hide(stepInfo.entityIdsToHide[i]);
  for (i = 0; i < stepInfo.entityIdsToShow.length; i += 1)
      show(stepInfo.entityIdsToShow[i], false);

  if (stepInfo.camera !== null)
      setCamera(stepInfo.camera);

  if (stepInfo.placement !== null)
      updatePlacement(stepInfo.placement);