summaryrefslogtreecommitdiffstats
path: root/Master/CGuCAD/Beispiele/Make2Red/Make2Red/acrxEntryPoint.cpp
blob: 09f640501fba54eeca450f051849d5926e8a7325 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// (C) Copyright 2002-2005 by Autodesk, Inc. 
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted, 
// provided that the above copyright notice appears in all copies and 
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting 
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC. 
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to 
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//

//-----------------------------------------------------------------------------
//----- acrxEntryPoint.h
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include "resource.h"

//-----------------------------------------------------------------------------
#define szRDS _RXST("CGCAD")

//-----------------------------------------------------------------------------
//----- ObjectARX EntryPoint
class CMake2RedApp : public AcRxArxApp {

public:
	CMake2RedApp () : AcRxArxApp () {}

	virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
		// TODO: Load dependencies here

		// You *must* call On_kInitAppMsg here
		AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;
		
		// TODO: Add your initialization code here

		return (retCode) ;
	}

	virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
		// TODO: Add your code here

		// You *must* call On_kUnloadAppMsg here
		AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;

		// TODO: Unload dependencies here

		return (retCode) ;
	}

	virtual void RegisterServerComponents () {
	}


	// - CGCADMake2Red.make2red command (do not rename)
	static void CGCADMake2Redmake2red(void)
	{
		// Add your code for command CGCADMake2Red.make2red here
		ads_name ent;
		ads_point pickpoint;
		
		if(acedEntSel(_T("Choose a Entity:"), ent, pickpoint)!= Acad::eOk)
			acutPrintf(_T("\nNo Entity picked!")); 
		
		AcDbObjectId id = AcDbObjectId::kNull;
		if (acdbGetObjectId(id,ent) != Acad::eOk)
		{
			acutPrintf(_T("\nNo ID for this Entityname found"));
			return;
		}
		AcDbEntity* pEnt = NULL;
		if (acdbOpenAcDbEntity(pEnt,id,AcDb::kForWrite) != Acad::eOk)
		{		
			acutPrintf(_T("\nNo Object for this ID found"));
			return;
		}
		// Change color
		pEnt->setColorIndex(1);
		pEnt->close();
	}
};

//-----------------------------------------------------------------------------
IMPLEMENT_ARX_ENTRYPOINT(CMake2RedApp)

ACED_ARXCOMMAND_ENTRY_AUTO(CMake2RedApp, CGCADMake2Red, make2red, macheRot, ACRX_CMD_TRANSPARENT, NULL)