Nesting Parameters-- "precondition analysis failed"?

dave_cowden
dave_cowden Member, Developers Posts: 484 ✭✭✭
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