NX8.0 : How to script expressions as PTC/Creo doing ?
NX8.0 : How to script expressions as PTC/Creo doing ?
(OP)
Hello there,
Is there a way in NX8 to script expressions values as the PTC Creo "Relations" doing ?
I found that more conveniant if you have a lot of IF conditions.
Ex, in Creo :
if idtalf_xwf == 0
angif_xwf=30
cd1wxf=epf_wf*tan(angif_xwf)
idtalf_xwf=2*epf_wf+2
talf1_wf=talf_wf
angef_wf=angef_vwf
else
cd1wxf=epf_wf*tan(angif_xwf)
cd2wxf=(idtalf_xwf-idf_wf)/2
talf1_wf=talf_wf+cd2wxf
angef_wf=angef_xwf
endif
So, using only one IF condition, you can set values for several variables.
And these values can be also changed later in the script if another condition ask it. Usefull.
In NX8, it's the all way round, for each variable ou have to set a IF statement.
It's much more coding. And having a cascade of IF for each parameter is confusing.
Thank you
Stéphane
Is there a way in NX8 to script expressions values as the PTC Creo "Relations" doing ?
I found that more conveniant if you have a lot of IF conditions.
Ex, in Creo :
if idtalf_xwf == 0
angif_xwf=30
cd1wxf=epf_wf*tan(angif_xwf)
idtalf_xwf=2*epf_wf+2
talf1_wf=talf_wf
angef_wf=angef_vwf
else
cd1wxf=epf_wf*tan(angif_xwf)
cd2wxf=(idtalf_xwf-idf_wf)/2
talf1_wf=talf_wf+cd2wxf
angef_wf=angef_xwf
endif
So, using only one IF condition, you can set values for several variables.
And these values can be also changed later in the script if another condition ask it. Usefull.
In NX8, it's the all way round, for each variable ou have to set a IF statement.
It's much more coding. And having a cascade of IF for each parameter is confusing.
Thank you
Stéphane
"My english is bad ? That's why i'am french."





RE: NX8.0 : How to script expressions as PTC/Creo doing ?
John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
RE: NX8.0 : How to script expressions as PTC/Creo doing ?
I assume it is working as it's in use here since 1999.
If Creo interpreting the code, this can be done.
It doesn't disturb me if a IF changes his own condition.
Maybe you'll prefer this extract :
if join_nflg == "rtj" | join_nflg == "RTJ" & nrtj_nflg ~= 0
D16=krtj_nflg
D12=lrtj_nflg
D7=c_nflg
D10=ywn_nflg
haut_nflg=lrtj_nflg+ywn_nflg
haut_cone=ywn_nflg-c_nflg-lgcol_fac
else
D16=rrf_nflg
D12=lrf_nflg
if clas_nflg < 400
D7=(c_nflg-lrf_nflg)
D10=(ywn_nflg-lrf_nflg)
haut_nflg=ywn_nflg
haut_cone=ywn_nflg-c_nflg-lgcol_fac
else
D7=c_nflg
D10=ywn_nflg
haut_nflg=lrf_nflg+ywn_nflg
haut_cone=ywn_nflg-c_nflg-lgcol_fac
endif
endif
Become this in NX :
D7=if (join_nflg=="rtj"|join_nflg=="RTJ"&nrtj_nflg!=0) (c_nflg) else (if (clas_nflg<400) (c_nflg-lrf_nflg) else (c_nflg))
D10=if (join_nflg=="rtj"|join_nflg=="RTJ"&nrtj_nflg!=0) (ywn_nflg) else (if (clas_nflg<400) (ywn_nflg-lrf_nflg) else (ywn_nflg))
Etc .. Etc ....
"My english is bad ? That's why i'am french."
RE: NX8.0 : How to script expressions as PTC/Creo doing ?
You should open an enhancement request
As your English is bad like me, don't hesitate to use also french forum like Cadxp: http://cadxp.com/forum/112-nx-ex-unigraphix/
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: NX8.0 : How to script expressions as PTC/Creo doing ?
You aren't really comparing apples in functionality between NX expressions and Creo Relations.
While conceptually they do the same function, Creo relations are a subset of Pro/Program which is why they are more robust. You could get that coding in a GRIP program, but you now need journaling.
"Wildfires are dangerous, hard to control, and economically catastrophic."
Ben Loosli
RE: NX8.0 : How to script expressions as PTC/Creo doing ?
This is valid (and useful) in all the languages I have experience with. Now if you are changing the 'counter' variable within a loop construct; it is technically allowed, but can get you in trouble.
www.nxjournaling.com
RE: NX8.0 : How to script expressions as PTC/Creo doing ?
BTW, I'm thinking that perhaps this could be reduced in complexity with NX if you used a 'List' expression to collect and categorize the formulas and then have a single, simple IF statement to get the proper 'nth' value so as to extract the appropriate records from the 'List' expression.
John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.