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.
Splitting Parts Removes Attributes
Cappie_Pomeroy
Member Posts: 14 ✭
According to the docs at https://cad.onshape.com/FsDoc/library.html#module-attributes.fs
"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
Tagged:
0
Comments
It looks like the fix has been reported prematurely. I'll write a bug to make sure it does not get lost.
https://cad.onshape.com/documents/7b3c82f5ec4815aafb09a558/w/deb8382c1af7f568b9ca30cb/e/9f353c1bdd8b025f112429cc
FRC Design Mentor - Team 1306 BadgerBots