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.

Problems with Extruding in FeatureScript

3966_cad3966_cad Member Posts: 10 EDU
var sketch1 = newSketchOnPlane(context, id + "sketch1", {
                "sketchPlane" : plane(vector(0, 0, 0) * inch, vector(0, 0, 1))
            });
        skRectangle(sketch1, "rectangle1", {
                    "firstCorner" : vector(0, 0) * inch,
                    "secondCorner" : vector(1, 2) * inch
                });
        skRectangle(sketch1, "rectangle2", {
                    "firstCorner" : vector(0.1, 0.1) * inch,
                    "secondCorner" : vector(0.9, 1.9) * inch
                });
        skSolve(sketch1);
        debug(context, sketch1);

        var origin is Vector = vector(0, 0, 0) * inch;
        var extrusion1 = qContainsPoint(qSketchRegion(id + "sketch1"), origin);
        opExtrude(context, id + "extrude1", {
                    "entities" : extrusion1,
                    "direction" : evOwnerSketchPlane(context, { "entity" : extrusion1 }).normal,
                    "endBound" : BoundingType.BLIND,
                    "endDepth" : definition.length * inch
                });
        debug(context, id + "extrude1");
I am trying to code in FeatureScript to generate a part for an assembly to save me the hassle of importing the part and so on. However, I am running into an error: 
"Call qContainsPoint(Query (map), boolean) does not match qContainsPoint(..., Vector)"
I am trying all types of things to solve this, but nothing is working. It would be very helpful if someone could tell me what is wrong with my code.
Thanks

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,173
    I can't reproduce the problem -- when I paste your code (with a length parameter) into a feature studio, I get an extruded frame, as one would expect.  A link to your document would help diagnose what's going on.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • 3966_cad3966_cad Member Posts: 10 EDU
    Got it
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,173
    Ok, I'm seeing a different problem than the one you reported:
    qCreatedBy(sketch1, EntityType.FACE)<br>
    should be
    qCreatedBy(id + "sketch1", EntityType.FACE)

    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    edited July 2017
    Hello!

    I copied your document and if you comment everything out after the first opExtrude it works fine and creates the frame:


    The error I am seeing is:

    Call qCreatedBy(Sketch, EntityType (string)) does not match qCreatedBy(Id, ...)

    Because of line 39:
    qCreatedBy(sketch1, EntityType.FACE)
    should be:
    qCreatedBy(id + "sketch1", EntityType.FACE)

    (qCreatedBy is looking for the feature id, not the sketch object itself)

    If I fix this, there is another issue with your for loop (comparing definition.length with the index doesn't really make sense.  What units would you want the comparison to happen?). It seems like you are trying to compare in inches, so you probably want to do the following:
    for (var i = 0 * inch; i < definition.length; i += 1 * inch)

    Fixing this causes some other issues, but they seem pretty easy to debug (and I'm not sure how to fix them for you because I'm not sure of your design intent).  This is as far as I got:

    https://cad.onshape.com/documents/1d8fbe90b4dc38771754d5ea/w/f33344d354e9aa40dda2fb41/e/3488a77698e7ee8904111756

    Additionally, this may be useful for you:
    https://cad.onshape.com/FsDoc/debugging-in-feature-studios.html
    If you go to the "monitoring execution information" section of the help document, you can see how to use the 'monitor' feature, which will underline exactly the lines that are causing issues.

    Let me know if there is anything else I can help with.

    EDIT: Ilya beat me to it! Thanks Ilya!
    Jake Rosenfeld - Modeling Team
  • 3966_cad3966_cad Member Posts: 10 EDU
    Thanks so much!
Sign In or Register to comment.