Polygon pattern style

Polygon pattern style

Anonymous
Not applicable
384 Views
3 Replies
Message 1 of 4

Polygon pattern style

Anonymous
Not applicable
Hi, I have a problem to change the pattern style of a polygon with Autocad 2007.
I use this code (that worked in Autocad 2006):

AcDbMPolygon *pPol= NULL;
(... I put in pPol my entity polygon)
pPol->setPattern(AcDbHatch::kPreDefined,"SOLID");
pPol->evaluateHatch(false);

When I use setPattern it give me the error Acad::eInvalidInput. What is wrong?
thanks, Micaela
0 Likes
385 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Maybe: pPol->setPattern(AcDbHatch::kPreDefined,_T("SOLID"));
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thank you for your reply;
I tried also in this way, but it give me the same error.
I really don't understand ....
Micaela
0 Likes
Message 4 of 4

Anonymous
Not applicable
Sorry, but I can not reproduce this error. This code is working in AutoCAD 2007 without error:
[code]
static void MakeMpolygon(void)
{
acrxLoadModule(_T("AcMPolygonObj17.dbx"),false);
ads_name en; ads_point p;
if (acedEntSel(_T("\nSelect polyline for boundary: "),en,p) != RTNORM) return;
AcDbObjectId idp; acdbGetObjectId(idp,en);
AcDbObjectPointer pPoly(idp,AcDb::kForRead);
Acad::ErrorStatus es = pPoly.openStatus();
if (es != Acad::eOk) {
acutPrintf(_T("\nError in opening of polyline: %s"),acadErrorStatusText(es));
return;
}
AcDbObjectPointer pMPol;
es = pMPol.create();
if (es != Acad::eOk) {
acutPrintf(_T("\nError in creating of MPolygon: %s"),acadErrorStatusText(es));
return;
}
pMPol->setDatabaseDefaults(acdbCurDwg());
es = pMPol->appendLoopFromBoundary(pPoly.object());
if (es != Acad::eOk) {
acutPrintf(_T("\npMPol->appendLoopFromBoundary(): %s"),acadErrorStatusText(es));
return;
}
es = pMPol->setPattern(AcDbHatch::kPreDefined,_T("SOLID"));
if (es != Acad::eOk) {
acutPrintf(_T("\npMPol->setPattern(): %s"),acadErrorStatusText(es));
return;
}
es = pMPol->evaluateHatch();
if (es != Acad::eOk) {
acutPrintf(_T("\npMPol->evaluateHatch(): %s"),acadErrorStatusText(es));
return;
}
es = postToDwg(pMPol.object(),acdbCurDwg());
if (es != Acad::eOk) {
acutPrintf(_T("\npostToDwg(): %s"),acadErrorStatusText(es));
return;
}
}
[/code]
0 Likes