Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export each part as separate STL and STEP file from console #262

Open
semixor opened this issue Mar 25, 2024 · 8 comments
Open

Export each part as separate STL and STEP file from console #262

semixor opened this issue Mar 25, 2024 · 8 comments
Labels

Comments

@semixor
Copy link

semixor commented Mar 25, 2024

Hello,
is it possible to export each part of CAD (STEP) file as a separate STL and also STEP file from console ?
also wondering if it's possible to export faces of each part as STL ?

Frankly speaking, I'm doing this with FreeCAD but it's very slow on big assemblies, tested Mayo and it's blazing fast, would be nice if you guys can help on this.

Thank you.

@HuguesDelorme
Copy link
Member

Hello @semixor
For your purpose I think the most flexible solution would be scripting support
This has to be implemented and then scripting in Mayo would allow you to visit assemblies by JS(JavaScript) code and do whatever is required(eg export parts to STL files in your case)

Mayo should also support executing a scripting file from command line and exit

What do you think of that solution?

@semixor
Copy link
Author

semixor commented Apr 4, 2024

Hello @HuguesDelorme,
Absolutely ! This is the best solution !
Also would be nice to have some control over it, like ability to export the wires(edges) for later visualization in ThreeJS for example etc.

Looking forward when you will be able to implement it, many thanks, can't wait !

@semixor
Copy link
Author

semixor commented May 2, 2024

Hello @HuguesDelorme , any status update on this ?

@HuguesDelorme
Copy link
Member

HuguesDelorme commented May 2, 2024

Hello @semixor
I started to work on scripting support in the feature/scripting branch
For now it's providing basic DOM-like access to Mayo data, here is an testing example script:

console.debug("Mayo version: " + application.versionString);
console.debug("Document count: " + application.documentCount);
for (let i = 0; i < application.documentCount; i++) {
    let doc = application.documentAt(i); // Access i-th document
    console.debug("Document: " + doc.name);
    console.debug("    filePath: " + doc.filePath);
    console.debug("    entityCount: " + doc.entityCount);
}

if (application.documentCount > 0) {
    let doc = application.documentAt(0); // Access 1st document
    doc.traverseModelTree(
        nodeId => {
            console.debug(
                "treeNodeId: " + nodeId
                + " name: " + doc.treeNodeName(nodeId)
                + " parentId: " + doc.treeNodeParent(nodeId)
                + " tag: " + doc.treeNodeTag(nodeId)
            );
        }
    );
}

The next important things to be supported are:

  • access to BRep shapes and their underlying geometry
  • reader/writer per file format

For writer objects it's not easy to support what you ask "ability to export faces of a part and wires(edges)" because the smallest thing that can be exported is a "node" in the model tree. A model tree node in Mayo being an assembly, instance or part.
Maybe the solution is to make writer objects support exporting of TDF_Label directly. So if you want to export a shape(face, wire, ...) then the scripting API should allow to add a label for that shape(XDE) and pass the label to the writer.

@semixor
Copy link
Author

semixor commented May 6, 2024

Hi @HuguesDelorme this is very nice, looking forward to be able to work with it, great job, thank you !

@semixor
Copy link
Author

semixor commented May 14, 2024

Hi @HuguesDelorme when I will be able to test this beautiful work :) ? Thanks !

@HuguesDelorme
Copy link
Member

@semixor
I've been working on different topics on Mayo these last weeks, I should have focused on a single one...
Going to work on JS scripting again, looks like a very valuable feature for the user
Will let you know about significant work pushed on the feature/scripting branch

@semixor
Copy link
Author

semixor commented May 17, 2024

Hi @HuguesDelorme ,
Thank you so much for the update !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants