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.

FS enums in a common shared script

graham_lockgraham_lock Member Posts: 148 PRO
Hi all,

I have an enum which is used to define a UI parameter type, which I also want to use within another script.

If I define the enum outside of the script where it is used to define a parameter type I get an error telling me it must be exported.

Is there a way around this? Do I need to define it in the script where it is used as a parameter type and then import that script into the other scripts rather than use a common file?

Test document here:
https://cad.onshape.com/documents/69bc4ff93f0403841e6c9441/w/c2315c99b371ce207df18903/e/8d32865f14c600cf8061293e

Thank you.

Best Answer

Answers

  • _anton_anton Member, Onshape Employees Posts: 410
    Is there a reason you don't want to export it? That would fix both issues.
    export enum FooEnum
  • Caden_ArmstrongCaden_Armstrong Member Posts: 180 PRO
    Answer ✓
    You need to export the imported enum
    export import(path : "e09210f831642af152bb6093", version : "c60edfc009b13c4a4a38fe25");
    in the fs where you are using it.
    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications
  • graham_lockgraham_lock Member Posts: 148 PRO
    Thank you.
Sign In or Register to comment.