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.

Forum Code Block's Broken

MichaelPascoeMichaelPascoe Member Posts: 1,988 PRO
edited July 23 in General
This code should be on multiple lines. It is making it hard to help people @NeilCooke.

FireFox:
FeatureScript 2411;<br>import(path : "onshape/std/common.fs", version : "2411.0");<br><br>annotation { "Feature Type Name" : "My Feature", "Feature Type Description" : "" }<br>export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)<br>    precondition<br>    {<br>        // Input for selecting a sketch<br>        annotation { "Name" : "Sketch", "Filter" : EntityType.FACE }<br>        definition.sketch is Query;<br>    }<br>    {<br>        opExtrude(context, id + "extrude1", {<br>                    "entities" : definition.sketch,<br>                    "direction" : evOwnerSketchPlane(context, { "entity" : definition.sketch }).normal,<br>                    "endBound" : BoundingType.THROUGH_ALL,<br>                    "endDepth" : 1 * inch<br>                });<br><br>        const extrudedPart = qCreatedBy(id + "extrude1", EntityType.BODY);<br>        var targets = qAllSolidBodies();<br>        targets = qSubtraction(targets, extrudedPart);<br><br>        opBoolean(context, id + "boolean1", {<br>                    "tools" : extrudedPart,<br>                    "targets" : targets,<br>                    "operationType" : BooleanOperationType.SUBTRACTION<br>                });<br>    });


Learn more about the Gospel of Christ  ( Here )

CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴

Comments

  • MichaelPascoeMichaelPascoe Member Posts: 1,988 PRO
    Chrome:
    FeatureScript 2411;
    import(path : "onshape/std/common.fs", version : "2411.0");
    
    annotation { "Feature Type Name" : "My Feature", "Feature Type Description" : "" }
    export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            // Input for selecting a sketch
            annotation { "Name" : "Sketch", "Filter" : EntityType.FACE }
            definition.sketch is Query;
        }
        {
            opExtrude(context, id + "extrude1", {
                        "entities" : definition.sketch,
                        "direction" : evOwnerSketchPlane(context, { "entity" : definition.sketch }).normal,
                        "endBound" : BoundingType.THROUGH_ALL,
                        "endDepth" : 1 * inch
                    });
    
            const extrudedPart = qCreatedBy(id + "extrude1", EntityType.BODY);
            var targets = qAllSolidBodies();
            targets = qSubtraction(targets, extrudedPart);
    
            opBoolean(context, id + "boolean1", {
                        "tools" : extrudedPart,
                        "targets" : targets,
                        "operationType" : BooleanOperationType.SUBTRACTION
                    });
        });


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • MichaelPascoeMichaelPascoe Member Posts: 1,988 PRO
    I think it is a copy issue with some browsers. I had to copy it from a chrome Feature Studio for it to work.

    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,680
    Not wanting to throw @lougallo under the bus, but I’m throwing him under the bus here. 
    Senior Director, Technical Services, EMEAI
Sign In or Register to comment.