新手提问,如何运行ARX
<P>以下代码是ARX2007中地例题,已编译成ARX文件,在ACD2007已经加载</P><P>可我如何来查看我运行地结果啊?<BR>先输入这个命令ASDK_MKENTS,然后呢???</P>
<P>谁来帮帮我啊,非常谢谢</P>
<P>-------------------------------------------------------------------</P>
<P>#if defined(_DEBUG) && !defined(AC_FULL_DEBUG)<BR>#error _DEBUG should not be defined except in internal Adesk debug builds<BR>#endif</P>
<P>#include <string.h><BR>#include <aced.h><BR>#include <dbents.h><BR>#include <dbsymtb.h><BR>#include <dbgroup.h><BR>#include <dbapserv.h><BR>#include "tchar.h"</P>
<P>AcDbObjectId createLine();<BR>AcDbObjectId createCircle();<BR>void createNewLayer();<BR>void createGroup();<BR>Acad::ErrorStatus changeColor(AcDbObjectId, Adesk::UInt16);</P>
<P>AcDbObjectId createLine()<BR>{<BR> AcGePoint3d startPt(4.0, 2.0, 0.0);<BR> AcGePoint3d endPt(10.0, 7.0, 0.0);<BR> AcDbLine *pLine = new AcDbLine(startPt, endPt);</P>
<P> AcDbBlockTable *pBlockTable;<BR> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, AcDb::kForRead);</P>
<P> AcDbBlockTableRecord *pBlockTableRecord;<BR> pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);<BR> pBlockTable->close();</P>
<P> AcDbObjectId lineId;<BR> pBlockTableRecord->appendAcDbEntity(lineId, pLine);</P>
<P> pBlockTableRecord->close();<BR> pLine->close();</P>
<P> return lineId;<BR>}</P>
<P>AcDbObjectId createCircle()<BR>{<BR> AcGePoint3d center(9.0, 3.0, 0.0);<BR> AcGeVector3d normal(0.0, 0.0, 1.0);<BR> AcDbCircle *pCirc = new AcDbCircle(center, normal, 2.0);</P>
<P> AcDbBlockTable *pBlockTable;<BR> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, AcDb::kForRead);</P>
<P> AcDbBlockTableRecord *pBlockTableRecord;<BR> pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);<BR> pBlockTable->close();</P>
<P> AcDbObjectId circleId;<BR> pBlockTableRecord->appendAcDbEntity(circleId, pCirc);</P>
<P> pBlockTableRecord->close();<BR> pCirc->close();</P>
<P> return circleId;<BR>}</P>
<P>void createNewLayer()<BR>{<BR> AcDbLayerTable *pLayerTable;<BR> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pLayerTable, AcDb::kForWrite);</P>
<P> AcDbLayerTableRecord *pLayerTableRecord = new AcDbLayerTableRecord;<BR> pLayerTableRecord->setName(_T("ASDK_MYLAYER"));</P>
<P> pLayerTable->add(pLayerTableRecord);<BR> pLayerTable->close();<BR> pLayerTableRecord->close();<BR>}</P>
<P>void createGroup(AcDbObjectIdArray& objIds, TCHAR* pGroupName)<BR>{<BR> AcDbGroup *pGroup = new AcDbGroup(pGroupName);<BR> <BR> AcDbDictionary *pGroupDict;<BR> acdbHostApplicationServices()->workingDatabase()->getGroupDictionary(pGroupDict, AcDb::kForWrite);</P>
<P> AcDbObjectId pGroupId;<BR> pGroupDict->setAt(pGroupName, pGroup, pGroupId);<BR> pGroupDict->close();</P>
<P> for (int i = 0; i < objIds.length(); i++) {<BR> pGroup->append(objIds);<BR> }</P>
<P> pGroup->close();<BR>}</P>
<P>Acad::ErrorStatus changeColor(AcDbObjectId entId, Adesk::UInt16 newColor)<BR>{<BR> AcDbEntity *pEntity;<BR> acdbOpenObject(pEntity, entId,<BR> AcDb::kForWrite);</P>
<P> pEntity->setColorIndex(newColor);<BR> pEntity->close();</P>
<P> return Acad::eOk;<BR>}</P>
<P>void runIt()<BR>{<BR> createNewLayer();</P>
<P> AcDbObjectIdArray idArr;</P>
<P> idArr.append(createLine());<BR> idArr.append(createCircle());</P>
<P> changeColor(idArr.last(), 1);<BR> createGroup(idArr, _T("ASDK_TEST_GROUP"));<BR>}</P>
<P>void initApp()<BR>{<BR> acedRegCmds->addCommand(_T("ASDK_MAKE_ENTS"),<BR> _T("ASDK_MKENTS"),<BR> _T("MKENTS"),<BR> ACRX_CMD_MODAL,<BR> runIt);<BR>}</P>
<P>void unloadApp()<BR>{<BR> acedRegCmds->removeGroup(_T("ASDK_MAKE_ENTS"));<BR>}</P>
<P>extern "C" AcRx::AppRetCode<BR>acrxEntryPoint(AcRx::AppMsgCode msg, void* appId)<BR>{<BR> switch (msg) {<BR> case AcRx::kInitAppMsg:<BR> acrxDynamicLinker->unlockApplication(appId);<BR> acrxDynamicLinker->registerAppMDIAware(appId);</P>
<P> initApp();<BR> break;<BR> case AcRx::kUnloadAppMsg:<BR> unloadApp();<BR> }<BR> return AcRx::kRetOK;<BR>}<BR></P> <P>上述程序是生成一个直线和一个圆.</P>
<P>程序加栽后,键入命令后,在屏幕上生成一条直线和一个圆.</P>
<P> </P> <P>楼上地,谢谢你啊</P>
<P>问题是这样地,我键入命令ASDK_MKENTS后</P>
<P>上面一点反应都没有,怎么回事呀</P> 我知道了,因为太小太小,看不清楚,放大就看到了,谢谢楼上楼上地啊
页:
[1]