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.
I'm new in OnShape Script. I need to get ALL vertices in MESH DATA
carlo_amanti
Member, Developers Posts: 9 ✭
I try to get some information from standard feature, but i've found only a single pick. It's possible to get all vertices to make Reverse Engineering functions?
var HkFHsuZZvqGABe_query;
HkFHsuZZvqGABe_query = makeQuery(id + "F6b3iaE6aysjsLh_0.merge.FwfB7UYxFAubFwQ.importOp", "IMPORT", EntityType.FACE, { "importTag" : 0.0 });
annotation { "Feature Name" : "Mesh point" }
cPoint(context, id + "FmkO3t4rtgA8ZBT", { "pointType" : PointType.MESH_POINT, "mesh" : qUnion([HkFHsuZZvqGABe_query]),
"x" : { 'value' : try(0.007071100175380707 * meter), 'expression' : "0.007071100175380707 m" }.value,
"y" : { 'value' : try(-0.009999999776482582 * meter), 'expression' : "-0.009999999776482582 m" }.value,
"z" : { 'value' : try(0.007071100175380707 * meter), 'expression' : "0.007071100175380707 m" }.value });
var WwWePlgJmkBLnb_query;
WwWePlgJmkBLnb_query = qCreatedBy(id + "FmkO3t4rtgA8ZBT", EntityType.VERTEX);
debug(context, WwWePlgJmkBLnb_query);
for (var vertex in evaluateQuery(context, WwWePlgJmkBLnb_query))
{
const vertexPoint = evVertexPoint(context, { "vertex" : vertex });
debug(context, vertexPoint);
}
Thank
Carlo
Thank
Carlo
0
Best Answer
-
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565Hi and welcome to Onshape!
There's no direct way in FeatureScript to do what you're asking. Onshape has ways of referencing individual vertices, but no way to programmatically use all vertices in a full mesh.
What is your ultimate goal? If you just need the point data, you can obtain this information directly by converting to .obj or a similar format. If you need to move, stretch, or scale the data, you can use Onshape's transform tool and re-export as STL. If you need to do geometric work on every point, a BREP-based CAD system like Onshape is not the ideal way to work with this data — the functionality is (primarily) designed for high-precision, analytical surfaces, not faceted surfaces approximated with a huge number of points.
1
Answers
There's no direct way in FeatureScript to do what you're asking. Onshape has ways of referencing individual vertices, but no way to programmatically use all vertices in a full mesh.
What is your ultimate goal? If you just need the point data, you can obtain this information directly by converting to .obj or a similar format. If you need to move, stretch, or scale the data, you can use Onshape's transform tool and re-export as STL. If you need to do geometric work on every point, a BREP-based CAD system like Onshape is not the ideal way to work with this data — the functionality is (primarily) designed for high-precision, analytical surfaces, not faceted surfaces approximated with a huge number of points.
your answer is very clear.
I can tell you that i try to porting one C# dll that use new ideas to make reverse engineering conversion from mesh to analytic surfaces.
So no problem to convert geometric functions, but now we can only use OnShape with REST + script because the first operation (triangles vertices to XYZ OnSHape points) is all on the client .exe. The goal can be to use also feature script running on the OnShape server and in the future insert our tecnology inside OnSHape standard library (we are in contact with OnShape team that offer complete collaboration).
So now we continue step by step and we try to put the first prototype in sharing with the community as soon as possible so everyone can see what we can do and also improve our work.
Sorry for my poor English and thank for the answer.
your answer is very clear.
I can tell you that i try to porting one C# dll that use new ideas to make reverse engineering conversion from mesh to analytic surfaces.
So no problem to convert geometric functions, but now we can only use OnShape with REST + script because the first operation (triangles vertices to XYZ OnSHape points) is all on the client .exe. The goal can be to use also feature script running on the OnShape server and in the future insert our tecnology inside OnSHape standard library (we are in contact with OnShape team that offer complete collaboration).
So now we continue step by step and we try to put the first prototype in sharing with the community as soon as possible so everyonecan see what we can do and also improve our work.
Sorry for my poor english and thank for the answer.
Carlo