Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Nesting Parameters-- "precondition analysis failed"?
dave_cowden
Member, Developers Posts: 475 ✭✭✭
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"?
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);
}
}
...
0
Best Answer
-
dave_cowden Member, Developers Posts: 475 ✭✭✭Duh, I figured it out. this annotation:
annotation { "Name" : "ReferencePlane" } was missing the filter clause.
5
Answers