println units
hervé_pipon
Member Posts: 60 ✭✭
Hello
Here is a small piece of code:
var sketchPlane = evOwnerSketchPlane(context, { "entity" : definition.selectedEdge });
var n = 100;
var samples = evEdgeTangentLines(context, { "edge" : definition.selectedEdge, "parameters" : range(0, 1, n) });
var origin = worldToPlane(sketchPlane, samples[0].origin);
println(origin * centimeter );
It prints :
(0 meter^2, 0 meter^2)
I want to display centimeter : what is wrong ?
Tagged:
0
Comments
-
Units in println are always meters, plus you are multiplying origin (which has length units) by another length to get an area.Senior Director, Technical Services, EMEA1
-
@NeilCooke Thanks I didn't know.NeilCooke said:Units in println are always meters.0 -
change your println to this
println(origin / centimeter );
0 -
If you wanna get fancy with it
printLn("origin = " ~ roundToPrecision(origin/centimeter, 3)~ " cm";This will print "origin = 3.25 cm" or whatever. You round to not display 3.250000000001 or some floating point value.
Usually this isn't needed, but if there are a ton of things printing it can be nice to label them with strong concatenation.1



