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
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
-
Here's a link to a document that shows the issue if that helps at all, be sure to turn on the debug console to the see the logged outputs!
1 -
This has been identified as a bug. We have a fix in QA testing now but it may be too late to make it into the next release. The “legacy” way of creating attributes still works if it is an urgent job.Senior Director, Technical Services, EMEA1
-
Oh thanks! It isn't super urgent we have ways of doing something similar to what this featurescript will eventually accomplish it will just save a lot of time when it works.
0 -
Hi, this still doesn't seem to be working. Are there any updates? Do I need to do anything besides change the imported FeatureScript version?
0 -
@Cappie_Pomeroy
It looks like the fix has been reported prematurely. I'll write a bug to make sure it does not get lost.1 -
I am seeing the same behavior through an opTransform. I assume this is the same underlying issue, and the bug is still active?
0 -
It seems to work fine for me. Maybe there's a bug in your code somewhere?
https://cad.onshape.com/documents/7b3c82f5ec4815aafb09a558/w/deb8382c1af7f568b9ca30cb/e/9f353c1bdd8b025f112429cc
Software Developer at Epic Systems
FRC Design Mentor - Team 1306 BadgerBots0



