Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
AllPlace>Creo>Modeling>Dicuion
6Replie Latetrepl:Jan24,20146:37AMTomUminn
ptc-5459625 Jan24,20144:24AM
Creorelation-'OR'function
ThiquetionhaeenAnwered.
Hellothere.
Itherean'OR'functionoromethingimilarincreorelation(i'muingcreo
element/pro)
Ihavethefollowingtringofcode,whichiwhatiwouldlikeittolooklike
IFC_GAROX_CD_DIM==125OR150
XD_GAROX=215
NDIF
thilinktheuerinputted'CD'anddrivethe'XD'
However,therearemanfigurefor'CD'thatwouldallprovidetheame'XD'
Iamtringtogetaroundhavingtowriteaniftatementforeachandever'CD'(there
are72!!)
Ithereafunctiontoallowmetohavemultipleinputforan'IF'function,am
attemptaovereturnedanerrora'OR'doentexit
Thank
Jonathan
CorrectAnwer
TomUminnonJan24,20145:21AM
Anotheroptionmaetochecktherangeandthencheckforcertaincondition.For
example,ifthenumerhatoeetween125and600,andmuteon25numer
increment(125,150,175,etc.),oucoulddothefollowing:
/*CheckRange
IFC_GAROX_CD_DIM>=125&C_GAROX_CD_DIM<=600
IFFLOOR(C_GAROX_CD_DIM/25)==(C_GAROX_CD_DIM/25)
XD_GAROX=215
L
XD_GAROX=315
NDIF
NDIF
https://www.ptcusercommunity.com/thread/52385 1/5
3/30/2017 Creorelations'OR'function|PTCCommunity
3988View Tag:
Re:Creorelation-'OR'function
Jonathon,
Youneedtoeparatethetaementwith"|"(hiftonackpaceke)
IFC_GEARBOX_CD_DIM==125|C_GEARBOX_CD_DIM==150
Action Like(0)
Re:Creorelation-'OR'function
'OR'ithepipemol'|'.Youhavetoretatetheentireexpreionthough,notjut
thetargetvalue.
IFC_GAROX_CD_DIM==125|C_GAROX_CD_DIM==150
XD_GAROX=215
NDIF
Youcanalouethe'\'acklahmoltocontinuetomultipleline.
IFC_GAROX_CD_DIM==125|C_GAROX_CD_DIM==150|\
C_GAROX_CD_DIM==175|C_GAROX_CD_DIM==200|\
C_GAROX_CD_DIM==225|C_GAROX_CD_DIM==250|\
C_GAROX_CD_DIM==275|C_GAROX_CD_DIM==300|\
C_GAROX_CD_DIM==325|C_GAROX_CD_DIM==350|\
C_GAROX_CD_DIM==375|C_GAROX_CD_DIM==400
XD_GAROX=215
NDIF
ANDithe'&'amperand.
Action Like(0)
CorrectAnwer Re:Creorelation-'OR'function
Anotheroptionmaetochecktherangeandthencheckforcertaincondition.
Forexample,ifthenumerhatoeetween125and600,andmuteon25
numerincrement(125,150,175,etc.),oucoulddothefollowing:
https://www.ptcusercommunity.com/thread/52385 2/5
3/30/2017 Creorelations'OR'function|PTCCommunity
/*CheckRange
IFC_GAROX_CD_DIM>=125&C_GAROX_CD_DIM<=600
IFFLOOR(C_GAROX_CD_DIM/25)==(C_GAROX_CD_DIM/25)
XD_GAROX=215
L
XD_GAROX=315
NDIF
NDIF
Action Like(1)
Re:Creorelation-'OR'function
HiTom,
Thankouvermuchforourrepone(andArt!)
TheCDdimenionifromanimperialdecimalnumer.
Imdataheethafractioinalincheanditmuteconvertedtodecimal
inchewhenenteredintheparameter.thereinopecifictepetweenthe
poileentrieowouldthefollowingwork?
IFC_GAROX_CD_DIM>=125&C_GAROX_CD_DIM<=600
XD_GAROX=215
L
IFC_GAROX_CD_DIM>=601&C_GAROX_CD_DIM<=900
XD_GAROX=230
NDIF
NDIF
Orperhapwriteitlikethiintead?
IFC_GAROX_CD_DIM>=125&C_GAROX_CD_DIM<=600
XD_GAROX=215
L
NDIF
IFC_GAROX_CD_DIM>=601&C_GAROX_CD_DIM<=900
XD_GAROX=230
L
NDIF
Aanaide,willcreorelationrecogniefractioninparameter/
Iifauerinputted27/16intheparameter,couldcreoue2.4375init
calculation?orithinotpoile?
Action Like(0)
https://www.ptcusercommunity.com/thread/52385 3/5
3/30/2017 Creorelations'OR'function|PTCCommunity
Re:Creorelation-'OR'function
Jutuedthicode
IFC_GAROX_CD_DIM>=23.3&C_GAROX_CD_DIM<=24.7
XD_GAROX=50.8
L
IFC_GAROX_CD_DIM>=30&C_GAROX_CD_DIM<=32
XD_GAROX=76.2
NDIF
NDIF
andofarogood!
Action Like(0)
Re:Creorelation-'OR'function
1.)Youdon'tneed'L'ifthereinothingafterit.
IFC_GAROX_CD_DIM>=601&C_GAROX_CD_DIM<=900
XD_GAROX=230
L
NDIF
2.)ThereinoharminNOTuingLtatement.ometimeitmake
readingthecodeimpler.
IFC_GAROX_CD_DIM>=125&C_GAROX_CD_DIM<=600
XD_GAROX=215
NDIF
IFC_GAROX_CD_DIM>=601&C_GAROX_CD_DIM<=900
XD_GAROX=230
NDIF
3.)It'agoodideatopreetthecontrolledparameter/dimenionto
omethingthatwillcatchourattentionifnoneoftheIFtatementare
neverentered.Rightnowthereinothingforcingachangeto
XD_GAROX'latvalueifthecheckedparameterioutideofthetarget
range.
/*Initializevalue
XD_GAROX=1
https://www.ptcusercommunity.com/thread/52385 4/5
3/30/2017 Creorelations'OR'function|PTCCommunity
/*Checkforvalidize
IFC_GAROX_CD_DIM>=125&C_GAROX_CD_DIM<=600
XD_GAROX=215
NDIF
IFC_GAROX_CD_DIM>=601&C_GAROX_CD_DIM<=900
XD_GAROX=230
NDIF
oroucouldueanetedeletatement:
IFC_GAROX_CD_DIM>=125&C_GAROX_CD_DIM<=600
XD_GAROX=215
L
IFC_GAROX_CD_DIM>=601&C_GAROX_CD_DIM<=900
XD_GAROX=230
L
XD_GAROX=1
NDIF
NDIF
Action Like(0)
Home|Aout|Contact|CommunitHelp|TermofUe|Legal Copright2015PTCInc.|
Policie
https://www.ptcusercommunity.com/thread/52385 5/5