|
使用 AcDbRegion::transformBy 方法在 AutoCAD 2015 中与 AutoCAD 2014 相比会给我带来不同的结果。你能告诉我在解释变化的方法中发生了什么变化吗?
答:它在Acad 2014中有效,因为我们之前使用了更大的公差(equalPoint到1.0e-8,equalVector到1.0e-6)。在Acad 2015中,公差设置被删除,此更改对少数情况有影响,下面说明了一个这样的场景,并且还演示了可能的解决方法。感谢我们的 ADN 合作伙伴显示此行为。
要在这种情况下恢复遗留行为,我们可能必须将系统范围的容差重置为
[code]AcGeContext::gTol.setEqualPoint(1.0e-8);
AcGeContext::gTol.setEqualVector(1.0e-6);
static void transformTest()
{
/*Resetting sytsem wide tolerance for ACAD 2015*/
AcGeContext::gTol.setEqualPoint(1.0e-8);
AcGeContext::gTol.setEqualVector(1.0e-6);
double epTol = AcGeContext::gTol.equalPoint();
double evTol = AcGeContext::gTol.equalVector();
CString msg;
msg.Format(_T("point tolerance is %e, and vector tolerance is %e\n"), epTol, evTol);
acedPrompt(msg);
// Second, create a transform matrix that maps from one coordinate syste to another
AcGePoint3d startPoint;
AcGeVector3d mStockProfileXDir, mExtrudeDir, mNormalDir;
startPoint.set(12342.705102605765, -14874.057509290647, 25.766600469474248);
mStockProfileXDir.set(0.00000000000000000, 1.0000000000000000, 0.00000000000000000);
mNormalDir.set(-0.048960818631765893, -6.4357153980460105e-012, 0.99880069995915965);
mExtrudeDir.set(-0.99880069995915977, 0.00000000000000000, -0.048960818631764047);
AcGeMatrix3d xform;
xform.setToAlignCoordSys(AcGePoint3d(0, 0, 0),
AcGeVector3d::kXAxis,
AcGeVector3d::kYAxis,
AcGeVector3d::kZAxis,
startPoint,
mStockProfileXDir,
mNormalDir,
mExtrudeDir);
// Is the new coordinate system orthogonal?
if (!xform.isUniScaledOrtho())
acedPrompt(_T("Transform matrix axes are not orthogonal\n"));
else
acedPrompt(_T("Transform matrix axes are orthogonal\n"));
// Finally, transform a region to the new coordinate system.
AcDbVoidPtrArray curves, regions;
AcDbCircle *pTestCircle = new AcDbCircle(AcGePoint3d::kOrigin, AcGeVector3d::kZAxis, 10.0);
if (pTestCircle != NULL)
{
curves.append(pTestCircle);
AcDbRegion::createFromCurves(curves, regions);
if (regions.length() != 0)
{
for (int i = 0; i < regions.length(); i++)
{
AcDbRegion* testRegion = static_cast<AcDbRegion*>(regions[i]);
Acad::ErrorStatus es = testRegion->transformBy(xform);
delete testRegion;
msg.Format(_T("The transform operation returned %d\n"), es);
acedPrompt(msg);
}
}
delete pTestCircle;
}
}[/code] |
|