Need help on how to import Editing logic function from different feature studio

Hi,
I am trying to call editing logic function from other feature studio to current feature studio as shown below. It seems not working & i see nothing in old definition. Please help me on how to import it. Thanks.

export function fromCurrentFS(context, id, oldDefinition, definition, isCreating, specifiedParameters, hiddenbodies) returns map
{
          fromOldFS(context, id, oldDefinition, definition, isCreating, specifiedParameters, hiddenbodies);
          return definition;
}

Comments

  • ilya_baran
    ilya_baran Onshape Employees, Developers, HDM Posts: 1,278 image
    You need to make sure fromOldFS is declared with an export in the other feature studio and that other feature studio is imported into the current one without a namespace (if the import has a namespace, the same namespace must be used when calling fromOldFS).
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • Kirankumar_Thimmegowda
    Kirankumar_Thimmegowda Member Posts: 28 PRO
    Thanks for the reply. It solved after initializing the definition, 
              definition=fromOldFS(context, id, oldDefinition, definition, isCreating, specifiedParameters, hiddenbodies);
              return definition;
  • Jake_Rosenfeld
    Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646 image
    edited February 2020
    @Kin

    That's because FeatureScript is pass-by-value, not pass-by-reference :)

    https://cad.onshape.com/FsDoc/variables.html
    Jake Rosenfeld - Modeling Team