ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Clipping problem (ACAD 2000)

1 REPLY 1
Reply
Message 1 of 2
Anonymous
275 Views, 1 Reply

Clipping problem (ACAD 2000)

Hi all,

I have a class derived from AcDbBlockReference. In the worldDraw, viewportDraw and saveAs methods I have to set the clipping boundaries according to the spatial filter in the blocks extension dictionary.
The following code works well if the block was in the WCS origin but fails if the block was not in the origin while clipping.
Therefore I need something like the transformation matrix of the clipping points recieved from pSpatial->getDefinition.
(I tried pSpatial->getVolume but didn't understand the returned values)

if ( (dictId=pBlock->extensionDictionary()) != AcDbObjectId::kNull)
{
AcDbDictionary *pDict;
if (Acad::eOk == acdbOpenObject(pDict, dictId, AcDb::kForRead))
{
AcDbDictionary *pFilter;
if (Acad::eOk == pDict->getAt("ACAD_FILTER", (AcDbObject*&)pFilter, AcDb::kForRead))
{
AcDbSpatialFilter *pSpatial;
if (Acad::eOk == pFilter->getAt("SPATIAL", (AcDbObject*&)pSpatial, AcDb::kForRead))
{
AcGePoint2dArray pnts;
AcGeVector3d normal;
double elevation, frontClip, backClip;
Adesk::Boolean enabled;

if (Acad::eOk == pSpatial->getDefinition(pnts, normal, elevation, frontClip, backClip, enabled))
{
if (enabled == Adesk::kTrue)
{
AcGeMatrix2d mat2d(mat.convertToLocal(normal, pBlock->position()));

AcGiClipBoundary cb;

cb.m_vNormal = normal;
cb.m_ptPoint = pBlock->position();
cb.m_bDrawBoundary = Adesk::kFalse;
for(i = 0; i < pnts.logicalLength(); i++) cb.m_aptPoints.append(pnts);
cb.m_xToClipSpace = mat;
cb.m_xInverseBlockRefXForm = mat;
// No Z clipping
cb.m_bClippingBack = cb.m_bClippingFront = false;
cb.m_dFrontClipZ = cb.m_dBackClipZ = 0.;
cb.m_bDrawBoundary = Adesk::kFalse;
wd->geometry().pushClipBoundary(&cb);
}
}
pSpatial->close();
}
pFilter->close();
}
pDict->close();
}
}

Best regards,

Christian
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Hello again,

I tried the DWG Filer Test of the ARXDBG with the following result:

Filer for:

writeSoftPtrId
writeUInt32 1
writeSoftPtrId
writeHardOwnId eNullObjectId
writeUInt16 2
writePoint2d (22, 32)
writePoint2d (26, 36)
writeVector3d (0, 0, 1)
writePoint3d (0, 0, 0)
writeUInt16 1
writeUInt16 0
writeUInt16 0
writeDouble 2.398282
writeDouble 2.756736
writeDouble -1.627467
writeDouble -83.206807
writeDouble -1.800843
writeDouble 2.056882
writeDouble 0.830340
writeDouble -64.335102
writeDouble 1.095993
writeDouble 0.182666
writeDouble 1.924501
writeDouble -120.395666
writeDouble 1.000000
writeDouble 0.000000
writeDouble 0.000000
writeDouble 0.000000
writeDouble 0.000000
writeDouble 1.000000
writeDouble 0.000000
writeDouble 0.000000
writeDouble 0.000000
writeDouble 0.000000
writeDouble 1.000000
writeDouble 0.000000
writeUInt16 0

I think the first 12 doubles are the transformation matrix from the definition points to the block.

Is this true? And is there another way to access this matrix?

Best regards,

Christian

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

Post to forums  

Autodesk Design & Make Report

”Boost