- UID
- 112821
- 积分
- 66
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-3-13
- 最后登录
- 1970-1-1
|
发表于 2006-8-21 11:44:11
|
显示全部楼层
TO: RedCAD
你找到答案了吗?如果没有,请看帮助
Using Clip Boundaries in AcGi (在AcGi中使用边界剪切)
ObjectARX® allows you to define a clipping boundary for geometry contained within xrefs and blocks. The clip-boundary portion of the AcGi API allows compound objects (blocks and objects that behave like blocks) to express these clip boundaries to the AcGi implementation.
During worldDraw() or viewportDraw() any drawable may specify a polygonal clip boundary with which to clip its graphics. The following sections describe how to use this API feature.
Clip boundaries are closed, non-self-intersecting, concave 2D polygons. Optional front and back Z clipping values can be assigned. The clip boundary is expressed in an arbitrary coordinate system relative to the objects being clipped.
In AutoCAD, when the user defines a clipping boundary for a block, the view direction and twist of the current view are used to define the coordinate system for the clip boundary. This might be the same as the coordinate system of the block reference being clipped. This is reflected in the API by the provision of a transformation to the clipping space from the block reference system:
Clip boundaries can be nested. A compound object can define a clipping boundary, and the objects that it contains can also define boundaries for their internal geometry. In this case, the nested geometry is first clipped against its parent's boundary and any resultant fragments are then clipped against the clip boundary of the outer block.
In the following example, the clip boundary is pushed onto the clip boundary stack before anything is drawn and popped off again once the drawing for this object is complete:
Adesk::Boolean
MyObject::worldDraw(AcGiWorldDraw* pDraw)
{
AcGiWorldGeometry * pGeom = &pDraw->geometry();
pGeom->pushModelTransform(myTransform());
AcGiClipBoundary cb;
cb.m_bDrawBoundary = true;
cb.m_vNormal = AcGeVector3d::kZAxis;
cb.m_ptPoint = AcGePoint3d::kOrigin;
// Two points treated as a rectangle, three creates a triangle
cb.m_aptPoints.append(AcGePoint2d(0,0));
cb.m_aptPoints.append(AcGePoint2d(5,5));
// We are clipping in our own space
cb.m_xToClipSpace.setToIdentity();
cb.m_xInverseBlockRefXForm = myTransform().inverse();
// No Z clipping
cb.m_bClippingBack = cb.m_bClippingFront = false;
cb.m_dFrontClipZ = cb.m_dBackClipZ = 0.;
Adesk::Boolean bPopClipBoundary = pGeom->pushClipBoundary(&cb);
// Draw something
pGeom->circle(...);
pGeom->popModelTransform();
if(bPopClipBoundary){ pGeom->popClipBoundary(); }
return true; // world-only
}
Since this clipping is a complex operation, some AcGi implementations might not support it fully. In this case, the AcGi implementation may return false from pushClipBoundary(), and you should not call popClipBoundary(). |
|