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

Nesting Parameters-- "precondition analysis failed"?

dave_cowdendave_cowden Member, Developers Posts: 470 ✭✭✭
I'm trying to use a feature to conditionally define other features. I see this done in many of the std features, but I get an error "precondition analysis failed" when using the pattern myself.

Why does this code produce "precondition analysis failed"? 
export enum AnsiOringType{
    
    annotation { "Name" : "AS568-001" }
    AS568_001,
    
    annotation { "Name" : "AS568-002" }
    AS568_002,
    
    annotation { "Name" : "AS568-003" }
    AS568_003
    
    //and 932 more :(
}

export enum LocationOffsetType{
    annotation{ "Name" : "Offset From Plane" }
    PLANE_OFFSET,
    
    annotation{ "Name" : "On Plane" }
    PLANE
    
    //annotation{ "Name" : "Vertex" }
    //VERTEX
    
}
export const oRing = defineFeature(function(context is Context, id is Id, definition is map)
    precondition
    {
        annotation { "Name" : "ANSI TYPE" }
        definition.ansiType is AnsiOringType;
        
        annotation { "Name" : "CylindricalFace", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 1 }
        definition.referenceFace is Query;
        
        annotation { "Name" : "LocationType" }
        definition.locationType is LocationOffsetType;
        
        annotation { "Name" : "ReferencePlane" }
        definition.refPlane is Query;           
         //the conditional definition here is what causes the error. //builtin features do this., but here it doesn't work?
        if ( definition.locationType == LocationOffsetType.PLANE_OFFSET ){
            
            annotation { "Name" : "OffSet" }
            isLength(definition.offset, LENGTH_BOUNDS);            
          
        }
               
        
    }
...


Best Answer

Answers

Sign In or Register to comment.