Page 1 of 1

Failed CreateLoftedSolid Version 10.1 did run in 9.2

Posted: Tue Aug 02, 2022 11:36 am
by RaHo
Hello together,

I got follow Error message:

Teigha.DatabaseServices.Solid3d : Failed CreateLoftedSolid
PxWedge Wedge 150 305 620 395 620

//-------------------------------------------------------------------
internal static Solid3d GetSolid3d(PxWedge Wedge, ObjectId LayObjId)
{
double vy1 = 0.5 * Wedge.DimY1, vz1 = 0.5 * Wedge.DimZ1, vz2 = 0.5 * Wedge.DimZ2;
double vy21 = -0.5 * Wedge.DimY2 + Wedge.OffSet, vy22 = 0.5 * Wedge.DimY2 + Wedge.OffSet;
//------------------------------------------
Point3d[] polypts1 = new[]
{
new Point3d(-vz1, -vy1, 0),
new Point3d(-vz1, vy1, 0),
new Point3d(vz1, vy1, 0),
new Point3d(vz1, -vy1, 0)
};
Point3d[] polypts2 = new[]
{
new Point3d(-vz2, vy21, Wedge.DimX),
new Point3d(-vz2, vy22, Wedge.DimX),
new Point3d(vz2, vy22, Wedge.DimX),
new Point3d(vz2, vy21, Wedge.DimX)
};
Polyline2d vPline1 = new Polyline2d(Poly2dType.SimplePoly, new Point3dCollection(polypts1), 0, true, 0, 0, new DoubleCollection(new double[4]));
Polyline2d vPline2 = new Polyline2d(Poly2dType.SimplePoly, new Point3dCollection(polypts2), 0, true, 0, 0, new DoubleCollection(new double[4]));
vPline2.TransformBy(Matrix3d.Displacement(new Vector3d(0, 0, Wedge.DimX)));
//------------------------------------------
LoftOptions LO = new LoftOptions();
Entity[] crossSections = { vPline1, vPline2 };
//------------------------------------------
Solid3d acSol3D = new Solid3d();
acSol3D.SetDatabaseDefaults();
try
{

acSol3D.CreateLoftedSolid(crossSections, new Entity[0], null, LO);
acSol3D.TransformBy(Matrix3d.Rotation(0.5 * Math.PI, vVecy, vPo0));
acSol3D.TransformBy(Wedge.MatTransForm);
acSol3D.LayerId = LayObjId;
}
//------------------------------------------
catch (System.Exception ex)
{
MsgSys.MsgOut(ex.TargetSite.ReflectedType.FullName + " : " + ex.Message, 1);
MsgSys.MsgOut("PxWedge Wedge " + Wedge.DimX.ToString() + " " + Wedge.DimY1.ToString() + " " + Wedge.DimZ1.ToString() + " " + Wedge.DimY2.ToString() + " " + Wedge.DimZ2.ToString(), 1);
}
finally
{
vPline1.Dispose(); vPline2.Dispose();
foreach (Entity vEnty in crossSections) { vEnty.Dispose(); }
}
//------------------------------------------
return acSol3D;
}
//-------------------------------------------------------------------

Re: Failed CreateLoftedSolid Version 10.1 did run in 9.2

Posted: Sat Aug 06, 2022 7:17 am
by Danielm103
try adding ex.StackTrace in your catch to see if it shows anything

Re: Failed CreateLoftedSolid Version 10.1 did run in 9.2

Posted: Sat Aug 06, 2022 11:42 am
by RaHo
Teigha.DatabaseServices.Solid3d : Failed CreateLoftedSolid
CrtPxEtys.GetSolid3d(PxWedge Wedge, ObjectId LayObjId) in CrtPxEtys.cs: Line 2176.
PxWedge Wedge 100 100 100 100 100 // Offset = 0

acSol3D.CreateLoftedSolid(crossSections, new Entity[0], null, LO); // Line 2176

Re: Failed CreateLoftedSolid Version 10.1 did run in 9.2

Posted: Sun Aug 07, 2022 4:45 am
by Danielm103
Ah bummer, sometimes the stack trace will show where the function fails internally.
not sure what else to do, my trial expired. you might use ILSPY and look and see if the internal function has changed between the two versions

Re: Failed CreateLoftedSolid Version 10.1 did run in 9.2

Posted: Mon Aug 15, 2022 8:37 am
by RaHo
Found bug:
You have to append CrossEntity to BlockTableRecord before!

//---------------------------------------------------------------------------------
for (int i = 0; i < crossSections.Length; i++)
{
acBlkTblRec.AppendEntity(crossSections);
//acTrans.AddNewlyCreatedDBObject(crossSections, true);
}

Re: Failed CreateLoftedSolid Version 10.1 did run in 9.2

Posted: Tue Aug 16, 2022 1:15 am
by Danielm103
cool!
it might be enough to setDatabaseDefaults to crossSections if you don't actually need them in the database.

Re: Failed CreateLoftedSolid Version 10.1 did run in 9.2

Posted: Wed Jan 25, 2023 11:49 am
by RaHo
IntelliCad 11.1 tested:

It's run now. :-)