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.

Options

extending Neil Cooke 's port feature won't work

tonvistonvis Member Posts: 41 ✭✭
https://cad.onshape.com/documents/537978ffd6db628ae304a014/w/c4df816f6f58ef48a64f3b91/e/2faa916019fd524dd61d27ac

Can someone please helpme out.  Selecting other enums will not work , only the last in a row gets  selected.
I tryed everything but I can't  find any mistake.


Part of code:
---------------------

annotation { "Feature Type Name" : "Ports_generator",
        "Feature Name Template" : "#screwtype Screw",
        "Editing Logic Function" : "editPortLogic" }

//export const portFeature = defineFeature(function(context is Context, id is Id, definition is map)
export const Ports_generator = defineFeature(function(context is Context, id is Id, definition is map)
    precondition
    {
        annotation { "Name" : "Screw" }
        definition.screw is ScrewType;


       // no way to get this "SAE " enum done !, BSP  dimensions will always be selected

        if (definition.screw == ScrewType.SAE)
        {
            annotation { "Name" : "SAE" }
            definition.portSize is PortSize;
        }

      
        if (definition.screw == ScrewType.BSP)
        {
            annotation { "Name" : "BSP " }
            definition.bspportSize is BSPPortSize;
        }

        annotation { "Name" : "Points", "Filter" : EntityType.VERTEX }
        definition.points is Query;

        annotation { "Name" : "Depth" }
        isLength(definition.depth, DEPTH_BOUNDS);
    }

Many thanks for your help.
tonvis

Best Answer

Answers

  • Options
    lanalana Onshape Employees Posts: 693
    edited January 2019
    I think, you want this in precondition 
           if (definition.screw == ScrewType.SAE)
            {
                annotation { "Name" : "SAE" }
                definition.portSize is PortSize;
            }
            if (definition.screw == ScrewType.BSP)
            {
                annotation { "Name" : "BSP " }
                definition.bspportSize is BSPPortSize;
            }

    while your feature studio has this

    if (definition.screw == ScrewType.BSP)
                if (definition.screw == ScrewType.SAE)
            {
                annotation { "Name" : "SAE" }
                definition.portSize is PortSize;
            }

            {
                annotation { "Name" : "BSP " }
                definition.bspportSize is BSPPortSize;
            }
  • Options
    tonvistonvis Member Posts: 41 ✭✭
    Lana thanks for your help.

    You are right ,this is my fault. Due to many trials I made a typing  error  there .But correcting the feature according your comment does not help to solve the problem. There is something else going wrong. I am looking in all kind of feature scripts  for over a week, but can't find the solution.
    Selection another enum will not activated , and there is no error message.
    Can you please give it another eye.

    https://cad.onshape.com/documents/537978ffd6db628ae304a014/w/c4df816f6f58ef48a64f3b91/e/de74c96ae6e157189c9be65d

    Best regards
    tonvis
Sign In or Register to comment.