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.

A little help please

billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
I've just posted a new idea and would like it promoted to the top. I don't think it'll get a lot of support on it's own so I'm asking for your help.

https://forum.onshape.com/discussion/10682/api-update-drawing#latest

Drawings lie dormant until someone opens them and clicks on the update button. But what if you have a robot that can change parts for you? That robot can't click on that update button in a drawing tab so all it's documents are stagnant until a human takes the time to open each tab and clicks on update.

Please add update drawing to the api.

Can you please navigate to the link above and vote this enhancement up, please.
Tagged:

Comments

  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    Could you use the network panel in the developer panel in chrome to see what api requests are made to update drawings when a version is created?
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    I don't think I'd want a chrome app scanning the onshape page finding that update button and clicking it. 

    I was hoping app elements might offer some update trick. But I've been told the drawing update button isn't currently accessible in the api.




  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    I am meaning in the chrome F12 developer panel (Firefox or other browsers may have this as well).
    You can see what api requests are made and copy the api request to your app (this was how I found out about getting folders from the api in another thread)
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    I understand now,

    When I click the drawing update icon, a call is made to google analytics:


    The provisional header looks like a onshape call, do you know how to make this call? 

  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    I was meaning when you click the drawing update icon in the create version dialog
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    @billy2

    You can find out-of-date elements using 
    https://cad.onshape.com/api/documents/d/DID/w/WID/outofdatedelements
    Then you can send a POST call to 
    https://cad.onshape.com/api/documents/d/DID/w/WID/syncApplicationElements?applicationElementIds=EID1&applicationElementIds=EID2&description=Update+drawings
    to update the drawings, repeating the applicationElementIds parameter to add elements as necessary

    EID: element id
    DID: document id
    WID: workspace id
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    buried right now, will try soon

    thanks
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    I've got the get call working:


    This is looking really promising, I'm working on the post call next thinking it'll work also.


  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    edited December 2018
    For those of you that are following along.....

    @mbartlett21 has suggested using chrome's developer console to hack the call that updates a drawing(s) and I'll expose what he's talking about to help explain the basic concepts of the cloud (servers talking to servers).

    Before the call:


    Above you see onshape and the drawing update dialog found in create version dialog. You'll also see Chrome's developer console on the bottom of the screen. I'm going to turn Chrome's recorder on and capture the calls made from my client browser and the onshape server.

    After the call:


    So you can see a ton of calls between client and server after clicking on the update button. At the top of the list is the post call that I need to build and construct my app.

    The request url for the post is:
    If you cut'n paste the address above into your browser, you'll get an error because you don't have the permissions.

    @mbartlett21 how'd you'd figure this out? 

    So I need to construct the post, wait for the onshape servers to update drawing, create a pdf output, add pdf to my page. Oh yeah, I need to flash "updating drawing" while this going on.






  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    edited December 2018
    The good news is that I got the post to update the drawing and it worked, thanks @mbartlett21 .

    The bad news is that part studios & drawings with configurations aren't tied together. Changing the part studio won't change the configuration in a drawing. I'm not complaining about this because from a user's perspective it's really powerful. But from a programmers perspective, this sucks.

    I guess my request for "drawing update" should have read "change drawing view configuration".

    @mbartlett21 I tried your hack to figure out how to change a drawing view configuration but it didn't seem meaningful. Do you have any other tricks?





    Is there any way to tie the drawing view to a specific part studio configuration? 


  • sebastian_glanznersebastian_glanzner Member, Developers Posts: 398 PRO
    billy2 said:

    Is there any way to tie the drawing view to a specific part studio configuration? 
    In an assembly you can change the configuration of a Part. Then you just make a Drawing of the assembly. Might be worth a try!
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    @sebastian_glanzner good idea, will give that a try. Was thinking a derived component also.

    Thanks
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    edited December 2018
    Tried all ways to update configuration data, haven't figured it out. May have to wait.

    When you want to use a part with a configuration, inside an assy, derived part or drawing; you have to define the configuration for the part being used. This functionality isn't currently accessible in the API.

    The closest I got was to "update feature" in a derived part feature but this only caused the feature to error. I could only break things.

    If anyone knows how to update the derived part configuration using "update feature" please let me know. 




    Using configurations seems like the best option to control assemblies, derived parts & drawings. It's worth the wait for the API to catch up and offer ways to change these configuration states. I'll wait. For the user, it's a really powerful way to handle configuration variation throughout a project allowing any permutation in a stable state. Just wish I could bang on it using the API.


  • brucebartlettbrucebartlett Member, OS Professional, Mentor, User Group Leader Posts: 2,137 PRO
    edited December 2018
    I was hoping for assy configurations for Christmas. But may have to wait a little longer.  
    Engineer ı Product Designer ı Onshape Consulting Partner
    Twitter: @onshapetricks  & @babart1977   
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    @mbartlett21 I voted it up, thanks for the link.

    @brucebartlett assy configurations will be a nice thing.



  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    December 4 + 3 weeks = December 25 :)
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,305
    @mbartlett21 surely you must have heard the phrase "Christmas comes early"? :)

    Senior Director, Technical Services, EMEAI
  • brucebartlettbrucebartlett Member, OS Professional, Mentor, User Group Leader Posts: 2,137 PRO
    NeilCooke said:
    @mbartlett21 surely you must have heard the phrase "Christmas comes early"? :)

     Back to a Friday releases sounds good but no pressure, always happy to get a new release but only when they are ready. 
    Engineer ı Product Designer ı Onshape Consulting Partner
    Twitter: @onshapetricks  & @babart1977   
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    edited January 2019
    I seem to have got the derived feature working, except for the geometry ids
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,014 PRO
    Not sure I'm following, can you update a configuration?


  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    I think I will have to generate a Query to put into it, as the geometry ids change when the configuration is changed
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
Sign In or Register to comment.