Author Topic: What am I doing here.....????  (Read 3249 times)

0 Members and 1 Guest are viewing this topic.

Jeff_M

  • King Gator
  • Posts: 3946
  • C3D user & customizer
What am I doing here.....????
« on: November 20, 2010, 12:01:20 AM »
Let me preface this with: I know nothing about ARX programming, other than what I've read trying to learn c# and the .NET managed wrappers for Autocad and Civil3D.

That being said, I'm here for a few reasons. 1: I'd like to learn a bit. 2: I have a specific need for it right now (I think). 3: I don't have a clue where to begin. 4: Some of the most respected people I know hang out here.

My specific need stems from wanting to try to include a function in a commercial application that does something in Civil3D which is not yet exposed via the C3D API. But, as Tony T. shows HERE it can be done using a mixed native/managed code solution. This is where the "I'm clueless" kicks in. I've been able to get code to manipulate other items using the GetGripPoints and MoveGripPointsTo methods, but when used with a C3D point object the entire entity get moved, not just the desired grippoint. (The c# code I've tested with is attached.)

So here are my questions.....is there any way to accomplish what Tony demonstrates without going the ARX route? If so, how? If not, any ideas on what I need to do to move an individual grippoint that refuses to move using the .NET API.

BTW, even though this is for use with a Civil3D point, I don't think the C3D API is required.

Thanks for whatever guidance you can offer!

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: What am I doing here.....????
« Reply #1 on: November 20, 2010, 09:39:50 AM »
Not being a coder, I don't know if this will help point you in the right direction or not...

However if I understand the goal...to drag parts of a point lable around by it's grip...have you considered, or gotten acces to the "SUB ITEM GRIP" toggle in your code?

Be your Best


Michael Farrell
http://primeservicesglobal.com/

Jeff_M

  • King Gator
  • Posts: 3946
  • C3D user & customizer
Re: What am I doing here.....????
« Reply #2 on: November 20, 2010, 11:09:48 AM »
Not being a coder, I don't know if this will help point you in the right direction or not...

However if I understand the goal...to drag parts of a point lable around by it's grip...have you considered, or gotten acces to the "SUB ITEM GRIP" toggle in your code?
Thanks, Michael, but no, that won't help. I am trying to take a point and either put into it's dragged state with the label a set offset from the point, or relocate an already dragged label to the new offset. I'm leaving the subitems as they are. The idea here is that I want to allow the user to move a number of point labels all at once by the same amount.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: What am I doing here.....????
« Reply #3 on: November 20, 2010, 12:05:51 PM »
OK, even though off target...your explanation of why should help others have a much clearer picture of the desired results.

Curious; is it possible to move a point the desired distance, and then determine that it IS in a dragged state mode, and the relative distance and direction it has been moved from it's 'home' position?  In this manner perhaps you could back into the solution that could then be implemented via the code you are writing. 
Be your Best


Michael Farrell
http://primeservicesglobal.com/

LE3

  • Guest
Re: What am I doing here.....????
« Reply #4 on: November 20, 2010, 12:51:12 PM »
No idea just shooting in the dark ...

In all the custom objects I have done, and guess that these objects are the same, you override the subMoveGripPointsAt(); method ie:
Code: [Select]
#ifdef _ACADTARGET17
Acad::ErrorStatus GenericAssembly::moveGripPointsAt (
#else
Acad::ErrorStatus GenericAssembly::subMoveGripPointsAt (
#endif
const AcDbVoidPtrArray &gripAppData, const AcGeVector3d &offset,
const int bitflags
) {
assertWriteEnabled () ;

for (int i = 0; i < gripAppData.length() ; i++)
{
switch ((int)gripAppData.at(i))
{
case 100:
m_startPoint += offset;
break;
case 101:
m_endPoint += offset;
break;
}
}

//----- If you return eNotImplemented here, that will force AutoCAD to call
//----- the older getGripPoints() implementation. The call below may return
//----- eNotImplemented depending of your base class.
return (Acad::eOk); //(AcDbEntity::subMoveGripPointsAt (gripAppData, offset, bitflags)) ;
}

And that kept internal, and does what you put inside, no idea what Tony did (the zip is not available anymore for download)

Jeff_M

  • King Gator
  • Posts: 3946
  • C3D user & customizer
Re: What am I doing here.....????
« Reply #5 on: November 20, 2010, 01:30:07 PM »
Thanks Luis. Not sure what I can do with that :-) but I'll try to digest it.

I tested the link for Tony's zip and it still works for me...you have to copy/paste it to the address bar. I'd just post it here but he frowns on that....

LE3

  • Guest
Re: What am I doing here.....????
« Reply #6 on: November 20, 2010, 01:37:08 PM »
Thanks Luis. Not sure what I can do with that :-) but I'll try to digest it.

I tested the link for Tony's zip and it still works for me...you have to copy/paste it to the address bar. I'd just post it here but he frowns on that....
I tried to say that when you override that method in your custom object, it simple does what it is inside, after assertWriteEnabled () ; and before 
return (Acad::eOk);

I'll have a look into that code...

Jeff_M

  • King Gator
  • Posts: 3946
  • C3D user & customizer
Re: What am I doing here.....????
« Reply #7 on: November 20, 2010, 01:43:19 PM »
I tried to say that when you override that method in your custom object, it simple does what it is inside, after assertWriteEnabled () ; and before 
return (Acad::eOk);
OK, gotcha!