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.
Adding texture by iterating through all faces in a part
j_j406
Member Posts: 6 ✭
Hi, I am working on a feature script for surface texture generation and ran into an issue with iterating through all faces of a part.
It is a three step process
1. Split all faces along Z axis - works fine
2. Split all faces along X axis - works fine
3. Iterate through all faces and apply a random move using opMoveFace(...) - this does not work as expected. My current implementation does not iterate through all faces
for (var aFace in qOwnedByBody(definition.partToCut, EntityType.FACE))
{
i=i+1;
println(aFace);
println("------------------------");
/*opMoveFace(context, id + i+"moveFace", {
"moveFaces" : qOwnedByBody(definition.partToCut, EntityType.FACE),
"transform" : transform(vector(rnd2(), 0, 0) * millimeter)
});*/
}
{
i=i+1;
println(aFace);
println("------------------------");
/*opMoveFace(context, id + i+"moveFace", {
"moveFaces" : qOwnedByBody(definition.partToCut, EntityType.FACE),
"transform" : transform(vector(rnd2(), 0, 0) * millimeter)
});*/
}
Can you advice what the problem might be?
0
Comments
for (var aFace in allfaces)