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.

Options

Onshape library, for programmers

daniel_chowdaniel_chow Member Posts: 108 ✭✭✭
Hello everyone, 

I have a suggestions for OS that I'm sure they thought about already. 

What if you added a library, or set of code libraries that a programmer could use to run scripts to manipulate their models? 
  • Make the IDE online, in fact make it a tab that you can add
  • Make it Javascript based (because everyone knows a bit of Javascript)
  • Of course Object based ... (user account is an object, document is an object, each part is an object etc...)
  • Don't make people have to import the libraries, just import them all automatically
Why?
  • Many CAD users are also programmers
  • Any engineer will know how to code
  • Its optional, do't have to use it if you don't want to. 
Example: Google Docs. Many people don't know this, but Google has a class library that you can use for nearly each one of their products. Their IDE is browser based and is basically Javascript. Here is a simple little Christmas spreadsheet project I put together to show how Google Apps Script works. Google Apps Script API documentation

Other software suites offer this feature too. Like Microsoft Office offers VBA, Zoho Office overs CRM API

Comments

  • Options
    lougallolougallo Member, Moderator, Onshape Employees, Developers Posts: 2,001
    edited December 2015
    @daniel_chow I have written many apps and integrations with GAS and have shared its power with our team here. ;-)  you might want to check out https://forum.onshape.com/discussion/2320/programmatic-extensions-to-onshape#latest
    Lou Gallo / PD/UX - Support - Community / Onshape, Inc.
  • Options
    daniel_chowdaniel_chow Member Posts: 108 ✭✭✭
    Lou, me too. I started Google Apps Script a few years ago. I started writing little scripts to "Get things done" around what I do as a teacher and network administrator (computer guy). Then my Google Apps Script programs got more and more complicated. Now I find myself repeating a lot of code and pondering if I should start rewriting my programs with scalability in mind. That is, rewriting my code with the intent of sharing that code with other programs. But that is of course time intensive. Most of my GAS code is embedded inside the document itself. I recently learned how to write code to a "file" outside of the document then include it into a doc. Google has a unique way of doing that. They allow an external code library to have "versions". That means you can allow people to use version 2.1, while you continue to add / update / test version 2.5 in the SAME FILE. Then when you are done testing 2.5 and ready to release it, you can release version 2.5 for people to use. They now have the ability to use either 2.1 or 2.5. All done on their online IDE. This is what I would eventually like to do, to rewrite my code, get it OUT of the documents, organize the functions (methods / behaviors whatever you want to call them) into logical classes. My OOP classes would of course be focused on educators. 

    I have a set of video tutorials on how to use external code libraries and versions: 1 2 3 4 5

    Working online with tools such as GApps is not without disadvantages. About a year ago, Google made a fairly sizable change to Apps Script. To my dismay, they got rid of the doclist class entirely and replaced it with the "Drive" class. That makes sense as they got out of the Google Docs name ad moved to Google Drive. Of course many of my scripts are based on the Doclist class. Now if would be easy if they just renamed the class from Docslist to Drive but they didn't. They added a bunch of new functionality and even worse for me ... changed how some of the methods work in Docslist when the introduced the new class. Mind you, Google also provided a year of head-notice and lots of support. But it was still hours of work to get out of Docslist and move to Drive. In the end, it was worth it, Drive is a much more comprehensive class and better organized than Docslist.

    I laugh at some of Google's video tutorials on GAS though. I have a programming background but some of their tutorials from their staffers are way over my head. LOL I've heard that Google has a policy of hiring as many brilliant software engineers as they can find. The problem is when you have people like that make tutorials for us folks of normal intelligence it doesn't make sense. :) Kind of reminds me of that onShape tutorial on the cantilever. "Do this this this and that". What took him 10 seconds too me hours to figure out! But then I was a complete beginner back then. 

    Thanks for the link Lou. I filled out the form to be a beta tester for the Onshape API. 
Sign In or Register to comment.