Hi!
I have problem with AcDb3dSolid::createLoftedSolid in AutoCAD 2015.
There is example of code:
static void Asdk_TESTLOFT(void)
{
AcDbLine *pLine1 = new AcDbLine(AcGePoint3d( 0.0, 0.0, 0.0), AcGePoint3d( 0.0, 100.0, 0.0 ));
AcDbLine *pLine2 = new AcDbLine(AcGePoint3d( 0.0, 100.0, 0.0), AcGePoint3d( 0.0, 100.0, 70.0 ));
AcDbLine *pLine3 = new AcDbLine(AcGePoint3d( 0.0, 100.0, 70.0), AcGePoint3d( 0.0, 0.0, 70.0 ));
AcDbLine *pLine4 = new AcDbLine(AcGePoint3d( 0.0, 0.0, 70.0), AcGePoint3d( 0.0, 0.0, 0.0 ));
AcDbVoidPtrArray curveArray1;
curveArray1.append(pLine1);
curveArray1.append(pLine2);
curveArray1.append(pLine3);
curveArray1.append(pLine4);
AcDbVoidPtrArray regArr1;
Acad::ErrorStatus aEs = AcDbRegion::createFromCurves(curveArray1, regArr1);
delete pLine1;
delete pLine2;
delete pLine3;
delete pLine4;
if(aEs != Acad::eOk)
return;
AcDbRegion *pRegion1 = (AcDbRegion *)regArr1.at(0);
AcDbLine *pLine5 = new AcDbLine(AcGePoint3d( 300, 0.0 , 0.0), AcGePoint3d( 300, 100.0 , 0.0));
AcDbLine *pLine6 = new AcDbLine(AcGePoint3d( 300.0, 100.0, 0.0), AcGePoint3d( 300.0, 100.0, 35.0));
AcDbLine *pLine7 = new AcDbLine(AcGePoint3d( 300, 100.0 , 35.0), AcGePoint3d( 300.0, 0.0, 35.0 ));
AcDbLine *pLine8 = new AcDbLine(AcGePoint3d( 300.0, 0.0, 35.0), AcGePoint3d( 300.0, 0.0, 0.0));
AcDbVoidPtrArray curveArray2;
curveArray2.append(pLine5);
curveArray2.append(pLine6);
curveArray2.append(pLine7);
curveArray2.append(pLine8);
AcDbVoidPtrArray regArr2;
aEs = AcDbRegion::createFromCurves(curveArray2, regArr2);
delete pLine5;
delete pLine6;
delete pLine7;
delete pLine8;
if(aEs != Acad::eOk)
return;
AcDbRegion *pRegion2 = (AcDbRegion *)regArr2.at(0);
AcGePoint3d startPnt(0.0, 50.0, 0.0);
AcGePoint3d endPnt(300.0, 50.0, 0.0);
AcGePoint3dArray fitPnts;
fitPnts.append(startPnt);
fitPnts.append(endPnt);
AcGeVector3d startTan(0.1223, 2.1674, 0);
AcGeVector3d endTan(0.8968, 1.2518, 0.0);
AcDbSpline *pGuideSpline = new AcDbSpline(fitPnts, startTan, endTan, AcGe::kChord, 4, 0.0);
AcArray< AcDbEntity *> crossCurvesArr;
AcArray< AcDbEntity *> guideCuvesArr;
AcDbEntity *pPathEntity = NULL;
AcDbLoftOptions loftOption;
crossCurvesArr.append(pRegion1);
crossCurvesArr.append(pRegion2);
guideCuvesArr.append(pGuideSpline);
AcDb3dSolid *pLoftedSolid = new AcDb3dSolid;
// crash in 2015; ok in 2012;
aEs = pLoftedSolid->createLoftedSolid(crossCurvesArr, guideCuvesArr, pPathEntity, loftOption);
delete pGuideSpline;
if(aEs != Acad::eOk){
delete pLoftedSolid;
return;
}
AcDbObjectId id3;
addToModelSpace(pLoftedSolid, id3);
}
When I create 3DSolid from AcDbRegion and AcDbSpline, program breakdowns, but if I create 3DSolid from AcDbCircle and AcDbSpline program works without any problem. In case of AutoCAD 2012 all this combinations work good.
How can I fix this problem?
The terms "crash" and "breakdown" are not suitable problem descriptions for a technical forum. If an exception occurs, I recommend to include at least the exception log and best to also include the call stack at the point of exception.
Here are exception log and the call stack at the point of exception.
First-chance exception at 0x000007FEFDAB940D (KernelBase.dll) in acad.exe:
0xE0434352 (parameters: 0xFFFFFFFF80070002, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x000007FEE21D0000).
First-chance exception at 0x000007FEFDAB940D (KernelBase.dll) in acad.exe:
0xE0434352 (parameters: 0xFFFFFFFF80070057, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x000007FEE21D0000).
First-chance exception at 0x000007FEFDAB940D (KernelBase.dll) in acad.exe:
0x000006C6: Array bounds are invalid.
First-chance exception at 0x000007FEFDAB940D (KernelBase.dll) in acad.exe:
0x8001010E: The application called an interface that another thread.
First-chance exception at 0x000007FEFDAB940D (KernelBase.dll) in acad.exe:
0xE0434352 (parameters: 0xFFFFFFFF80131513, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x000007FEE21D0000).
First-chance exception at 0x000007FEFDAB940D (KernelBase.dll) in acad.exe:
0xE0434352 (parameters: 0xFFFFFFFF80131513, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x000007FEE21D0000).
First-chance exception at 0x000007FEFDAB940D (KernelBase.dll) in acad.exe:
0xE0434352 (parameters: 0xFFFFFFFF80131500, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x000007FEE21D0000).
First-chance exception at 0x000007FEFDAB940D (KernelBase.dll) in acad.exe:
0xE0434352 (parameters: 0xFFFFFFFF80070002, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x000007FEE21D0000).
First-chance exception at 0x000007FEFDAB940D (KernelBase.dll) in acad.exe:
0xE0434352 (parameters: 0xFFFFFFFF80131509, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x000007FEE21D0000).
First-chance exception at 0x000007FEE58BF858 (acge20.dll) in acad.exe:
0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.