⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch3_1commands.cpp

📁 ARX/CAD二次开发
💻 CPP
字号:
/////////////////////////////////////////////
// ObjectARX defined commands

#include "StdAfx.h"
#include "StdArx.h"


// This is command 'RBCIRC'
void rbcirc()
{
	ads_point cp = {5.0, 5.0, 0.0};
	ads_real rad = 2.24086;
	ads_name circEnt;
	int rc = RTNORM;
	char kw[4];
	struct resbuf *rbcirc;

	acedCommand(RTSTR, "CIRCLE",
				RTPOINT, cp,
				RTREAL, rad,
				RTNONE);

	rc = acdbEntLast(circEnt);
	if(rc == RTNORM)
	{
		if(!printEntInfo(circEnt))
		{
			acutPrintf("\nFailed to print entity info. ");
			return;
		}
	}
	else
	{
		acutPrintf("\nFailed to retrieve last entity. ");
		return;
	}

	while(rc == RTNORM)
	{
		acedInitGet(NULL, "Yes No");
		rc = acedGetKword("\nDraw another circle [Yes/No]<Yes>: ", kw);

		switch(rc)
		{
			case RTERROR:
				acutPrintf("\nAn input error occured - aborting. ");
				return;
			break;

			case RTCAN:
				acutPrintf("\nUser pressed the [ESC] key. ");
				return;
			break;

			case RTNONE:
				strcpy(kw, "Yes");
				rc = RTNORM;
			break;
		} // switch

		if(strcmp(kw, "No") == 0)
		{
			rc = RTNONE;
		}
		else
		{
			acedInitGet(RSG_NONULL, NULL);
			rc = acedGetPoint(NULL, "\nPick circle center point: ", cp);
			if(rc != RTNORM)
			{
				acutPrintf("\nError picking circle center point: ");
				break;
			}

			acedInitGet(RSG_NONULL + RSG_NOZERO + RSG_NONEG, NULL);
			rc = acedGetDist(cp, "\nCircle radius: ", &rad);
			if(rc != RTNORM)
			{
				acutPrintf("\nError entering circle radius: ");
				break;
			}

			rbcirc = acutBuildList(RTSTR, "CIRCLE",
								   RTPOINT, cp,
								   RTREAL, rad,
								   RTNONE);

			if(!rbcirc)
			{
				acutPrintf("\nError with acutBuildList(): ");
				break;
			}

			rc = acedCmd(rbcirc);
			if(rc != RTNORM)
			{
				acutPrintf("\nError creating circle with acedCmd(): ");
				acutRelRb(rbcirc);
				break;
			}

			rc = acdbEntLast(circEnt);
			if(rc != RTNORM)
			{
				acutPrintf("\nFailed to retrieve last entity. ");
				acutRelRb(rbcirc);
				break;
			}

			if(!printEntInfo(circEnt))
			{
				acutPrintf("\nFailed to print last circle's data. ");
			}

			acutRelRb(rbcirc);

		} // else

	} // while
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -