找回密码
 注册
Simdroid-非首页
查看: 167|回复: 5

[PCL] 关于PCL读取text文件生成point的问题?

[复制链接]
发表于 2011-7-31 18:11:55 | 显示全部楼层 |阅读模式 来自 辽宁大连
悬赏10仿真币未解决
先说明下目的,读取text文件内的坐标值(已附上),格式大致为[23,13,100],[25,34,100].......想通过PCL语言读取目标文件夹内的(patran属性设置的新目录,这里是E:\pcltest ),中的testcood.txt文件。 然后采用asm_const_grid_xyz  函数 定义POINT, 我附上自己做的PCL程序,因为是新手 所以这里有很多错误,也有很多问题,请大家指教,问题如下:
1. 调用built-in 函数,内部的变量在函数外需要定义吗,如何不用定义,貌似用!!library?
2. text_read()中的init 格式如何设置, 文本中都是[XXX,XXX,XXX], 的格式,如何设置?
3.每次定义POINT时,如何自动设置点号?
谢谢了 希望给出完整代码

代码如下:
!!library
function outputpoint()
string filename[20]
integer Flag
integer status
integer chan
string line
integer lenline
string string_temp[virtual]
STRING s_coordinates_list[32]
STRING s_coord_frame[32]
STRING sv_created_ids[VIRTUAL]
INTEGER i_return_value
string s_output_ids
filename="example"
status=text_open(testcood,"OR",0,0,chan)
if(status!=0)then
   user_message("ERROR",0,"Open file","cann't open file")
   else if(status==0)then
   while(text_read_string(chan,line,lenline)==0)
   Flag=str_index(line,"[")
   $write(line,flag)
       if(Flag>=1)then
          text_read(chan,"A%",string_temp)
       end if
   end while
end if
s_output_ids = "1"
s_coord_frame = "Coord 0"
i_return_value = @
asm_const_grid_xyz @
( s_output_ids, @
s_coordinates_list, @
string_temp @
sv_created_ids )
dump i_return_value
dump sv_created_ids
text_close(chan,"")
end function

 楼主| 发表于 2011-7-31 18:13:37 | 显示全部楼层 来自 辽宁大连
Simdroid开发平台
本帖最后由 吃河蟹的稻草人 于 2011-7-31 18:14 编辑

text文件 内容 大致为:[0,-3125,1000],[32.1428,-3125,132],[64.2857,-3125,12312],[96.4285,-3125,123],[128.5554,-3124.7365,1232]......其实就是一串坐标值
回复

使用道具 举报

发表于 2011-8-1 12:54:55 | 显示全部楼层 来自 北京

CTRL+C:复制坐标
CTRL+V:粘贴坐标点到GEOMETRY→creat,point,XYZ,point coordinates list→Apply
好了,你就得到一群点了。
回复

使用道具 举报

 楼主| 发表于 2011-8-1 20:41:43 | 显示全部楼层 来自 辽宁大连
回复 3# huxin96


    用你放!
回复

使用道具 举报

发表于 2011-8-2 09:42:15 | 显示全部楼层 来自 江苏南京
你这个很规律,直接可以生产点
function outputpoint(filename)

string filename[]

integer status
integer chan
string line[1000]
integer lenline

status=text_open(filename,"OR",0,0,chan)
if(status!=0) then
return
end if
status=text_read_string(chan,line,lenline)
if(status!=0) then
return
end if

STRING asm_create_grid_xyz_created_ids[VIRTUAL]
asm_const_grid_xyz( "1", line, "Coord 0", asm_create_grid_xyz_created_ids )
text_close(chan,"")
end function
回复

使用道具 举报

发表于 2011-8-2 18:26:29 | 显示全部楼层 来自 江苏南京
嘿嘿,我来拿悬赏的……
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-5-21 02:28 , Processed in 0.030709 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表