Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:

  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Export the geometry of a drawing

fredrik_tärnellfredrik_tärnell Member Posts: 25
Hi,

Found a few thread discussing wireframe and on in particular that created a FS to do that 
https://forum.onshape.com/discussion/5437/wires-from-edges-suggestions

It does not seem to work for more complex parts/objects.

What I really want it to "produce and object" like what gets during a drawing creation. But as an object I can export. Would that be possible? But I guess I would need access to the actual geometry rather than the exported faces, right?  

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 2,454
    edited October 8
    This code will do it. Create a Feature Studio, paste this in and press commit. The feature will then be available in your Part Studio.

    annotation { "Feature Type Name" : "Wireframe Edges" }
    export const wireframe = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Parts", "Filter" : EntityType.BODY }
            definition.parts is Query;
    
            annotation { "Name" : "Delete parts" }
            definition.delete is boolean;
        }
        {
            var edges = qOwnedByBody(definition.parts, EntityType.EDGE);
    
            for (var i = 0; i < size(evaluateQuery(context, edges)); i += 1)
            {
                opExtractWires(context, id + ("opExtractWires" ~ i), {
                            "edges" : qNthElement(edges, i) });
            }
    
            if (definition.delete)
            {
                opDeleteBodies(context, id + "deleteBodies", {
                            "entities" : definition.parts });
            }
        });
    
    You can then export the wireframe geometry using STEP by right-clicking the Part Studio tab at the bottom and selecting Export.

    Neil Cooke, Director of Technical Marketing, Onshape Inc.
Sign In or Register to comment.