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.

Global configuration in the document. My workaround. How to make it works?

vijit_codervijit_coder Member Posts: 11
edited December 2020 in FeatureScript
I spent a few hours of digging in the forums and manuals. I know that Onshape still hasn't a normal way to make global configuration at least in the bounds of the document. Ok.

I tried to invent the crutch. And I almost made it, I think. But it doesn't work :(
Here is the demo document - https://cad.onshape.com/documents/057ed93cbbf4ea11c405e9ed/w/4b232b5d232857ea4f611124/e/06d16d4e725713c329d7b24a.

Tab "configuration" - it should be a global config of the document. No sketches there, only configurations.
Tab "fs.globals" is a crutch itself. It serves as a bridge between Configuration and other PartStudios. Mapping of configuration to variables.
Tab "demo" - demo part studio.

At the first glance it works. I specified some values in the config and used their mapped variables in the demo sketch. As you can see the rectangle in size of the config values.

But when I changing the configuration it doesn't apples anymore to my sketch. Even if I'll draw a new objects, they still "see" the old config values mapped to the variables.

So, how to update FS variables when configuration changed?

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,307
    That's not going to work because config variables are treated differently than feature variables. When you call the build() function, it is not reading the user-set config variables (because a Part Studio can have infinite variations). I'm sure there's a better explanation, but that's the long and short of it. Take a look at "instantiator" which might give you more background or ideas.
    Senior Director, Technical Services, EMEAI
  • vijit_codervijit_coder Member Posts: 11
    Got it. Thanks.
  • Alex_KempenAlex_Kempen Member Posts: 244 EDU
    I have a FeatureScript for this currently in the works, which uses setAttributes to read off attributes previously set with FS in another part studio. I plan on releasing it sometime in the next week or so. You can find more info about it in this forum thread.
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • vijit_codervijit_coder Member Posts: 11
    I saw that thread already.

    My intention is to share configuration, not the variables in the PartStudio. It's a big difference from the user point of view.

Sign In or Register to comment.