| 查看: 3035 | 回复: 3 | ||
sixulianyi新虫 (初入文坛)
|
[求助]
利用Ledit的C语言的宏程序画余弦S弯曲线,能和软件连接但是画不出图!!代码已附上 已有1人参与
|
|
想在L-edit里面画余弦S弯曲线,故写了一个C语言的宏程序,在Ledit里面运行了,能与软件连接,能显示光标坐标位置以及弹出参数的对话框,但是画不出曲线图。代码如下面所示。语句上按照软件的说明以及自带的例子看了一遍没有错误,实在找不出什么原因。,求问群里的大神哪里出错了!!! #include <stdlib.h> #include <math.h> #include <ldata.h> void SMacro ( void ) { /********************************************************************/ /* 余弦S弯 */ /********************************************************************/ double Height, Length, Width, Deltax; long P, Points_Total; double PI = 3.141592654; LPoint Points [ 1002 ]; LObject Polygon; LCell Cell_Draw = LCell_GetVisible( ); LFile File_Draw = LCell_GetFile ( Cell_Draw ); LPoint pt = LCursor_GetPosition ( ); LDialog_MsgBox( LFormat( "( %lf, %lf )", pt.x, pt.y) ); LDialogItem Dialog_Items [ 3 ] = { { "Height ", "50.0" }, {"Length ", "1500"}, { "Width ", "5.0" } }; /********************************************************************/ if(LLayer_Find (File_Draw, "Poly" == NULL){ LDialog_AlertBox("There is no Poly layer.\nMake sure Poly is in the layer map!" ;return; } if( LDialog_MultiLineInputBox ( "S Properties", Dialog_Items, 3 ) ) { Height = atof ( Dialog_Items [ 0 ].value ); Length = atof ( Dialog_Items [ 1 ].value ); Width = atof ( Dialog_Items [ 3 ].value ); return 1; } else return 0; Deltax = 3.0; for ( P = 0; P <= Points_Total; P++ ) { Points [ P ].x = pt.x +Deltax*P; Points [ P ].y = pt.y + Height/2*(1-cos(PI*( Deltax*P )/Length)); Points [ 1002 - P ].x = Points [ P ].x ; Points [ 1002 - P ].y = Points [ P ].y +Width ; } Polygon = LPolygon_New ( Cell_Draw, LLayer_Find ( File_Draw, "Poly" ), Points, 1002 ); LCell_SetView ( Cell_Draw, LCell_GetMbb ( Cell_Draw ) ); LCell_MakeVisible ( Cell_Draw ); LCell_HomeView ( Cell_Draw ); } int UPI_Entry_Point( void ) { LMacro_Register("S", "SMacro" ;return 1; } |
» 猜你喜欢
请问对标matlab的开源软件octave的网站https://octave.org为什么打不开?
已经有1人回复
求助两种BiOBr晶体的CIF文件(卡片号为JCPDS 09-0393与JCPDS 01-1004 )
已经有0人回复
金属材料论文润色/翻译怎么收费?
已经有135人回复
哈尔滨工程大学材化学院国家级青年人才-26年硕士招生
已经有0人回复
求助Fe-TCPP、Zn-TCPP的CIF文件,或者CCDC号
已经有0人回复
河北大学-26年秋季入学申请考核制-化学博士1名
已经有0人回复
sixulianyi
新虫 (初入文坛)
- 应助: 0 (幼儿园)
- 金币: 131.5
- 散金: 20
- 红花: 1
- 帖子: 22
- 在线: 7.3小时
- 虫号: 2429791
- 注册: 2013-04-22
- 专业: 光子与光电子器件
2楼2016-06-21 16:06:49
yuguofang
新虫 (初入文坛)
- 应助: 0 (幼儿园)
- 金币: 348.4
- 散金: 10
- 帖子: 41
- 在线: 24.8小时
- 虫号: 6453695
- 注册: 2017-05-05
- 专业: 半导体电子器件
3楼2021-05-18 18:12:26
梦の国度
捐助贵宾 (文学泰斗)
- 应助: 0 (幼儿园)
- 金币: 3326.1
- 散金: 177
- 红花: 2
- 帖子: 67309
- 在线: 168.2小时
- 虫号: 977074
- 注册: 2010-03-20
- 性别: GG
- 专业: 数论
4楼2021-05-21 16:54:08












== NULL)
回复此楼