How to access sub-routines in relations
I have a number of relations based udfs for creating manifold block designs. All the logic is built using Relations in Creo-Parametric. There is a specific logic I have built around transferring dimensions in decimal form (say 3 decimal places) to a 3D hole-note written with relations, so that the hole note shows the 3 decimal places. (Usually, when transferring to string form, Relations only transfers the integer part of the dimension) I have a work around for this, which works well, but then, every such hole, has to have the logic built in its relations.
Is it possible to have this common logic as a subroutine, written in the part relations , which I can access, every time I want to increase the decimal places ? I can call this subroutine with the value, number of places I want to show so that the sub-routines returns a string value with the correct decimal places.
This is the relations program for a counter bore dia with 2 decimal spaces and a counter bore depth with 3 decimal spaces.:
x=itos (CBORE_DIAMETER*10^2)
l=string_length(x)
if(extract(x,(l-1),2)=="00")
y=extract(x,1,(l-2))
else
if(extract(x,l,1)=="0")
y=extract(x,1,(l-2))+"."+extract(x,(l+1-2),1)
else
y=extract(x,1,(l-2))+"."+extract(x,(l+1-2),2)
endif
endif
c="."
if (acc<1)
c=""
endif
a=itos(CBORE_DEPTH*10^acc)
l=string_length(a)
b=extract(a,1,(l-acc))+c+extract(a,(l+1-acc),acc)
/*" ?" is the symbol for dia. in the 3D note
HN1="S.Face"+" ?"+y+" - "+b
Please note that "HN1" is what is called in the 3D Note
This works pretty well for each hole individually. But one can notice that this bit of program would be more efficient, if used as a sub routine.

