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.

Splitting Parts Removes Attributes

Cappie_PomeroyCappie_Pomeroy Member Posts: 14
edited November 2020 in FeatureScript
"Attributes stay with the entity they are defined on, even as the Part Studio changes. An attribute on a face, edge, or body which is split in two will be set with the same name and value on both split pieces."

However, the following feature script.
FeatureScript 1403;
import(path : "onshape/std/geometry.fs", version : "1403.0");
annotation { "Feature Type Name" : "My Feature" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
precondition
    {
        // Define the parameters of the feature type 
       annotation { "Name" : "My Query", "Filter" : EntityType.BODY, "MaxNumberOfPicks" : 1 }
        definition.myQuery is Query;
    }
    {
        // Define the function's action
        setAttribute(context, {
                "entities" : definition.myQuery,
                "name" : "myName",
                "attribute" : "myValue"
        });
        debug(context, getAttributes(context, {
                "entities" : qEverything(EntityType.BODY),
                "name" : "myName"
        }), DebugColor.BLUE);
        opPlane(context, id + "plane1", {
                "plane" : plane(XY_PLANE.origin, XY_PLANE.normal)
        });
        opSplitPart(context, id + "splitPart1", {
                "targets" : definition.myQuery,
                "tool" : qCreatedBy(id + "plane1", EntityType.BODY)
        });
        debug(context, getAttributes(context, {
                "entities" : qEverything(EntityType.BODY),
                "name" : "myName"
        }), DebugColor.BLUE);
    });

Will log:

debug: [ "myValue" ]
debug: []
  Result: Regeneration complete

What am I missing?  The attribute is being completely removed it doesn't stay on either body after the split let alone both like the docs say.  I hope that I'm doing something wrong or that this is a bug because it would be very useful for me if the attributes stay on both bodies.



Comments

Sign In or Register to comment.