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.

EXPORTING VALUE

papawopapawo Member, Developers Posts: 206 PRO
edited February 2018 in FeatureScript
How can I export this value?

Tagged:

Best Answers

  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 497
    edited February 2018 Accepted Answer
    FeatureScript has a few methods for sharing data between features:
    1. You can share them in variables (where the result is stored in the Part Studio context)
    2. You can set them as attributes (where the result is stored on specific geometric entities in the context)
    3. You can export a function which computes the result (this result is not stored, but is recalculated when needed)
    Depending on your application, each method can be useful.

    I just made a public example document with a "setting" and a "getting" feature that outlines and uses each of these three methods:
    https://cad.onshape.com/documents/b0ee3d7a54ed4f9d545aaf35/w/2ed81a2ae5a0b46f717613b5/e/2407302600fec1de0bf8fb1b

    In every case, as with everything in FeatureScript, the data is computed as part of the regeneration of some Part Studio, and the data can change if that Part Studio changes.

    Do you know which method is most useful for your application?

Answers

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,599
    @papawo

    Can you describe what you mean by export?
    Jake Rosenfeld - Modeling Team
  • papawopapawo Member, Developers Posts: 206 PRO
    edited February 2018
    i want to access this data thru other fs, using export function?
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,599
    Can you give a broader description of what you're trying to do? Are you trying to calculate this value in one feature and then use it in future features?  Could the whole thing just be done as one feature?
    Jake Rosenfeld - Modeling Team
  • papawopapawo Member, Developers Posts: 206 PRO
    exactly. i'm sorry , but the plan is to be able to reuse data.
  • papawopapawo Member, Developers Posts: 206 PRO
    thanks
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 497
    edited February 2018 Accepted Answer
    FeatureScript has a few methods for sharing data between features:
    1. You can share them in variables (where the result is stored in the Part Studio context)
    2. You can set them as attributes (where the result is stored on specific geometric entities in the context)
    3. You can export a function which computes the result (this result is not stored, but is recalculated when needed)
    Depending on your application, each method can be useful.

    I just made a public example document with a "setting" and a "getting" feature that outlines and uses each of these three methods:
    https://cad.onshape.com/documents/b0ee3d7a54ed4f9d545aaf35/w/2ed81a2ae5a0b46f717613b5/e/2407302600fec1de0bf8fb1b

    In every case, as with everything in FeatureScript, the data is computed as part of the regeneration of some Part Studio, and the data can change if that Part Studio changes.

    Do you know which method is most useful for your application?

  • papawopapawo Member, Developers Posts: 206 PRO
    They are all useful.
    Thanks Kevin! Good explanation!
Sign In or Register to comment.