admin管理员组文章数量:1317905
I'm working on a project that involves manipulating node coordinates from an ANSYS .inp file. I'm trying to extract the node coordinates, modify them (e.g., multiply the z-coordinate by 1.5), and then write the modified data back to a file. However, I'm encountering difficulties parsing the file correctly due to its specific format. Here's an example of the node coordinate data in the .inp file:
The format is: Node ID (integer), a zero value, and X, Y, Z coordinates (scientific notation).
1 0 0-3.3131786040000E-002 4.5036802300000E-002-1.2229753440000E-001
2 0 0-2.7267243100000E-002 3.7109654860000E-002-1.2437740980000E-001
3 0 0-2.0034116490000E-002 3.0278565420000E-002-1.2621129580000E-001
The challenges I'm facing: There are no spaces between the Y and Z coordinates, I've tried using regular expressions and converting it to other file types such as csv, but I haven't been able to correctly extract the coordinates. What would be the most efficient way to extract the node coordinates correctly? I am coding in Python. Any help/advice is greatly appreciated!
I've tried using regular expressions and converting it to other file types such as csv, but I haven't been able to correctly extract the coordinates. Here's an example output from when I tried converting the inp file into a csv file.
Node_ID,X,Y,Z
1,-3.3131786040000E-0,0,2
2,-2.7267243100000E-0,0,2
3,-2.0034116490000E-0,0,2
本文标签: Extracting coordinates from ANSYS inp file in PythonStack Overflow
版权声明:本文标题:Extracting coordinates from ANSYS .inp file in Python - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742030784a2416402.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论