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.

CONFIGURATION OVERRIDE IN INSTANTIATOR

Kira_LeeKira_Lee Member, Developers Posts: 17 PRO
I am trying to use the Configuration Override in addInstance, but whether "Unsuppressed" is toggled on or off, the feature doesn't remove the Chamfer. The code below is where I'm not understanding what is going wrong, and the full document can be found here.

var instantiator = newInstantiator(id + "instantiator");

        var body = addInstance(instantiator, TEST::build, {
                "configuration" : { "Chamfer" : TEST::Chamfer_conf[definition.Name as string] },
                "configurationOverride" : { "Unsuppressed" : false },
                "transform" : transform
            });

        instantiate(context, instantiator);

        opBoolean(context, id + "boolean", {
                    "tools" : body,
                    "targets" : qSubtraction(qBodyType(qEverything(EntityType.BODY), BodyType.SOLID), qCreatedBy(id + "instantiator")),
                    "operationType" : BooleanOperationType.SUBTRACTION
                });
The basic idea of what I want to eventually do with it is I want to be able to change configurations while toggling this one sketch/revolve. The Row ID's for the main body and the chamfer are the same, so ideally I will be able to always show the main body (named Orientation) and toggle the chamfer - I haven't gotten this far yet since I still cannot toggle the one sketch, but any advice on that portion would be greatly appreciated too! 

Thanks in advance!

Best Answer

  • chadstoltzfuschadstoltzfus Member, Developers Posts: 93 PRO
    Answer ✓
    So one thing I see initially is the use of "configuration" and "configurationOverride" in the map parameter addInstance(). There are two versions of the addInstance() function, one that uses a buildfunction and another that uses PartStudioData. The one you are using is using the buildfunction, so you should be using just the "configuration" field. 

    So looking at the document, I do not see any "Unsuppressed" configuration option. I am assuming you're trying to get into the "Unsupressed" option inside of one of your drop down configuration parameters. The "Unsuppressed" field inside of configuration parameters is not exposed to the addInstance() function, so what I would recommend is to create a configuration parameter that suppresses or unsuppresses the chamfer. Actually, you could just make a third option in your "Chamfer" drop down called "Suppressed" and set it up in the configuration options to suppress the chamfer when that option is selected. Your code would then look like:
            var body = addInstance(instantiator, TEST::build, {
                    "configuration" : { "Chamfer" : TEST::Chamfer_conf[definition.Name as string] },
                    "transform" : transform
                });

Answers

  • chadstoltzfuschadstoltzfus Member, Developers Posts: 93 PRO
    Answer ✓
    So one thing I see initially is the use of "configuration" and "configurationOverride" in the map parameter addInstance(). There are two versions of the addInstance() function, one that uses a buildfunction and another that uses PartStudioData. The one you are using is using the buildfunction, so you should be using just the "configuration" field. 

    So looking at the document, I do not see any "Unsuppressed" configuration option. I am assuming you're trying to get into the "Unsupressed" option inside of one of your drop down configuration parameters. The "Unsuppressed" field inside of configuration parameters is not exposed to the addInstance() function, so what I would recommend is to create a configuration parameter that suppresses or unsuppresses the chamfer. Actually, you could just make a third option in your "Chamfer" drop down called "Suppressed" and set it up in the configuration options to suppress the chamfer when that option is selected. Your code would then look like:
            var body = addInstance(instantiator, TEST::build, {
                    "configuration" : { "Chamfer" : TEST::Chamfer_conf[definition.Name as string] },
                    "transform" : transform
                });
Sign In or Register to comment.