Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

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

KinKin Member Posts: 16 PRO
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_baranilya_baran Onshape Employees, Developers, HDM Posts: 981
    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 \ Director, Architecture and FeatureScript \ Onshape Inc
  • KinKin Member Posts: 16 PRO
    Thanks for the reply. It solved after initializing the definition, 
              definition=fromOldFS(context, id, oldDefinition, definition, isCreating, specifiedParameters, hiddenbodies);
              return definition;
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,570
    edited February 17
    @Kin

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

    https://cad.onshape.com/FsDoc/variables.html
    Jake Rosenfeld - Modeling Team
Sign In or Register to comment.