Bore Object - How to show the different formats? ND OD metric inches

Hello everyone

I'm working with reports of piping elements and a curious thing happened and I want to know why and how to control this:

We declare the Bore of Pipe in an UDA, so at night I run a Macro to fill these attributes and the value for the Bore returns in Nominal Size in metric.

--The Macro goes:

!Diampipe = Bore
:DIAMETRO '$!Diampipe'

-- Returns (in excel):

If i get the bore via command tool, it returns the nominal size in inches.  If i run the same sentence as the macro, changes the UDA to inches:

q var !!ce.bore
<BORE> 30in

--If i do the same as the macro:
!Diampipe = Bore
q var !diampipe
<BORE> 30in
:DIAMETRO '$!Diampipe'
q var !!ce.:DIAMETRO
<STRING> '30in'

-- Now the value of the UDA changes to inches, different of the result of the macro in the night

and if I get the real value, it returns in mm but the actual Outside Diameter (I expected 750mm)

q var !!ce.bore.real()

<REAL> 762mm

How to control the format of the values? i want to get rid off the "mm" part of the UDA but I can't control the value result (yes, i know it can be handled as string, but i want to know why it happens and how to control the values)

In short: I need to know how to get the bore value in inches or mm, and the Nominal Bore or Real Bore.

I would be very grateful if you could help me with this... thanks in advance

kind regards