ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 1
Anonymous
1149 Views, 0 Replies

AcDbHatch

I am having problems setting a hatch pattern to anything but 'SOLID'

The following sample code works (and renders properly) when setting a hatch to 'SOLID', but fails when set to 'ANGLE' ( ia have included the acad.pat file definitions as well.) The failure is 'invalidinput' returned from SetPattern if 'ANGLE' is sent as a parameter.

Compiler is VS2008, native C++. executable is a stand alone ObjectDBX Module.

Thanks in Advance...


/// .pat file
;; Note: Dummy pattern description used for 'Solid fill'.
*SOLID, Solid fill
45, 0,0, 0,.125
*ANGLE, Angle steel
0, 0,0, 0,.275, .2,-.075
90, 0,0, 0,.275, .2,-.075
*ANSI31, ANSI Iron, Brick, Stone masonry
45, 0,0, 0,.125


// Sample code
Acad::ErrorStatus AcStat;
AcDbHatch *pHatch = new AcDbHatch();

pHatch->setAssociative(false);
pHatch->setHatchStyle(AcDbHatch::kNormal);
pHatch->setPatternScale(1.0);
pHatch->setPatternAngle(0);

//AcStat = pHatch->setPattern(AcDbHatch::kPreDefined, L"SOLID" );
AcStat = pHatch->setPattern(AcDbHatch::kPreDefined, L"ANGLE");

AcGeDoubleArray vertexBulges;

AcGePoint2dArray vtxs; // = new AcGePoint2dArray();

vtxs.setPhysicalLength( 5 );

AcGePoint2d pt2d1; pt2d1.set( 5, 5 ); vtxs.append( pt2d1 );
AcGePoint2d pt2d2; pt2d2.set( 30, 5); vtxs.append( pt2d2 );
AcGePoint2d pt2d3; pt2d3.set( 30, 30 ); vtxs.append( pt2d3 );
AcGePoint2d pt2d4; pt2d4.set( 5, 30 ); vtxs.append( pt2d4 );
AcGePoint2d pt2d5; pt2d5.set( 5, 5); vtxs.append( pt2d5 );

AcStat = pHatch->appendLoop(AcDbHatch::kExternal | AcDbHatch::kPolyline, vtxs, vertexBulges);

pHatch->evaluateHatch();
pRecord->appendAcDbEntity(pHatch);
pHatch->close();
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost