Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
I'm trying to create a program where I suppress a part and unsuppress another which should act as a replacement depending on what input I choose but don't know how to solve the errors.
Here's my code:
VERSION 5.0
REVNUM 8237
LISTING FOR ASSEMBLY UPPGIFT2B
INPUT
LEVER_TYPE STRING
"Choose lever"
END INPUT
RELATIONS
IF LEVER_TYPE == "1"
ADD PART BYGEL
!*** ERR: no END RELATION statement for RELATION on line 0
INTERNAL COMPONENT ID 89
PARENTS = 54(#9)
END ADD
!*** ERR: unmatched END statement encountered
ADD SUPPRESSED PART BYGEL_ALT
INTERNAL COMPONENT ID 206
PARENTS = 54(#9)
END ADD
IF LEVER_TYPE == "2"
ADD SUPPRESSED PART BYGEL
INTERNAL COMPONENT ID 89
PARENTS = 54(#9)
ADD PART BYGEL_ALT
!*** ERR: no END ADD statement for ADD on line 0
INTERNAL COMPONENT ID 206
PARENTS = 54(#9)
END ADD
!*** ERR: unmatched END statement encountered
END RELATIONS
!*** ERR: unmatched END statement encountered
ADD FEATURE (initial number 1)
INTERNAL FEATURE ID 1
DATUM PLANE
NO. ELEMENT NAME INFO
--- ------------- -------------
1 Feature Name Defined
2 Constraints Defined
2.1 Constraint #1 Defined
2.1.1 Constr Type X Axis
3 Flip Datum Dir Defined
4 Fit Defined
4.1 Fit Type Default
NAME = ASM_RIGHT
FEATURE IS IN LAYER(S) :
01__ASM_ALL_DTM_PLN - OPERATION = SHOWN
01__ASM_DEF_DTM_PLN - OPERATION = SHOWN
END ADD
ADD FEATURE (initial number 2)
INTERNAL FEATURE ID 3
DATUM PLANE
NO. ELEMENT NAME INFO
--- ------------- -------------
1 Feature Name Defined
2 Constraints Defined
2.1 Constraint #1 Defined
2.1.1 Constr Type Y Axis
3 Flip Datum Dir Defined
4 Fit Defined
4.1 Fit Type Default
NAME = ASM_TOP
FEATURE IS IN LAYER(S) :
01__ASM_ALL_DTM_PLN - OPERATION = SHOWN
01__ASM_DEF_DTM_PLN - OPERATION = SHOWN
END ADD
ADD FEATURE (initial number 3)
INTERNAL FEATURE ID 5
DATUM PLANE
NO. ELEMENT NAME INFO
--- ------------- -------------
1 Feature Name Defined
2 Constraints Defined
2.1 Constraint #1 Defined
2.1.1 Constr Type Z Axis
3 Flip Datum Dir Defined
4 Fit Defined
4.1 Fit Type Default
NAME = ASM_FRONT
FEATURE IS IN LAYER(S) :
01__ASM_ALL_DTM_PLN - OPERATION = SHOWN
01__ASM_DEF_DTM_PLN - OPERATION = SHOWN
END ADD
ADD FEATURE (initial number 4)
INTERNAL FEATURE ID 7
COORDINATE SYSTEM
NO. ELEMENT NAME INFO
--- ------------- -------------
1 Feature Name Defined
2 Name Display Option YES
3 Display Zoom Dependent Option NO
NAME = ASM_DEF_CSYS
FEATURE IS IN LAYER(S) :
05__ASM_ALL_DTM_CSYS - OPERATION = SHOWN
05__ASM_DEF_DTM_CSYS - OPERATION = SHOWN
END ADD
ADD PART BOTTENPLATTA
INTERNAL COMPONENT ID 42
END ADD
ADD PART DYNPLATTA
INTERNAL COMPONENT ID 43
PARENTS = 42(#5)
END ADD
ADD PART HÅLLARE
INTERNAL COMPONENT ID 51
PARENTS = 43(#6)
END ADD
ADD PART HÅLLARE
INTERNAL COMPONENT ID 52
PARENTS = 43(#6)
END ADD
ADD PART KUGGAXEL
INTERNAL COMPONENT ID 54
PARENTS = 52(#8)
END ADD
ADD PART INSEXSKRUV
INTERNAL COMPONENT ID 58
PARENTS = 43(#6)
END ADD
ADD PART INSEXSKRUV
INTERNAL COMPONENT ID 61
END ADD
ADD PART SPARSKRUV
INTERNAL COMPONENT ID 63
PARENTS = 42(#5) 43(#6)
END ADD
ADD PART STYRSTIFT
INTERNAL COMPONENT ID 83
PARENTS = 43(#6) 52(#8)
END ADD
ADD PART STYRSTIFT
INTERNAL COMPONENT ID 86
PARENTS = 52(#8)
END ADD
ADD PART STYRSTIFT
INTERNAL COMPONENT ID 87
END ADD
ADD PART STYRSTIFT
INTERNAL COMPONENT ID 88
PARENTS = 51(#7)
END ADD
ADD SUPPRESSED PART BYGEL
INTERNAL COMPONENT ID 89
PARENTS = 54(#9)
END ADD
ADD PART DISTANS
INTERNAL COMPONENT ID 90
PARENTS = 42(#5)
END ADD
ADD PART DISTANS
INTERNAL COMPONENT ID 93
END ADD
ADD PART DISTANS
INTERNAL COMPONENT ID 94
END ADD
ADD PART DISTANS
INTERNAL COMPONENT ID 95
END ADD
ADD PART STANS
INTERNAL COMPONENT ID 97
PARENTS = 52(#8)
END ADD
ADD PART STANS
INTERNAL COMPONENT ID 105
PARENTS = 52(#8) 97(#21)
END ADD
ADD PART STANS
INTERNAL COMPONENT ID 117
PARENTS = 51(#7) 97(#21)
END ADD
ADD PART STANS
INTERNAL COMPONENT ID 120
PARENTS = 51(#7) 97(#21)
END ADD
ADD PART STOPPAXEL
INTERNAL COMPONENT ID 123
PARENTS = 51(#7) 42(#5)
END ADD
ADD PART LINJAL
INTERNAL COMPONENT ID 129
PARENTS = 42(#5)
END ADD
ADD PART TÄCKPLATTA
INTERNAL COMPONENT ID 132
PARENTS = 42(#5)
END ADD
ADD PART SPARSKRUV
INTERNAL COMPONENT ID 183
PARENTS = 42(#5) 43(#6)
END ADD
ADD PART SPARSKRUV
INTERNAL COMPONENT ID 184
PARENTS = 42(#5) 43(#6)
END ADD
ADD PART SPARSKRUV
INTERNAL COMPONENT ID 185
PARENTS = 42(#5) 43(#6)
END ADD
ADD PART SPARSKRUV
INTERNAL COMPONENT ID 186
PARENTS = 42(#5) 43(#6)
END ADD
ADD PART SPARSKRUV
INTERNAL COMPONENT ID 187
PARENTS = 42(#5) 43(#6)
END ADD
ADD FEATURE (initial number 33)
INTERNAL FEATURE ID 201
FEATURE WAS CREATED IN ASSEMBLY UPPGIFT2B
PARENTS = 42(#5)
DATUM PLANE
NO. ELEMENT NAME INFO
--- ------------- -------------
1 Feature Name Defined
2 Constraints Defined
2.1 Constraint #1 Defined
2.1.1 Constr Type Offset
2.1.2 Constr References Defined
2.1.3 Constr Ref Offset Value = -26.0000
3 Flip Datum Dir Defined
4 Fit Defined
4.1 Fit Type Default
NAME = ADTM1
FEATURE IS IN LAYER(S) :
01__ASM_ALL_DTM_PLN - OPERATION = SHOWN
FEATURE'S DIMENSIONS:
d56 = (Displayed:) 26
( Stored:) -26.0 ( 0.01, -0.01 )
END ADD
ADD FEATURE (initial number 34)
INTERNAL FEATURE ID 203
FEATURE WAS CREATED IN ASSEMBLY UPPGIFT2B
PARENTS = 42(#5)
DATUM PLANE
NO. ELEMENT NAME INFO
--- ------------- -------------
1 Feature Name Defined
2 Constraints Defined
2.1 Constraint #1 Defined
2.1.1 Constr Type Offset
2.1.2 Constr References Defined
2.1.3 Constr Ref Offset Value = -91.0000
3 Flip Datum Dir Defined
4 Fit Defined
4.1 Fit Type Default
NAME = ADTM2
FEATURE IS IN LAYER(S) :
01__ASM_ALL_DTM_PLN - OPERATION = SHOWN
FEATURE'S DIMENSIONS:
d57 = (Displayed:) 91
( Stored:) -91.0 ( 0.01, -0.01 )
END ADD
ADD PART FJADER
INTERNAL COMPONENT ID 192
END ADD
ADD PART KULA
INTERNAL COMPONENT ID 197
PARENTS = 42(#5) 192(#35) 129(#26)
END ADD
MASSPROP
END MASSPROP
!*** ERR: file contains more IF's than ENDIF's
!*** ERR: file contains more IF's than ENDIF's
Solved! Go to Solution.
One possible solution follows
INPUT
BYGEL_OR_BYGEL_ALT STRING
"Which lever to use? B(bent) or S(straight)? "
END INPUT
[...]
IF BYGEL_OR_BYGEL_ALT == "B"
ADD PART BYGEL
INTERNAL COMPONENT ID 89
PARENTS = 54(#9)
END ADD
END IF
[...]
IF BYGEL_OR_BYGEL_ALT == "S"
ADD PART BYGEL_ALT
INTERNAL COMPONENT ID 206
PARENTS = 54(#9)
END ADD
END IF
Hi,
ENDIF line is missing in your program.
Example:
If you want to suppress BYGEL component, then you have to add two blue lines.
IF LEVER_TYPE == "1"
ADD PART BYGEL
INTERNAL COMPONENT ID 89
PARENTS = 54(#9)
END ADD
ENDIF
I have now added the two blue lines but still get some errors:
VERSION 5.0
REVNUM 8237
LISTING FOR ASSEMBLY UPPGIFT2B
INPUT
LEVER_TYPE STRING (1 or 2)
"Choose lever"
END INPUT
RELATIONS
IF LEVER_TYPE == "1"
ADD PART BYGEL
!*** ERR: no END RELATION statement for RELATION on line 0
INTERNAL COMPONENT ID 89
PARENTS = 54(#9)
END ADD
!*** ERR: unmatched END statement encountered
IF LEVER_TYPE == "1"
ADD SUPPRESSED PART BYGEL_ALT
INTERNAL COMPONENT ID 206
PARENTS = 54(#9)
END ADD
ENDIF
END RELATIONS
!*** ERR: unmatched END statement encountered
You need a space between "END" and "IF" in Pro/Program. Use "END IF"
@EJ_10030318 wrote:
I have now added the two blue lines but still get some errors:
VERSION 5.0
REVNUM 8237
LISTING FOR ASSEMBLY UPPGIFT2BINPUT
LEVER_TYPE STRING (1 or 2)
"Choose lever"
END INPUTRELATIONS
IF LEVER_TYPE == "1"
ADD PART BYGEL
!*** ERR: no END RELATION statement for RELATION on line 0
INTERNAL COMPONENT ID 89
PARENTS = 54(#9)
END ADD
!*** ERR: unmatched END statement encounteredIF LEVER_TYPE == "1"
ADD SUPPRESSED PART BYGEL_ALT
INTERNAL COMPONENT ID 206
PARENTS = 54(#9)
END ADD
ENDIF
END RELATIONS
!*** ERR: unmatched END statement encountered
Hi,
your Pro/Program is completely wrong.
Please study information in Creo HelpCenter. For example:
If you tell me what Creo version do you use I will prepare simple testing assembly for you.
I'm using Creo Parametric 5.0.5.0.
@EJ_10030318 wrote:
I'm using Creo Parametric 5.0.5.0.
Hi,
unzip file, open assembly, regenerate assembly, follow instructions.
Almost got it right!
I have now made a program that successfully unsuppresses a lever but I also want to make sure the other lever is suppressed at the same time and I also want to make sure the part doesn't get suppressed if I click "No". What codes could work for this?
INPUT
BYGEL_SUPPRESSED YES_NO
"Do you want to switch to bent lever?"
BYGEL_ALT_SUPPRESSED YES_NO
"Do you want to switch to straight lever?"
END INPUT
[...]
IF BYGEL_ALT_SUPPRESSED == YES
ADD PART BYGEL
INTERNAL COMPONENT ID 89
PARENTS = 54(#9)
END ADD
END IF
[...]
IF BYGEL_SUPPRESSED == YES
ADD PART BYGEL_ALT
INTERNAL COMPONENT ID 206
PARENTS = 54(#9)
END ADD
END IF
One possible solution follows
INPUT
BYGEL_OR_BYGEL_ALT STRING
"Which lever to use? B(bent) or S(straight)? "
END INPUT
[...]
IF BYGEL_OR_BYGEL_ALT == "B"
ADD PART BYGEL
INTERNAL COMPONENT ID 89
PARENTS = 54(#9)
END ADD
END IF
[...]
IF BYGEL_OR_BYGEL_ALT == "S"
ADD PART BYGEL_ALT
INTERNAL COMPONENT ID 206
PARENTS = 54(#9)
END ADD
END IF