Author Topic: Object type conversion  (Read 1638 times)

0 Members and 1 Guest are viewing this topic.

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Object type conversion
« on: July 21, 2012, 12:45:24 PM »
That may not be the correct description, not sure what else to call it. Programming in C# for Civil3d. I have a lot of working code for C3D2010-2012 that I'm wanting to port the C3D2013. Previous versions called the basic Cogo Point a PointEntity, for 2013 this object has been changed to CogoPoint. In hopes of being able to re-use the code with minimal changes, I would like to be able define a PointEntity class which would inherit the CogoPoint class...but it is a Public Sealed class.

Am I out of luck and need to just rewrite the code specifically for 2013? Or is there a simple way to get 2013 to recognize the PointEntity type as a CogoPoint?

Does that make sense?

TheMaster

  • Guest
Re: Object type conversion
« Reply #1 on: July 21, 2012, 01:20:24 PM »
That may not be the correct description, not sure what else to call it. Programming in C# for Civil3d. I have a lot of working code for C3D2010-2012 that I'm wanting to port the C3D2013. Previous versions called the basic Cogo Point a PointEntity, for 2013 this object has been changed to CogoPoint. In hopes of being able to re-use the code with minimal changes, I would like to be able define a PointEntity class which would inherit the CogoPoint class...but it is a Public Sealed class.

Am I out of luck and need to just rewrite the code specifically for 2013? Or is there a simple way to get 2013 to recognize the PointEntity type as a CogoPoint?

Does that make sense?

API changes like that are hard to explain or justify, but you might try using aliases:

Code: [Select]

#if C3D_RELEASE > 2012
   using PointEntity = Autodesk.Civil.Land.DatabaseServices.CogoPoint;
#endif


huiz

  • Swamp Rat
  • Posts: 917
  • Certified Prof C3D
Re: Object type conversion
« Reply #2 on: July 21, 2012, 01:20:56 PM »
I think you better use the CogoPoint and not the PointEntity class. You already needs to rename so many things in specific Civil3D code that it it not such a hard job renaming PointEntity. Or do you have a serious reason to keep using PointEntity?
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

huiz

  • Swamp Rat
  • Posts: 917
  • Certified Prof C3D
Re: Object type conversion
« Reply #3 on: July 21, 2012, 01:22:29 PM »
..

API changes like that are hard to explain or justify, but you might try using aliases:

Code: [Select]

   using PointEntity = Autodesk.Civil.Land.DatabaseServices.CogoPoint;


Without the Land would that be :-)
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: Object type conversion
« Reply #4 on: July 21, 2012, 03:00:08 PM »
Thanks Tony and Huiz!

Tony's suggestion, sans the Land, is what I was looking for. Had a case of Saturday morning brain freeze.

Huiz, for my existing COM-less code working with points I really wanted the code to work in all versions, 2010+. For new features, 2013+, I am using the CogoPoint directly.