arx开发(如何用ARX在CAD中进行文字的开发)

案例 2020-02-05 18:08:17

CAD二次开发 ObjectARX怎么设置当前图层
视图-用户界面-工具栏-CAD-图层
出现图层特性管理器在哪里可以选择你想要的图层(你之前设置好了的图层)

在默认-图层中的第一排图标的第一个(图层特性)中新建图层
autocad2008利用objectarx二次开发,从画出的圆中...
void GetCircleInfo()
{
ads_name ent;
ads_point p1;
while(acedEntSel(_T(" 选择圆:"),ent,p1)==RTNORM){
AcDbObjectId id;
if(Acad::eOk != acdbGetObjectId(id,ent)) continue;

AcDbEntity* pEnt;
if (Acad::eOk != acdbOpenAcDbEntity( pEnt, id, AcDb::kForRead, Adesk::kFalse )) continue;
if(pEnt->isKindOf(AcDbCircle::desc())){
AcDbCircle *pCircle = (AcDbCircle *)pEnt;
double radius = pCircle->radius();
AcGePoint3d pCen = pCircle->center();
CString msg;
msg.Format(_T("圆心:(%.f,%.f), 半径:%.f"),pCen.x,pCen.y,radius);
AfxMessageBox(msg);
}
else
{
AfxMessageBox(_T("不是圆弧!"));
}
pEnt->close();
}
return;
}

H17-0626现代简欧式餐桌椅H17-0626现代简欧式餐桌椅


求助小白问题,vs2010 arxObject2014开发,添加命令
这个问题我找了很久才找到,向导生产工程时选择mfc支持,在acrxEntryPoint.cpp文件里添加

// (C) Copyright 2002-2012 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.cpp

//-----------------------------------------------------------------------------

#include "StdAfx.h"

#include "resource.h"

//-----------------------------------------------------------------------------

#define szRDS _RXST("long")

void initApp();

void unloadApp();

void helloWorld();

void initApp()

{

// register a command with the AutoCAD command mechanism

acedRegCmds->addCommand(_T("HELLOWORLD_COMMANDS"),

_T("Set"),

_T("Set"),

ACRX_CMD_TRANSPARENT,

helloWorld);

}

void unloadApp()

{

acedRegCmds->removeGroup(_T("HELLOWORLD_COMMANDS"));

}

void helloWorld()

{

acutPrintf(_T(" 我是最厉害的!"));

}

//-----------------------------------------------------------------------------

//----- ObjectARX EntryPoint

class CMoveBeamSteelApp : public AcRxArxApp {

public:

CMoveBeamSteelApp () : 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

initApp();//加载程序

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

unloadApp();//卸载程序

return (retCode) ;

}

virtual void RegisterServerComponents () {

}

// The ACED_ARXCOMMAND_ENTRY_AUTO macro can be applied to any static
member

// function of the CMoveBeamSteelApp class.

// The function should take no arguments and return nothing.

//

// NOTE: ACED_ARXCOMMAND_ENTRY_AUTO has overloads where you can
provide resourceid and

// have arguments to define context and command mechanism.

// ACED_ARXCOMMAND_ENTRY_AUTO(classname, group, globCmd, locCmd,
cmdFlags, UIContext)

// ACED_ARXCOMMAND_ENTRYBYID_AUTO(classname, group, globCmd,
locCmdId, cmdFlags, UIContext)

// only differs that it creates a localized name using a string in
the resource file

// locCmdId - resource ID for localized command

// Modal Command with localized name

// ACED_ARXCOMMAND_ENTRY_AUTO(CMoveBeamSteelApp, longMyGroup,
MyCommand, MyCommandLocal, ACRX_CMD_MODAL)

static void longMyGroupMyCommand () {

// Put your command code here

}

// Modal Command with pickfirst selection

// ACED_ARXCOMMAND_ENTRY_AUTO(CMoveBeamSteelApp, longMyGroup,
MyPickFirst, MyPickFirstLocal, ACRX_CMD_MODAL | ACRX_CMD_USEPICKSET)

static void longMyGroupMyPickFirst () {

ads_name result ;

int iRet =acedSSGet (ACRX_T("_I"), NULL, NULL, NULL, result)
;

if ( iRet == RTNORM )

{

// There are selected entities

// Put your command using pickfirst set code
here

}

else

{

// There are no selected entities

// Put your command code here

}

}

// Application Session Command with localized name

// ACED_ARXCOMMAND_ENTRY_AUTO(CMoveBeamSteelApp, longMyGroup,
MySessionCmd, MySessionCmdLocal, ACRX_CMD_MODAL | ACRX_CMD_SESSION)

static void longMyGroupMySessionCmd () {

// Put your command code here

}

// The ACED_ADSFUNCTION_ENTRY_AUTO / ACED_ADSCOMMAND_ENTRY_AUTO
macros can be applied to any static member

// function of the CMoveBeamSteelApp class.

// The function may or may not take arguments and have to return
RTNORM, RTERROR, RTCAN, RTFAIL, RTREJ to AutoCAD, but use

// acedRetNil, acedRetT, acedRetVoid, acedRetInt, acedRetReal,
acedRetStr, acedRetPoint, acedRetName, acedRetList, acedRetVal to return

// a value to the Lisp interpreter.

//

// NOTE: ACED_ADSFUNCTION_ENTRY_AUTO / ACED_ADSCOMMAND_ENTRY_AUTO
has overloads where you can provide resourceid.

//- ACED_ADSFUNCTION_ENTRY_AUTO(classname, name, regFunc) - this
example

//- ACED_ADSSYMBOL_ENTRYBYID_AUTO(classname, name, nameId, regFunc)
- only differs that it creates a localized name using a string in the resource
file

//- ACED_ADSCOMMAND_ENTRY_AUTO(classname, name, regFunc) - a Lisp
command (prefix C:)

//- ACED_ADSCOMMAND_ENTRYBYID_AUTO(classname, name, nameId, regFunc)
- only differs that it creates a localized name using a string in the resource
file

// Lisp Function is similar to ARX Command but it creates a lisp

// callable function. Many return types are supported not just
string

// or integer.

// ACED_ADSFUNCTION_ENTRY_AUTO(CMoveBeamSteelApp, MyLispFunction,
false)

static int ads_MyLispFunction () {

//struct resbuf *args =acedGetArgs () ;

// Put your command code here

//acutRelRb (args) ;

// Return a value to the AutoCAD Lisp Interpreter

// acedRetNil, acedRetT, acedRetVoid, acedRetInt,
acedRetReal, acedRetStr, acedRetPoint, acedRetName, acedRetList, acedRetVal

return (RTNORM) ;

}

} ;

//-----------------------------------------------------------------------------

IMPLEMENT_ARX_ENTRYPOINT(CMoveBeamSteelApp)

ACED_ARXCOMMAND_ENTRY_AUTO(CMoveBeamSteelApp, longMyGroup, MyCommand,
MyCommandLocal, ACRX_CMD_MODAL, NULL)

ACED_ARXCOMMAND_ENTRY_AUTO(CMoveBeamSteelApp, longMyGroup, MyPickFirst,
MyPickFirstLocal, ACRX_CMD_MODAL | ACRX_CMD_USEPICKSET, NULL)

ACED_ARXCOMMAND_ENTRY_AUTO(CMoveBeamSteelApp, longMyGroup, MySessionCmd,
MySessionCmdLocal, ACRX_CMD_MODAL | ACRX_CMD_SESSION, NULL)

ACED_ADSSYMBOL_ENTRY_AUTO(CMoveBeamSteelApp, MyLispFunction, false)