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.
Convert column in imported CSV to a user selectable list
shawn_crocker
Member, OS Professional Posts: 902 PRO
Title says it all. Just can't figure out how this is done. CUSTOM SHEET METAL FEATURES | sheetMetalStart.fs Copy 1 (onshape.com)
Thanks so much if you can provide an example or point to one.
Thanks so much if you can provide an example or point to one.
Tagged:
0
Best Answers
-
NeilCooke
Moderator, Onshape Employees Posts: 5,909
Sorry to lead you astray there @Alex_Kempen but all user interface components must be static so nothing can be done on the fly.What I was referring to was some sort of external parsing code that could convert csv into a map suitable for a LookUpTable. You would then have to copy/paste the resulting text into a separate Feature Studio and reference that in your feature. So if the csv changes you would have to update your feature each time.Senior Director, Technical Services, EMEA0 -
shawn_crocker
Member, OS Professional Posts: 902 PRO
So your saying I can do the processing of the csv in a feature studio to create a map for export and then import that map into my feature to use as the lookup table reference? Or are you saying no matter what, the map for the lookup table has to be literally written out either in a separate studio or directly in the actual features studio? If the latter is so, anyone know why the limitation exists? It would be so useful to be able to generate a list by simply update a csv or selecting one using a csv input parameter.NeilCooke said:Sorry to lead you astray there @Alex_Kempen but all user interface components must be static so nothing can be done on the fly.What I was referring to was some sort of external parsing code that could convert csv into a map suitable for a LookUpTable. You would then have to copy/paste the resulting text into a separate Feature Studio and reference that in your feature. So if the csv changes you would have to update your feature each time.0 -
NeilCooke
Moderator, Onshape Employees Posts: 5,909
yeah the second one unfortunately.Senior Director, Technical Services, EMEA0
Answers
FRC Design Mentor - Team 1306 BadgerBots
Thanks. I will have to do some experimenting with reusing existing code and just creating a new interface. For the time being, I have just created an enum that matches the values in the csv. It works OK for me but my secondary goal is to have a feature that other people can use without having to dig into the code to use.
2.5 years later and I am finally revisiting this.
FeatureScript 2180; import(path : "onshape/std/common.fs", version : "2180.0"); tableImport :: import(path : "f0d380b93788decd49c82f69", version : "eee16caca18b5c1eee402ab8"); const tablePlot = tableImport::BLOB_DATA.csvData; function test(x) { var z = {}; z[x] = {"name" : x}; return z; } const test2 = test(tablePlot[0]); export const sizeTable = { "name" : "region", "displayName" : "Region", "entries" : test2, }; annotation { "Feature Type Name" : "My Feature" } export const myFeature = defineFeature(function(context is Context, id is Id, definition is map) precondition { annotation { "Name" : "Soda size", "Lookup Table" : sizeTable } definition.size is LookupTablePath; } { });The error looks like this:
Any guidance on this would be great. Being able to reference a csv to drive a list of options would greatly streamline some features I have cobbled together.