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.

Access values found in configuration tables

eric_ma454eric_ma454 Member Posts: 14
Hi all,

After changing the featurescript ID values, how can you access the sub values for each column? For instance on the attached image, if the user selects the parameter of _3_8 (3/8) and it is instantiated,
how would the #socket_depth value be drawn from that particular chosen configuration?

Best,
Eric Ma
AguaClara Cornell

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,683
    I don't think that's possible. Instantiating just brings in the bodies, not the feature definition.
    Senior Director, Technical Services, EMEAI
  • eric_ma454eric_ma454 Member Posts: 14
    @NeilCooke
    Since the part studio is also imported at the beginning of the feature code, does the import itself contain data on the configuration table? When the user inputs a configuration, all we would need to do is find this value separate of the instantiation. Would that allow access to the configuration table?
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    @eric_ma454
    No, it is not possible.
    You will have to recreate the data in the FeatureScript.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    The values in the table are not accessible from the outside. But, the way to expose those values to custom features is to set them as variables... which you've already done :smile:

    Currently, the instantiator code itself does not expose direct access to the other context (i.e. the Part Studio you're bringing it), but it's easy enough to do it yourself. For instance, let's say you already have code like this:
    addInstance(instantiator, PART_STUDIO::build, {
        "configuration" : partStudioConfiguration
    });
    You can also, at any point, get the context of the PART_STUDIO you want, using that same build function, and that same configuration. And from that context you can get your variable values:
    PART_STUDIO::build(partStudioConfiguration);
    const myVariable is ValueWithUnits = getVariable(otherContext, "socket_depth");const otherContext = 

    Generally we encourage using the instatiator instead of calling the build function directly like this, so it would be good to have some ability for the instantiator itself to return variable values in the context. That would be even easier and run faster than the code above. If you're interested in that, please submit an improvement request!
Sign In or Register to comment.