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

📄 ch4_1commands.cpp

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

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


// This is command 'CNL'
void cnl()
{
	char lyrName[256];
	char kw[20];
	int rc;		// return code
	int col;	// Color value

	AcDbObjectId ltypeId;	// We need the object id of the linetype
							// for layer creation

	rc = acedGetString(0, "\nNew layer name: ", lyrName);
	switch(rc)
	{
		case RTCAN:
			acutPrintf("\nUser canceled");
			return;
		case RTERROR:
			acutPrintf("\nError with input of new layer name ");
			return;
		break;
	}

	if(lyrName[0] == '\0')
	{
		acutPrintf("\nEmpty string for new layer name - invalid ");
		return;
	}

	// Get the layer color
	acedInitGet(RSG_NONULL + RSG_NONEG + RSG_NOZERO, NULL);
	acedGetInt("\nLayer color (1 - 7 only) ", &col);

	if(col > 7)
	{
		acutPrintf("\nToo high a color value. ");
		return;
	}

	// Get the layer line type default = 'CONTINUOUS'
	if(!getNewLyrLtId(ltypeId))
	{
		acutPrintf("\nUnable to retrieve the linetype AcDbObjecId ");
		return;
	}

	// Now that we have a layer name, layer color and line type
	// Ask the user if he wants to make the new layer the current layer
	acedInitGet(NULL, "Yes No");
	rc = acedGetKword("\nMake new layer current - [Yes/No]<Yes>: ", kw);
	switch(rc)
	{
		case RTCAN:
			acutPrintf("\nUser canceled");
		break;
		case RTERROR:
			acutPrintf("\nError in acedGetKword function");
		break;
		case RTNONE:
			// If the user presses the [ENTER] key
			// we take this as a "Yes"
			createNewLayer(lyrName, col, ltypeId, Adesk::kTrue);
		break;
		case RTNORM:
			if(strcmp(kw, "Yes") == 0)
			{
				createNewLayer(lyrName, col, ltypeId, Adesk::kTrue);
			}
			else if(strcmp(kw, "No") == 0)
			{
				createNewLayer(lyrName, col, ltypeId, Adesk::kFalse);
			}
		break;
	}
}

⌨️ 快捷键说明

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