Author Topic: getSplitCurves Method  (Read 9171 times)

0 Members and 1 Guest 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: 3882
  • 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

T.Willey

  • Needs a day job
  • Posts: 5183
Re: getSplitCurves Method
« Reply #15 on: June 16, 2006, 06:44:16 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.

I don't know if this will help, but here is a link to a post that Joe Burke did.  It has a break method with ActiveX stuff.  I have used it, and it seems to work for what I needed it for.

Hope it helps.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: getSplitCurves Method
« Reply #16 on: June 16, 2006, 06:52:09 pm »
Thank you Tim;

Yes I am aware of the function Joe wrote, an excellent one!, but it is not a complete as far as I know.

Quote
;  BreakMethod version 1.0
;;  Joe Burke  6/6/2005
;;
;;  Current version breaks lines, arcs, circles,
;;  ellipses (open or closed), lightweight plines
;;  (open or closed) and heavy plines (open or closed).
;;  Does not handle curve objects like splines
;;  or fitted, cubic, quadratic plines.

I almost have solved ALL the conditions, the fitted, cubic and quadratic were kind of hard to handle, once I have my command ready, I'll will post an image demo about how it works. maybe two more hours, I guess.  :-)

T.Willey

  • Needs a day job
  • Posts: 5183
Re: getSplitCurves Method
« Reply #17 on: June 16, 2006, 07:21:30 pm »
Glad to hear that Luis.  Have a great weekend, and Happy Father's day to you. :-)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: getSplitCurves Method
« Reply #18 on: June 17, 2006, 01:18:21 pm »
Got my project working beautiful...

 :-)
« Last Edit: June 18, 2006, 08:28:00 pm by LE »

DaveW

  • Guest
Re: getSplitCurves Method
« Reply #19 on: June 19, 2006, 09:25:24 am »
Very nice. I am glad you got it worked out.

I am not sure why you created this function, but I am sure it will be appreciated where it is needed.

I had to create a function that takes 3D ACIS solids from Rhino to ACAD to  AlphaCAM. The final output could not be splines. FYI, the ACIS solids from Rhino are spline based. ACISIN and explode the solids and you get bodies (2000 - 2006), surfaces( 2007), explode the bodies or surfaces and you get splines. Lines are splines, arcs are splines, and circles are 2 spline arcs. It took 227 hours to pull off. All through VB hack code, lol. I am not a pro like you man.

I never got paid! The customer loved it and tested it, but was too slow in paying, so I blew them off.
This is actually pretty funny in a bad way, wasn't then though, but almost every boat/yacht yard used Rhino and I have the only code that can take the whole 3D model and send almost the entire model directly to a CAM software that can then load it and generate all the g-code and nesting. Ten year Rhino users are ready to drop Rhino at a moments notice and use ACAD 2007 to avoid the extra steps involved with having to get the solids first aligned to the WCS, before exporting the entire model, once they see how automated the process is in ACAD 2007. Here is the funny part: I bet 2007 would not have handled these shapes if Rhino did not give them the competition. I like the competition from Rhino pushing ADesk. We all win in the end. This was not the fallout I was looking for.

I talked to Bob McNeel, at Rhino, and told him I could port over to Rhino and take ACAD out of the picture completely, but he had to throw some money at it. Like 10 G's or so. Not much money really. He responded that he had developed the third party development package and that was his way of helping AND that he had a whole bunch of CAM softwares that worked inside of Rhino that already provided for the customers needs.

Well now, if this was true, then why are 10 year users ready to jump ship? I tried to explain this to him, but he never got back to me. He just does not understand the time difference of processing each part one at a time, laying each part flat and orientated correctly for grain, and then feature recognizing or manually toolpathing each part, as opposed to just selecting the entire model, right-clicking, and choosing export to CNC, then just oping the CAM software and going import and being done with it all.

It seems that even the most innovative companies tend to loose sight of the customers needs when they get big. I sure hope that does not happen to my company. I just may, as most of these guys are smarter than me.

My code, working or not, is still just a proof of concept of what is possible, through using my concepts and utilizing talented coders like yourself. We do not have the talent to code it right, so I hack it together. That is why I am so impressed with what you have created there. Being able to deal with those spine objects the way you are is very difficult and I hope to see your skills accessed by successful companies to make getting the most fundamentally advanced complicated designs (spline based objects) as easy to work with a line for the end user. Only then will we have the best designs being manufactured with gr4eat efficiency. Keep up the great work man!

LE

  • Guest
Re: getSplitCurves Method
« Reply #20 on: June 19, 2006, 10:28:01 am »
My code, working or not, is still just a proof of concept of what is possible, through using my concepts and utilizing talented coders like yourself. We do not have the talent to code it right, so I hack it together. That is why I am so impressed with what you have created there. Being able to deal with those spine objects the way you are is very difficult and I hope to see your skills accessed by successful companies to make getting the most fundamentally advanced complicated designs (spline based objects) as easy to work with a line for the end user. Only then will we have the best designs being manufactured with gr4eat efficiency. Keep up the great work man!

Thank you for your kind words.

frtfff

  • Newt
  • Posts: 200
Re: getSplitCurves Method
« Reply #21 on: August 16, 2015, 08:24:21 am »
There is no code to post.