简体   繁体   中英

How to get FormatProvider from Autodesk.AutoCAD.Geometry.Point3d

I have some Point3d stored as text in the DataGridView cell.

Autodesk.AutoCAD.Geometry.Point3d px = new Point3d ( 100.0 , 123.0 , 0.0); // for example
row.Cells["IDS_ReferenePoint"].Value = px.ToString();

so I have the value: "(100.0,123.0,0.0)"

Now I need to reverse that operation - read that point from DataGridView cell and convert to Point3d object. So I may do it by remove ( , ) split text by separating columns sign , and each coordinate parse to double.

But I'm afraid that on other PC with different language settings , will be decimal places separator, and for example [SPACE] would be a coordinate separator.

Is there an easy way to get FormatProvider default used in Point3d.ToString() ? depended on user PC configuration?

As far as I know, the Point3d format is not related to the Windows decimal separator. I used to use French versions of AutoCAD and the decimal separator for AutoCAD is the dot whatever the Windows settings (comma is the default windows decimal separator for French versions). And the comma is the coordinate separator for AutoCAD points, vector, matrices.

So, I think you do not have to care to Point3d.ToString() format which is always the same whatever the culture version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM