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.

How do you write an app?

Lee_HeskethLee_Hesketh Member, Developers Posts: 148 ✭✭✭
Hello, I want to write a cut list app for onshape but I don't know how to do it. I have written a featurescript that queries all the parts and then gets the dimensions. I then want it to export that data to google sheets like the BOM app. How would I go about doing this? Are they written in featurescript or another language completely?
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!

Best Answers

Answers

  • 3dcad3dcad Member, OS Professional, Mentor Posts: 2,475 PRO
    There might be something already in open bom

    @oleg_shilovitsky knows better
    //rami
  • brucebartlettbrucebartlett Member, OS Professional, Mentor, User Group Leader Posts: 2,140 PRO
    @oleg_shilovitsky you will have to forgive me as I haven't used openBoM for a while or tried the geometric dimension's, but keen to again with the right project. Just wondering how do you determine what dimensions you want?
    Engineer ı Product Designer ı Onshape Consulting Partner
    Twitter: @onshapetricks  & @babart1977   
  • oleg_shilovitskyoleg_shilovitsky Member, Developers Posts: 131 PRO
    edited December 2016
    @brucebartlett we extract X, Y, Z dimension solely relying on 3D bounding box. 

    The next update of openBoM will also extract image preview

    Something like this... 



    The same update will also support generation of BOM from Part Studios. 

    Let me know if you have time - I'd love to have an opportunity to catch up and talk. 
  • mbattistellombattistello Member, Developers Posts: 51 ✭✭
    @Lee_Hesketh when I first read your post I was thinking of something like this simple app at http://jonathan.overholt.org/projects/cutlist. The app would read the OnShape doc and parts and then generate a cutlist based on an algorithm that tries to minimize number of cuts to stock and minimize unused material. 

    The OnShape APIs could enable most of this via a connected app. The one challenge is that right now the APIs are more focused on creation of content in OnShape and not as much on interrogating part dimensions. @oleg_shilovitsky also mentions this limitation when he talks about pulling dimensions from the bounding box only. This might work for simple, rectangular parts.

    Another approach would be to embedded the dimensions driving the cutlist in the parts. Either as some custom attributes or in the part number/descriptions. 

    Ive been working with the API for a while and both approaches are possible if your ultimate goal is to do a more automated cutlist. Id be glad to collaborate with you on a demo app if you are interested. 
  • 3dcad3dcad Member, OS Professional, Mentor Posts: 2,475 PRO
    edited December 2016
    @oleg_shilovitsky
    I just gave obom a quick try, it seems to have the problem that I was curious when we talked about dimensions.
    I have a tv stand, dimension xyz are correct for top, bottom and shelf but vertical panels have thickness in x etc..
    And it also seems to show me meter as unit though I have millimeter set as default / in use with this document.

    But this is great progress, going forward I will give it try when creating cutlist for production.
    Cutlists have few other requirements too:
    - Sometimes part dimension contain things like edgeband which thickness need to be reduced if pre-milling is not used to compensate
    - Sometimes parts need to be cut bigger than actual model for routing / pre-milling
    But these are special requirements and are considered usually only in specific software. All these could be covered with named dimensions that are accessible through bom..

    ps. part images in bom looks great, looking forward to new versions
    //rami
  • oleg_shilovitskyoleg_shilovitsky Member, Developers Posts: 131 PRO
    edited December 2016
    @3dcad

    Thank you for the feedback. I have a stupid question - how we supposed to know that it is vertical panel and thickness is coming as X? Is there any information in Onshape that can help us to make this judgement? 

    I think, Onshape API only returns dimensions in meters for the moment, but I might be wrong and we will double check! 

    Thanks for sharing requirements for cutlists. This is probably for the future.

    Images and BOM for Part Studio will be coming in the next version. Stay tuned.

     

  • awkawk Member, Onshape Employees, Developers Posts: 78
    Dimensionally everything in the API is in meters - however there are APIs to establish the preferred units of the specific document (or the user) which you should be able to use to influence how the dimensions are displayed
    Director of API, Appstore, and App Partner Technical Support
  • oleg_shilovitskyoleg_shilovitsky Member, Developers Posts: 131 PRO
    @AndrewKimpton

    thank you! 
  • 3dcad3dcad Member, OS Professional, Mentor Posts: 2,475 PRO
    edited December 2016
    This is what I would like to see before taking apps seriously:
    - Autologin to favorite apps when login to onshape
    - Add quicklaunch so that favorite app is in same level with new part studio / assembly etc.
    - Remove logos etc from apps and put them in as plain text or very small logo in footer or so
    - Use similar icons and ui when applicaple to keep things familiar

    In general I don't wan't to knowledge that I'm running external app inside Onshape when I'm working. Everything should look built-in. IMHO.

    .. I have a stupid question - how we supposed to know that it is vertical panel and thickness is coming as X? Is there any information in Onshape that can help us to make this judgement?

    Yep, that is why I was interested in how is it generally possible to guess such thing. We tend to use X for the dimension along grain if panel has one and Z is always thickness of panel (this way optimization creates correct layouts for cutting).
    I think only way to accomplish this would be that we need to be able to name certain dimension "X" and you call that into bom column X - this is not the name of variable since they are global for all parts in part studio but an additional 'tag' for dimension.

    I would love to use these tags to reference other dimension like #(part1.X)+20
    To be honest, I'm not satisfied at all with current variables.
    //rami
  • oleg_shilovitskyoleg_shilovitsky Member, Developers Posts: 131 PRO
    edited December 2016
    @3dcad

    Thanks for clarifications! It is easy to find the smallest dimension and assume this is Z. However, it might be geometrically incorrect with the Onshape coordinate system. I think, if you create each part independently and follow the same rule (Z is smallest dimension) it will be the case. However, my hunch is that because you create Parts in Part Studio (or multi-body part), as a result Z is not the thickness of the panel. Would you agree? 
  • 3dcad3dcad Member, OS Professional, Mentor Posts: 2,475 PRO
    @oleg_shilovitsky
    Yes, I create multipart studios and some parts have coordinate Z as thickness and some doesn't. But 99,9% of cases Z is the smallest dimension - now we are left with figuring between X and Y:
    - If X = smallest --> X=Z and Z=X
    - If Y = smallest --> Y=Z and Z=Y

    So we just need to flip between smallest and Z if smallest isn't Z coordinate in first place. There are exceptions but this would cover most of cases (for me). 
    //rami
  • oleg_shilovitskyoleg_shilovitsky Member, Developers Posts: 131 PRO
    @3dcad

    It won't be complicated to copy/paste values in current version of openBoM.  

    We have plans to support formulas in openBoM. I cannot confirm the date, but I will keep in mind your use case. 

Sign In or Register to comment.