Author Topic: getSplitCurves Method  (Read 8246 times)

0 Members and 2 Guests are viewing this topic.

LE

  • Guest
getSplitCurves Method
« on: June 14, 2006, 05:18:00 pm »
I am using getSplitCurves() method to break AcDbCurve objects and ALL the ones are working just fine, except the Polylines that are converted to Spline option with PEDIT command (they are turn into heavy plines when you use that option)

My debug solution crashes when I select that type of objects, but if I convert that to SPLINE the getSplitCurves() works just fine, is there something I have to do to avoid this.

I am pretty sure I have the points (for the parameters), they are sorted right, etc.

BTW, even in the status error variable I read that is returning eOk enum.... :-(

Here is a portion of my code:

Code: [Select]
if (pts.isEmpty()) return;

es = pPoly->getSplitCurves(pts,curveSegments);

if (es != Acad::eOk) return;

AcDbObjectId curSpaceId = acdbCurDwg()->currentSpaceId();

for (int i=0; i < curveSegments.length(); i++)  {
AcDbEntity *pPline = AcDbEntity::cast((AcRxObject*)curveSegments.at(i));

. . .

LE

  • Guest
Re: getSplitCurves Method
« Reply #1 on: June 14, 2006, 05:44:28 pm »
Here is a little image demo, to show the nice error...  :laugh:

Bob Wahr

  • Guest
Re: getSplitCurves Method
« Reply #2 on: June 14, 2006, 05:56:51 pm »
I know squat about ARX but I'm pretty sure that a splined polyline is a not curve object which it seems would cause the problem.

Bob Wahr

  • Guest
Re: getSplitCurves Method
« Reply #3 on: June 14, 2006, 06:00:31 pm »
What about the IntersectWith function of AsdkPoly?

LE

  • Guest
Re: getSplitCurves Method
« Reply #4 on: June 14, 2006, 06:08:39 pm »
I know squat about ARX but I'm pretty sure that a splined polyline is a not curve object which it seems would cause the problem.

Thank you.

It is a POLYLINE (AcDb2dPolyline Class) object and that it is inherits from the AcDCurve Class

LE

  • Guest
Re: getSplitCurves Method
« Reply #5 on: June 14, 2006, 06:13:10 pm »
What about the IntersectWith function of AsdkPoly?

Thanks!

Before I call the getSplitCurves(), I get all the intersections that cross the path (the curve object selected), the problem is when I tried to split into new segments.....  :-(

Code: [Select]
for (int i = 0; i < length1; i++)
{
AcDbObjectId objId;
ads_name ename;
acedSSName(sel1,i,ename);
if (acdbGetObjectId(objId,ename) != Acad::eOk) return;
AcDbObjectPointer<AcDbEntity> pEnt(objId,AcDb::kForRead);

if (pEnt.openStatus() == Acad::eOk)
{
es = pPoly->intersectWith(pEnt.object(),AcDb::kOnBothOperands,ints);

if (es == Acad::eOk)
{
if (!ints.isEmpty()) {

LE

  • Guest
Re: getSplitCurves Method
« Reply #6 on: June 15, 2006, 11:54:52 am »
I have noticed that the problem is only with AcDb2dPolyline that are spline-fit, so I will try to convert those into a lwpolyline before doing the spliting.

LE

  • Guest
Re: getSplitCurves Method
« Reply #7 on: June 15, 2006, 02:28:48 pm »
Does anyone have implemented any break functions, without using the command break, even in C# or any other language or way/form?  or have encounter the same issue as I have? :-o

Or normally I asked this rare questions?   :-D

OK... have to study a little more.


Thanks.

Jeff_M

  • King Gator
  • Posts: 3864
  • C3D user & customizer
Re: getSplitCurves Method
« Reply #8 on: June 15, 2006, 03:11:08 pm »
Luis,
I cannot find this issue being raised over on that other place that I can't mention here..... :-) Nor have I heard back from them.

LE

  • Guest
Re: getSplitCurves Method
« Reply #9 on: June 15, 2006, 03:17:07 pm »
Luis,
I cannot find this issue being raised over on that other place that I can't mention here..... :-) Nor have I heard back from them.

No problem Jeff;

I am stuck right now into the convertion from a AcDb2dPolyline of the type k2dCubicSplinePoly to AcDbPolyline, it appears that is the only way (at least from my own point of view)

Now, if you do a search on the web, there is very very very little about this method.....  :-(

Again thanks!

LE

  • Guest
Re: getSplitCurves Method
« Reply #10 on: June 15, 2006, 03:22:03 pm »
I am going to ask in the adesk objectarx and see if the masters know.

Alexander Rivilis

  • Bull Frog
  • Posts: 206
  • Programmer from Kiev (Ukraine)
Re: getSplitCurves Method
« Reply #11 on: June 15, 2006, 04:53:30 pm »
I am going to ask in the adesk objectarx and see if the masters know.
I did not try that, but you can get spline from this curve (AcDbCurve::getSpline) and try to operate with it.

LE

  • Guest
Re: getSplitCurves Method
« Reply #12 on: June 15, 2006, 05:12:53 pm »
Thank you Alexander;

Yes I did what you recommend and still no luck, is returning this ERROR = eGeneralModelingFailure:

And here is a portion of the code, where I did the modification, to run my tests I have a switch statement in my code.

Code: [Select]
if (pPoly->isKindOf(AcDb2dPolyline::desc()))
{
AcDb2dPolyline *tmp2dPoly = AcDb2dPolyline::cast((AcRxObject*)pPoly.object());
switch (tmp2dPoly->polyType()) {
case AcDb::k2dCubicSplinePoly:

acutPrintf(_T("\nPolylineType = k2dCubicSplinePoly"));

AcDbSpline* spline;
pPoly->getSpline(spline);
es = spline->getSplitCurves(pts,curveSegments);

if (es == Acad::eOk)
{
AcDbObjectId curSpaceId = acdbCurDwg()->currentSpaceId();
for (int i=0; i < curveSegments.length(); i++)
{
tmpCurve = static_cast<AcDbCurve*>(curveSegments[i]);
if (tmpCurve) {
AcDbBlockTableRecord *pBlkRec = NULL;
if (acdbOpenObject(pBlkRec,curSpaceId,AcDb::kForWrite) == Acad::eOk)
{
pBlkRec->appendAcDbEntity(tmpCurve);
pBlkRec->close();
tmpCurve->close();
}
}
}
curveSegments.setLogicalLength(0);
} else {
acutPrintf("\nERROR=%s", acadErrorStatusText(es));
for (int i = 0; i < curveSegments.length(); i++) {
tmpCurve = static_cast<AcDbCurve*>(curveSegments[i]);
delete tmpCurve;
}
curveSegments.setLogicalLength(0);
}
break;
« Last Edit: June 20, 2006, 10:27:18 am by LE »

LE

  • Guest
Re: getSplitCurves Method
« Reply #13 on: June 16, 2006, 01:47:09 pm »
Still have not been able to get this to work, for now I have a filter for polylines with the type of AcDb::k2dCubicSplinePoly

I have tried to use the convertFrom() method but as I said no worky.... can someone tell me what I'm doing wrong?... here is the part of my code where I am trying to get a temp AcDbPolyline, to me looks that the code is right, but as normal it may not.

Thank you.
Luis.

Code: [Select]
if (pPoly->isKindOf(AcDb2dPolyline::desc()))
{
AcDb2dPolyline *tmp2dPoly = AcDb2dPolyline::cast((AcRxObject*)pPoly.object());
if (tmp2dPoly->polyType() == AcDb::k2dCubicSplinePoly)
{
AcDbPolyline *varPoly = new AcDbPolyline();
varPoly->convertFrom((AcDbEntity *&)tmp2dPoly,Adesk::kFalse);
acdbOpenObject(varPoly, varPoly->objectId(), AcDb::kForWrite);
if (varPoly->getSplitCurves(pts,curveSegments) == Acad::eOk)
{
AcDbObjectId curSpaceId = acdbCurDwg()->currentSpaceId();
for (int i=0; i < curveSegments.length(); i++)
{
AcDbEntity *pPline = AcDbEntity::cast((AcRxObject*)curveSegments.at(i));
AcDbBlockTableRecord *pBlkRec = NULL;
if (acdbOpenObject(pBlkRec,curSpaceId,AcDb::kForWrite) == Acad::eOk)
{
pBlkRec->appendAcDbEntity(pPline);
pBlkRec->close();
pPline->close();
}
}
}
varPoly->close();
delete varPoly;
}
}
« Last Edit: June 20, 2006, 10:28:16 am by LE »

LE

  • Guest
Re: getSplitCurves Method
« Reply #14 on: June 16, 2006, 02:10:31 pm »
I see why.... I should read the help function more carefully

"This fills the AcDbPolyline with data from the AcDb2dPolyline pointed to by pEnt. pEnt must point to a k2dSimplePoly or k2dFitCurvePoly type of AcDb2dPolyline object in a database"

Means that convertFrom() does not work for k2dCubicSplinePoly type.... hmmmmm