기본 콘텐츠로 건너뛰기

라벨이 Entity인 게시물 표시

어떤 좌표에 위치한 엔터티 구하기

샘플 코드 int ArxGetEntUnderPos(AcDbObjectIdArray& ids , const AcGePoint3d& pt) { ads_point ptUnder = {pt.x, pt.y, pt.z}; ads_name ss; int res; if (RTNORM != (res = acedSSGet(":E", ptUnder, NULL, NULL, ss))) { // There is probably nothing under the cursor, // so return and let AutoCAD process the message return RTFAIL; } long length = 0L; acedSSLength(ss, &length); if (0 == length) { // There is nothing under the cursor, // so there is no need to show the context menu. // Let AutoCAD process the message. acedSSFree(ss); return RTFAIL; } ads_name ename; for(int i = 0;i < length;i++) { acedSSName(ss, i, ename); AcDbObjectId entId; if(Acad::eOk != acdbGetObjectId(entId, ename)) continue; ids.append(entId); } acedSSFree(ss); return RTNORM; }

Entity 생성 예

샘플 코드 #include BOOL purePaperSpace() { struct resbuf res; int tilemode, cvport; ads_getvar("tilemode", &res); tilemode = res.resval.rint; ads_getvar("cvport", &res); cvport = res.resval.rint; if(tilemode == 0 && cvport == 1) return TRUE; else return FALSE; } // Helper to posts an entity to the database Adesk::Boolean PostToDb(AcDbEntity* pEnt, AcDbObjectId& objId) { AcDbBlockTable *pBlockTable; Acad::ErrorStatus es; es = acdbCurDwg()->getBlockTable(pBlockTable, AcDb::kForRead); if (es != Acad::eOk) { ads_alert("Failed to get the block table!"); pBlockTable->close(); return Adesk::kFalse; } AcDbBlockTableRecord *pBlockRec; if(purePaperSpace()) es = pBlockTable->getAt(ACDB_PAPER_SPACE, pBlockRec, AcDb::kForWrite); else es = pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockRec, AcDb::kForWrite); if (es != Acad::eOk) { ads_alert("Failed to get the block table record!"); pBlockRec-...