当前位置: 首页>>代码示例>>C++>>正文


C++ Path::ClearSegListA方法代码示例

本文整理汇总了C++中Path::ClearSegListA方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::ClearSegListA方法的具体用法?C++ Path::ClearSegListA怎么用?C++ Path::ClearSegListA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


在下文中一共展示了Path::ClearSegListA方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreatePath1A_XOffset

int CreatePath1A_XOffset(double dX, double dY, double dZ, Path & vPath)
{
	int res;

//
//Clear the segment list and initialize the starting point for the path
//
	vPath.ClearSegListA(dX, dY, dZ);    //Clear the segment list and set the
									//  starting point for the path
									//  at X = 0, Y = 1, Z = 0

//
//Add line and arc segments to the path module's segment list for first move
//


	res = vPath.AddLineSegA(dX, dY+1.0, dZ+0.0);    //Add a segment to move to x=0, y=2, z=0
	if (res<0) return -1;

	res = vPath.AddArcSegA( dX+1.0, dY+2.0, dZ+0.0,     //end point of arc: x=1, y=3, z=0
							 dX+1.0, dY+1.0, dZ+0.0,     //center point of arc: x=1, y=2, z = 0
							 0.0, 0.0, -1.0 );   //normal vector to arc plane: x = 0, y = 0, z = -1
	if (res<0) return -1;

	res = vPath.AddLineSegA(dX+2.0, dY+2.0, dZ+0.0);    //line segment endpoint: x=4, y=3, z=0
	if (res<0) return -1;

//	ServoInf::m_pNMCServo->ClearSegList(4.0, 3.0, 0.0);    //Clear the segment list and set the
//	ExecutePath3Axis();

	res = vPath.AddArcSegA( dX+3.0, dY+1.0, dZ+0.0,     //end point of arc: x=5, y=2, z=0
							 dX+2.0, dY+1.0, dZ+0.0,     //center point of arc: x=4, y=2, z = 0
							 0.0, 0.0, -1.0 );   //normal vector to arc plane: x = 0, y = 0, z = -1
	if (res<0) return -1;

	res = vPath.AddLineSegA(dX+3.0, dY+0.0, dZ+0.0);    //line segment endpoint: x=5, y=0, z=0
	if (res<0) return -1;

	res = vPath.AddStartA(dX+3.0, dY+0.0, dZ+0.0);    //line segment endpoint: x=5, y=0, z=0
	if (res<0) return -1;

	res = vPath.AddLineSegA(dX+0.0, dY+0.0, dZ+0.0);    //line segment endpoint: x=5, y=0, z=0
	if (res<0) return -1;

}
开发者ID:duchiy,项目名称:CNCMillwithGCodeInterpreter,代码行数:45,代码来源:Motion.cpp

示例2: TestCoordMotionCircleAtOrigin

int TestCoordMotionCircleAtOrigin()
{
	
	int iModule;
	int iError;
	double dX=0.0, dY=0.0, dZ=0.0;
	Path vPath;

	iError=InitNMCModule3Axis (iModule, vPath);

	g_stage.Rotate(180.0);
	g_stage.SetVel(3.0, 3.0, 3.0);
	g_stage.SetAccel(1.0, 1.0, 1.0);

	vPath.SetPathParams(P_60HZ,   //path frequency = 30 Hz
					75,       //Store a minimum of 45 points in the path point buffer
					15000.0,  //X scale - 20000.0 counts per inch
					15000.0,  //Y scale - 20000.0 counts per inch
					15000.0,      //Z scale - 1.0 counts per inch - not used
					0.175);     //acceleration = 1.0 inch/second/second

	vPath.SetOrigin(0.0, 0.0, 0.0); //set the origin to X = 0, Y = 0, Z = 0
	vPath.SetFeedrate(0.175);         //feedrate = 1.0 inches/second
	vPath.SetTangentTolerance(10.0);  //continuous path tangent tolerence = 10 degrees	
	g_stage.InitPathMode(vPath);

	

	
	BOOL bMotion;
	iError=g_stage.MoveTo(2.5, 0.0, 0.0, true);
	g_stage.GetPos( dX, dY, dZ );

	vPath.ClearSegListA(2.5, 0.0, 0.0);    //Clear the segment list and set the
									//  starting point for the path
									//  at X = 0, Y = 1, Z = 0

//
//Add line and arc segments to the path module's segment list for first move
//
	int res;
	res = vPath.AddArcSegA( 0.0, 2.5, 0.0,     //end point of arc: x=1, y=3, z=0
							 0.0, 0.0, 0.0,     //center point of arc: x=1, y=2, z = 0
							 0.0, 0.0, 1.0 );   //normal vector to arc plane: x = 0, y = 0, z = -1
	if (res<0) return -1;
	g_stage.ExecuteCoordMotion(vPath);

	vPath.ClearSegListA(0.0, 2.5, 0.0);    //Clear the segment list and set the
									//  starting point for the path
									//  at X = 0, Y = 1, Z = 0

//
//Add line and arc segments to the path module's segment list for first move
//

	res = vPath.AddArcSegA( -2.5, 0.0, 0.0,     //end point of arc: x=1, y=3, z=0
							 0.0, 0.0, 0.0,     //center point of arc: x=1, y=2, z = 0
							 0.0, 0.0, 1.0 );   //normal vector to arc plane: x = 0, y = 0, z = -1
	if (res<0) return -1;
	g_stage.ExecuteCoordMotion(vPath);


//	ExecutePath3Axis();
	
//	iError=g_stage.MoveTo(-1.0, 1.000, 0.0, true);
//	iError=g_stage.MoveTo(-1.0, 1.000, -0.5, true);
//	g_stage.GetPos( dX, dY, dZ );
//	CreatePath1A_XOffset( dX, dY, dZ );
//	ExecutePath3Axis();
	
	iError=g_stage.MoveTo(0.0, 0.000, 0.000, true);
	return 0;
};
开发者ID:duchiy,项目名称:CNCMillwithGCodeInterpreter,代码行数:73,代码来源:Motion.cpp

示例3: TestCoordMotionShortPath

int TestCoordMotionShortPath()
{
	
	int iError;
	int res;
	int iModule;
	Path vPath;

	iError=InitNMCModule3Axis (iModule, vPath);
	if (iModule < 3)
		return -1;
	
	g_stage.Rotate(180.0);
	g_stage.SetVel(3.0, 3.0, 3.0);
	g_stage.SetAccel(1.0, 1.0, 1.0);

	vPath.SetPathParams(P_60HZ,   //path frequency = 30 Hz
					75,       //Store a minimum of 45 points in the path point buffer
					6684.57447,  //X scale - 20000.0 counts per inch
					6684.57447,  //Y scale - 20000.0 counts per inch
					2*6684.57447,      //Z scale - 1.0 counts per inch - not used
					1.0);     //acceleration = 1.0 inch/second/second

	vPath.SetOrigin(0.0, 0.0, 0.0); //set the origin to X = 0, Y = 0, Z = 0
	vPath.SetFeedrate(1.0);         //feedrate = 1.0 inches/second
	vPath.SetTangentTolerance(10.0);  //continuous path tangent tolerence = 10 degrees	
	g_stage.InitPathMode(vPath);
	
	double x,y,z;
//	g_stage.GetPos(x,y,z);
//	InitPathParam(P_60HZ, 60, 
//		          6684.57447, 6684.57447, 2*6684.57447,
//				  1.0,
//				  1.0);

	g_stage.GetPos(x,y,z);
	g_stage.ResetPos();
//Clear the segment list and set the starting point for the path
//  at X = 0, Y = 1, Z = 0
	vPath.ClearSegListA(0,0,0);    

//Add a segment to move to x=0, y=2, z=0
	res = vPath.AddLineSegA(0.0, 1.0, 0.0);    
	if (res<0) return -1;
	
	res = vPath.AddArcSegA( 1.0, 2.0, 0.0,     //end point of arc: x=1, y=2, z=0
							 1.0, 1.0, 0.0,     //center point of arc: x=1, y=1, z = 0
							 0.0, 0.0, -1.0 );   //normal vector to arc plane: x = 0, y = 0, z = -1
	if (res<0) return -1;
	g_stage.ExecuteCoordMotion(vPath);
	
	vPath.ClearSegListA(1.0, 2.0, 0.0);    
	g_stage.GetPos(x,y,z);
	
	res = vPath.AddLineSegA(2.0, 2.0, 0.0);    //line segment endpoint: x=4, y=3, z=0
	if (res<0) return -1;
	
	res = vPath.AddArcSegA( 3.0, 1.0, 0.0,     //end point of arc: x=5, y=2, z=0
							 2.0, 1.0, 0.0,     //center point of arc: x=4, y=2, z = 0
							 0.0, 0.0, -1.0 );   //normal vector to arc plane: x = 0, y = 0, z = -1
	if (res<0) return -1;
	
//line segment endpoint: x=5, y=0, z=0
	res = vPath.AddLineSegA(3.0, 0.0, 0.0);    
	if (res<0) return -1;

//line segment endpoint: x=5, y=0, z=0
	g_stage.ExecuteCoordMotion(vPath);

	vPath.ClearSegListA(3.0, 0.0, 0.0);    
	if (res<0) return -1;

//line segment endpoint: x=5, y=0, z=0
	res = vPath.AddLineSegA(0.0, 0.0, 0.0);    
	if (res<0) return -1;
	g_stage.ExecuteCoordMotion(vPath);
	
	ResetModules(iModule);
	return 0;
};
开发者ID:duchiy,项目名称:CNCMillwithGCodeInterpreter,代码行数:80,代码来源:Motion.cpp


注:本文中的Path::ClearSegListA方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。