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

Exporting variables to csv, txt file or similar

Joey_WoodJoey_Wood Member Posts: 1
Hello,

I have a large number of variables, the values of which are generated from the Measure Value featurescript (similar to Measure Distance). I would then like to export those variables to a separate program (specifically matlab for running analysis). Right now my workflow is to manually type each value each time I update the part studio. Obviously for large amounts of data this is extremely tedious and not a scalable approach. Does anyone have ideas for automating this process using featureScript? Attached is the sort of dataset I am working with. Each variable there is a coordinate in x,y,z generated using the Measure Value feature (Thank you Konstantin): https://cad.onshape.com/documents/77baa8153589a7fc5f289829/v/33ba34fba75bf5f4ba08ed63/e/181cb871f3008e6b885df46a.


Comments

  • Options
    Alex_KempenAlex_Kempen Member Posts: 244 EDU
    There isn't currently a way to generate an export directly using FeatureScript directly - you'd have to dive into the API for that. Accordingly, the easiest way is probably to write a custom FeatureScript which formats your data into a custom table, which would then allow you to copy and paste all of your data into the program of your choosing. To avoid having to manually enter all of your variable names into the table manually, you could write a custom version of the Measure value FeatureScript to collect the values of all of the created variables.

    Specifically, you could change the Measure value FeatureScript to create a master variable that contains the relevant values created by the Measure value feature. Subsequent Measure value features would then be able to add their values to the master variable. You could then write a table feature that takes in the master variable automatically and formats the corresponding values for easy copy and pasting. You could also do this using attributes attached to dummy parts, which is what my Variable Library FeatureScript does in order to pass variables between part studios. Either method is fairy straightforward to implement, but it could be pretty challenging to users who are new to programming or FeatureScript in general.
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • Options
    konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited August 2021
    Yes, as Alex said creating a custom table should be a way to go for this, you just need to modify measure value feature to store the measurement info in the attribute or in the context variable with the known name.
Sign In or Register to comment.