Example: A Parametric Design for a Blender Cover
This example illustrates the logic of the design and the usage of INPUT, EXECUTE, and IF-ELSE statements. The format of the ADD FEATURE statements in the part design has been simplified. The explanations in square brackets are for information only and do not appear in a normal listing.
|
You can download the model for this example here.
|
Creating a Parametric Design
1. Assembly 1
2. Assembly 2
3. Assembly 3
4. COVER_TYPE=NO
5. CYL_DIAM
6. CAP: MODEL_A
7. COVER_TYPE=YES
8. COVER_SIZE
9. CAP: MODEL_B
Design for Assembly BLENDER
The parametric design for the assembly BLENDER follows:
...
INPUT
COVER_TYPE YES_NO
"Does the cover have a cap?"
MATERIAL STRING
"Enter material (ABS or POLY)"
CAP_TYPE STRING
"Enter cap type (MODEL_A or MODEL_B)"
COVER_SIZE NUMBER
"Enter the top plate dimension"
END INPUT
RELATIONS
END RELATIONS
EXECUTE PART COVER [a.]
COVER_TYPE = COVER_TYPE
COVER_SIZE = COVER_SIZE
MATERIAL = MATERIAL
END EXECUTE
EXECUTE PART (CAP_TYPE)
COVER_SIZE = COVER_SIZE
END EXECUTE
...
ADD PART COVER [b.]
INTERNAL COMONENT ID 40
END ADD
IF COVER_TYPE == YES [c.]
ADD PART (CAP_TYPE)
INTERNAL COMPONENT ID 45
PARENTS = 40 (#5)
END ADD
END IF
...
| a. Pass value for COVER_TYPE down to part "Cover." If value is YES, cover has a hole added. Also, pass values for material and size of the cover (size of the top plate). b. Add a cover. c. If COVER_TYPE=YES, add the cap to the assembly. |
Design for Part COVER
The parametric design file for the part COVER follows:
...
INPUT
COVER_TYPE YES_NO
COVER_SIZE NUMBER
MATERIAL STRING
END INPUT
RELATIONS [a.]
PTC_MATERIAL_NAME = MATERIAL
DIAM = COVER_SIZE / 2
IF MATERIAL == "POLY"
d0=.10
ELSE
d0=.2
ENDIF
d13=0.1
END RELATIONS
ADD FEATURE (initial number 1) [b.]
INTERNAL FEATURE ID 1
...
IF COVER_TYPE = YES [c.]
ADD FEATURE (internal number 8) [Add a hole.]
INTERNAL FEATURE ID 1915
PARENTS = 1(#1) 5(#3) 40(#5)
...
END ADD
END IF
...
| a. Relations include a relation for the hole diameter and a conditional statement for material type. ("Poly" and "ABS" require double quotation marks.) b. Add the base feature. e. If COVER_TYPE=YES, add a hole.) |
Design for Part CAP
The part CAP is table driven with instances MODEL_A and MODEL_B. The parametric design file for the part CAP follows:
...
INPUT
COVER_SIZE NUMBER
END INPUT
RELATIONS
CYL_DIAM = COVER_SIZE / 2
END RELATIONS
...
ADD FEATURE (initial number 5)
INTERNAL FEATURE ID 40
PARENTS = 1(#1) 5(#3) 3(#2)
END ADD
...