天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 64|回复: 0

CreateHatch

[复制链接]

该用户从未签到

主题

0

回帖

2912

积分

管理员

积分
2912
发表于 2024-6-22 09:46:18 | 显示全部楼层 |阅读模式
AcDbObjectId CreateHatch(
                AcDbObjectId dbOId,
                char cLayer[],
                char cPattern[] = "SOLID",
                int nColor = 256,
                double dAngle = 0.0,
                double dScale = 1.0,
                AcDbDatabase * pDbDatab = acdbHostApplicationServices()->workingDatabase())
{
AcCmColor CmC;
AcDbObjectId DbOId;
AcDbObjectIdArray DbOIdA(0, 2);
AcDbBlockTable * pDbBT;
AcDbBlockTableRecord * pDbBTR;
AcGeVector3d normal(0.0, 0.0, 1.0);

DbOIdA.append(dbOId);

AcDbHatch* pDbHat = new AcDbHatch();

pDbHat->setDatabaseDefaults();

pDbHat->setAssociative(Adesk::kTrue); // BUG: doesn't do squat! have to set the reactor yourself to get associativity!

pDbHat->appendLoop(AcDbHatch::kExternal, DbOIdA);

pDbHat->setPatternScale(dScale);

pDbHat->setPatternAngle(dAngle);

pDbHat->setPattern(AcDbHatch::kPreDefined, cPattern);

pDbHat->setNormal(normal);

pDbHat->evaluateHatch(); // crucial call or nothing gets displayed!

pDbDatab->getSymbolTable(pDbBT, AcDb::kForRead);

pDbBT->getAt(ACDB_MODEL_SPACE, pDbBTR, AcDb::kForWrite);

pDbBTR->appendAcDbEntity(DbOId, pDbHat);

pDbHat->setLayer(cLayer);

CmC.setColorIndex(nColor);

((AcDbEntity *)pDbHat)->setColor(CmC);

pDbBT->close();

pDbBTR->close();

pDbHat->close();

return DbOId;

}

 

 

 

 

CreateHatch
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|中国膜结构网|中国膜结构协会|进口膜材|国产膜材|ETFE|PVDF|PTFE|设计|施工|安装|车棚|看台|污水池|中国膜结构网_中国空间膜结构协会

GMT+8, 2024-11-1 11:47 , Processed in 0.134892 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表