Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Call user created scripts in another script
Lee_Hesketh
Member, Developers Posts: 148 ✭✭✭
If I have written one script called custom_axis, and am now writing a new script. How could I call custom_axis in this new script? I have tried entering custom_axis in the hopes ti appears in the drop down list, but it doesn't. How could I do this?
Thanks
Lee Hesketh
Thanks
Lee Hesketh
There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!
Tagged:
0
Best Answer
-
NeilCooke Moderator, Onshape Employees Posts: 5,671Import your script at the top of the script you want to use it in (use import icon near the commit button).Senior Director, Technical Services, EMEAI5
Answers
If you're you're still getting an error calling your feature or function after importing the Feature Studio, make sure the imported Feature Studio exports the relevant symbol, e.g.
or
See also: import documentation.
Could you write a little code snippet demonstrating how to call this from another featurescript ?
In some other FeatureScript tab, you'll want to first click on the import button to set up the import of the other tab:
Once you have this open, you can navigate through that menu and fine the other feature studio you're interested in importing (note that if you are importing a Feature Studio from another document, that other document must be versioned. You can do this versioning from directly inside that dialog). When you have finalized the import it will generate a line of code that looks something like this:
At that point it will be simple to use your other feature. You'll be able to just write code that looks like: