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.
setProperty{ .... PropertyType.APPEARANCE...} face vs part priority?
S1mon
Member Posts: 2,943 PRO
[For background you may want to reference this thread]
I have a custom feature (call it "UM") which successfully sets the color of a part like so:
I'm also using @Evan_Reese 's Part Color (let's call it "PC") feature which uses basically the same setProperty code.
I have a part studio with both PC and UM features. If they both are setting part level colors, then whatever color gets set last (either through UM or PC) will be what the user sees. If either feature (UM or PC) sets faces, then the faces will override the part color, no matter what order the features are in.
Is this expected behavior with part and face color properties?
Is there anyway to code this differently so that part level colors override faces? (I assume I could iterate through all the faces and that would work, but I assume that will be slower than coloring the part)
I have a custom feature (call it "UM") which successfully sets the color of a part like so:
setProperty(context, {
"entities" : entities,
"propertyType" : PropertyType.APPEARANCE,
"value" : theColor,
"allowFaces" : true
});
I'm also using @Evan_Reese 's Part Color (let's call it "PC") feature which uses basically the same setProperty code.
I have a part studio with both PC and UM features. If they both are setting part level colors, then whatever color gets set last (either through UM or PC) will be what the user sees. If either feature (UM or PC) sets faces, then the faces will override the part color, no matter what order the features are in.
Is this expected behavior with part and face color properties?
Is there anyway to code this differently so that part level colors override faces? (I assume I could iterate through all the faces and that would work, but I assume that will be slower than coloring the part)
Tagged:
0
Comments
Thanks for the quick answer to the first question (unfortunately not a surprise).
Any thoughts on the second question?
I used
var partFaces = qOwnedByBody(definition.parts, EntityType.FACE);
I added a boolean option to color parts by faces or by part. A few interesting things:
Not sure it's relevant to your use case but you might want to keep that in mind, I believe if you added a feature to the part after running the FS, newly created faces would take on the part level color (eg: sides of a cut or a new extruded boss).