Is there a way to set DISPLAYPRECISION using API? Here is the context behind this ask. I'm currently developing a code using API that automatically exports all the measured dimensions to a JSON file. Instead of using the value of DISPLAYPRECISION in the part program, I would like to set the decimal places explicitly using API. Thanks!
Set decimal places using Automation API
Collapse
X
-
What syntax are you using? If using VB.NET a console application would look like this....
Code:Public Module Example Sub Main() Console.WriteLine(Math.Round(3.44, 1)) Console.WriteLine(Math.Round(3.45, 1)) Console.WriteLine(Math.Round(3.46, 1)) Console.WriteLine() Console.WriteLine(Math.Round(4.34, 1)) Console.WriteLine(Math.Round(4.35, 1)) Console.WriteLine(Math.Round(4.36, 1)) End Sub End Module ' The example displays the following output: ' 3.4 ' 3.4 ' 3.5 ' ' 4.3 ' 4.4 ' 4.4
PcDmis 2015.1 SP10 CAD++
Global 7-10-7 DC800S
-
Kp61dude! Sorry for not being clear with my question. Let's say that I have a PC-DMIS command variable cmd and I can extract the measured dimension using API:
Code:PCDLRN.Command cmd; measured = cmd.GetText(ENUM_FIELD_TYPES.LINE1_MEAS, 1);
Comment
-
Why not fetch the numerical values directly from the feature command, instead of using .GETTEXT? GETTEXT is primarily intended for the listing in the Edit Window.
I think FeatCmd.GetPoints would be the correct way - take a look at the ToPoints.BAS script in the code section of this forum.AndersI
SW support - Hexagon Metrology Nordic AB
- Likes 1
Comment
-
Originally posted by cmshieh View PostKp61dude! Sorry for not being clear with my question. Let's say that I have a PC-DMIS command variable cmd and I can extract the measured dimension using API:
Code:PCDLRN.Command cmd; measured = cmd.GetText(ENUM_FIELD_TYPES.LINE1_MEAS, 1);
looks like you're using C# if not just let me know what language you're using.
First cast from string to integer:
Code:PCDLRN.Command cmd; string measured = cmd.GetText(PCDLRN.ENUM_FIELD_TYPES.LINE1_MEAS, 1); float convert2Float = float.Parse(measured); double dblMeasured = Math.Round(convert2Float, 4); // 4 decimal places dblMeasured = Math.Round(convert2Float, 2); // 2 decimal places
You probably don't want to start from scratch, which is understandable, if you post your code some of us may help and guide you to get it to work as desired...Last edited by Kp61dude!; 01-10-2020, 12:05 PM.PcDmis 2015.1 SP10 CAD++
Global 7-10-7 DC800S
Comment
Related Topics
Collapse
-
by ErikirI've done something to change the default number of decimal places and I can't figure out what it is. I have a program that doesn't specifically call...
-
Channel: PC-DMIS for CMMs
02-19-2013, 10:20 AM -
-
by rbexplorerHi everyone,
can you help me with my problem, please?
Can I display measuring results into 7 decimal places in report? Where...-
Channel: PC-DMIS for CMMs
03-01-2010, 06:45 AM -
-
by hfowlerCan someone help me with this question a customer asked me....It concerns the deciaml output on the cmm reports...."how many digits is needed to...
-
Channel: PC-DMIS for CMMs
01-26-2010, 09:28 AM -
-
by John KuglerMy program has 5 decimal places, my report looks like it has 5 decimal places, but when I run the program, it prints to only 3 decimal places.
...-
Channel: PC-DMIS for CMMs
10-01-2007, 01:32 PM -
-
by XanthroI have just installed PCDMIS 2009 in our Mexico facility and I am now getting results that are to the 50 millionths place. I would like to have them at...
-
Channel: PC-DMIS for CMMs
03-19-2010, 02:12 PM -
Comment