📄 icadentpropmain.cpp
字号:
*actype = eBody;
else
return *actype = -1, false;
return true;
}
static inline
int convertAcisTypeToDbType(int actype)
{
if (actype == e3dSolid)
return DB_3DSOLID;
else if (actype == eRegion)
return DB_REGION;
else if (actype == eBody)
return DB_BODY;
assert(false);
return -1;
}
}
void acisEnt_Data2Struct(sds_name ss)
{
using namespace acentprop;
CModeler* modeler = CModeler::get();
if (!modeler->canView())
return;
box_t common[nAcisEnts];
bool bbinit[nAcisEnts] = {false,false,false};
{
long n;
sds_sslength(SDS_EditPropsSS,&n);
sds_name ename;
for (long i = 0l; RTNORM == sds_ssname(ss, i, ename); i++)
{
db_handitem* item = reinterpret_cast<db_handitem*>(ename[0]);
int dbtype = item->ret_type();
int actype;
if (!convertDbTypeToAcisType(dbtype, &actype))
continue;
CDbAcisEntity* pObj = static_cast<CDbAcisEntity*>(item);
box_t one;
modeler->getBoundingBox(pObj->getData(), one.m_low, one.m_high, wcs2ucs());
if (!bbinit[actype])
common[actype] = one, bbinit[actype] = true;
else
common[actype] += one;
}
}
{
for (int ient = e3dSolid; ient < nAcisEnts; ient++)
{
if (!bbinit[ient])
continue;
int dbtype = convertAcisTypeToDbType(ient);
int start = 0;
while (ent_DlgItems[start++].EntTyp != dbtype);//Find the start of the section
int end = start;
while (ent_DlgItems[++end].EntTyp == dbtype);//Find the end of the section
for(int i = start; i < end; i++)
{
ent_DlgItem& item = ent_DlgItems[i];
sds_real value;
switch (item.ID)
{
case ACIS_BOUNDBOXMINX:
value = common[ient].m_low.x();
break;
case ACIS_BOUNDBOXMINY:
value = common[ient].m_low.y();
break;
case ACIS_BOUNDBOXMINZ:
value = common[ient].m_low.z();
break;
case ACIS_BOUNDBOXMAXX:
value = common[ient].m_high.x();
break;
case ACIS_BOUNDBOXMAXY:
value = common[ient].m_high.y();
break;
case ACIS_BOUNDBOXMAXZ:
value = common[ient].m_high.z();
break;
default:
continue;
}
item.OrgValue = value;
item.DspValue = (char*)malloc(50);
sds_rtos(value, -1, -1, item.DspValue);
}
}
}
}
static
bool selectionSetHasAcisEntities
(
sds_name ss
)
{
sds_name ename;
for (long i = 0l; RTNORM == sds_ssname(ss, i, ename); i++)
{
db_handitem* item = reinterpret_cast<db_handitem*>(ename[0]);
int type = item->ret_type();
if ((type != DB_3DSOLID) &&
(type != DB_REGION) &&
(type != DB_BODY))
continue;
return true;
}
return false;
}
//Added Cybage SBD 04/03/2002 DD/MM/YYYY [
//Reason : Fix for Bug No. 77983 from Bugzilla
//Checks if the DXF is a scale, returns true for same
// EBATECH(CNBR) 2002-Apr-24 Add SHAPE and DXF=40 for TEXT like object.
static bool isScaleType(int EntTyp,int resType)
{
if(resType==48) //LTScale
return true;
else if( EntTyp==DB_INSERT && ( resType==41 || resType==42 ||resType==43 ) )
return true;
//else if( (EntTyp==DB_ATTDEF || EntTyp==DB_ATTRIB || EntTyp==DB_TEXT ) && resType==41 )
else if( (EntTyp==DB_SHAPE || EntTyp==DB_ATTDEF || EntTyp==DB_ATTRIB || EntTyp==DB_TEXT ) &&
( resType==40 || resType==41 ))
return true;
else
return false;
}
//Added Cybage SBD 04/03/2002 DD/MM/YYYY ]
//This will fill the struct with the entity data
struct cmd_elistll *ent_Data2Struct(sds_name ss)
{
struct cmd_elistll *pBeg=NULL,*pCur=NULL;
if (selectionSetHasAcisEntities(ss) && CModeler::get()->canView())
acisEnt_Data2Struct(ss);
int start,end,index,EntType;
CString csTmp;
struct resbuf *pTmpRb=NULL,rbent,rbucs,*pRb=NULL;
char fs1[IC_ACADBUF];
sds_point ptUcs;
rbucs.restype=RTSHORT;
rbucs.resval.rint=1;
num_of_splines=0;
num_of_plines=false; pVert=NULL;
num_of_leaders=0;
pDimItem = NULL; /*D.G.*/
cmd_ss2elistll(&pBeg,&pCur,ss,210); //convert a ss to a linked list. NOTE: we have to set th
//->grpptr here because we need it BEFORE walking the llist so we can transform pts as we go
for(pCur=pBeg;pCur!=NULL;pCur=pCur->next) { //Loop through the selection set link list
for(pTmpRb=pCur->entlst; pTmpRb!=NULL ; pTmpRb=pTmpRb->rbnext) { //Loop through the first two links of the entity
if(pTmpRb->restype<0) continue;
if(pTmpRb->restype>=999) continue;
if(pTmpRb->restype==0) {
//Set the type of ent
if(strsame(pTmpRb->resval.rstring,"3DFACE"/*DNT*/)) {
EntType=DB_3DFACE;
pTmpRb=pTmpRb->rbnext;
}
else if(strsame(pTmpRb->resval.rstring,"ARC"/*DNT*/)) {
EntType=DB_ARC;
pTmpRb=pTmpRb->rbnext;
}
else if(strsame(pTmpRb->resval.rstring,"ATTDEF"/*DNT*/)) {
EntType=DB_ATTDEF;
pTmpRb=pTmpRb->rbnext;
}
else if(strsame(pTmpRb->resval.rstring,"ATTRIB"/*DNT*/)) {
EntType=DB_ATTRIB;
pTmpRb=pTmpRb->rbnext;
}
else if(strsame(pTmpRb->resval.rstring,"CIRCLE"/*DNT*/)) {
EntType=DB_CIRCLE;
pTmpRb=pTmpRb->rbnext;
}
else if(strsame(pTmpRb->resval.rstring,"DIMENSION"/*DNT*/)) {
EntType=DB_DIMENSION;
pTmpRb=pTmpRb->rbnext;
pDimItem = pCur; /*D.G.*/
}
else if(strsame(pTmpRb->resval.rstring,"ELLIPSE"/*DNT*/)) {
EntType=DB_ELLIPSE;
pTmpRb=pTmpRb->rbnext;
}
else if(strsame(pTmpRb->resval.rstring,"INSERT")) {
EntType=DB_INSERT;
pTmpRb=pTmpRb->rbnext;
}
else if(strsame(pTmpRb->resval.rstring,"LEADER"/*DNT*/)) {
EntType=DB_LEADER;
pTmpRb=pTmpRb->rbnext;
// Bugzilla No. 78001; 18/03/2002
pDimItem = pCur;
num_of_leaders++;
}
else if(strsame(pTmpRb->resval.rstring,"LINE"/*DNT*/)) {
EntType=DB_LINE;
pTmpRb=pTmpRb->rbnext;
}
else if(strsame(pTmpRb->resval.rstring,"MLINE"/*DNT*/)) {
EntType=DB_MLINE;
pTmpRb=pTmpRb->rbnext;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -