import exported enum from another tab
adamohern
Member, OS Professional Posts: 216 PRO
I'm importing exported functions from another tab, and so far everything is working fine.
Now I'd like to offload some of my enum definitions to a separate tab as well, but so far that's not working. Is there a trick to making that work?
Now I'd like to offload some of my enum definitions to a separate tab as well, but so far that's not working. Is there a trick to making that work?
0
Comments
-
The trick (I suspect without seeing your case) is to prefix the import of the tab with the enum definitions with "export" to re-export the imported definitions. Otherwise the feature studio sees your enums, but the part studio that's supposed to be supplying them to the feature does not.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc0
-
export import(path : "goober", version : "goobergoober");
Like this?? Weird. Okay.0 -
I know it looks weird, but if you read it as "import all symbols exported from 'goober' and re-export them", I think it makes sense.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc0
-
I guess this springs from my not fully understanding what "export" does. I guess I assumed it was something like the "global" flag in some other languages.
The idea of needing to "re-export" something feels odd to me. If something is exported inside goober, I would expect it to be likewise in any script that imports it.
Again, being used to Python and PHP, I'm accustomed to these things being really straightforward: if you import a file, you import its namespace. Apologies if this kind of thing is standard practice in other languages.1 -
Maybe the hover-help for import and export could explain this.
0


