.NET

.NET

Reply
Mentor
diagodose2009
Posts: 263
Registered: ‎12-04-2009
Message 1 of 3 (238 Views)
Accepted Solution

Can you convert .NEt to VisualC++ARX?

238 Views, 2 Replies
01-13-2013 08:16 PM

Hello2013

I need convert the source . NET to C++ARX?
Please  help, can you translate source1 to source2?
You replace "????" with your source.
The string "????" is idem with "???".
Many thanks............


[source1=csharp]
    // ByA: The source (c#) by KeanWalmsley.
    void GetNormalAndPoint(
     AcGe.Surface surf, ref Vector3d normal, ref Point3d pt)
    {
      Interval[] box = surf.GetEnvelope();
      double p1 = box[0].LowerBound + box[0].Length / 2.0;
      double p2 = box[1].LowerBound + box[1].Length / 2.0;
      Point2d ptParams = new Point2d(p1, p2);
      ???
      PointOnSurface pos = new PointOnSurface(surf, ptParams);
      normal = pos.GetNormal(ptParams);
      pt = pos.GetPoint(ptParams);
    }
[/source1=csharp]

[source2=c++arx]
    int GetNormalAndPoint(AcGeSurface surf, &AcGeVector3d normal, AcGePoint3d &pt)
               {                                                                                    
                  int rr=RTREJ;
               AcGeInterval uParam;
               AcGeInterval vParam;
               int p1ok=0;
               double p1;
               double p2;
               ((AcGeExternalBoundedSurface*)surf)->getEnvelope(uParam, vParam);    
               if ((uParam.isBounded()) && (vParam.isBounded()))
                  {  p1ok=1;
                     p1 = uParam.lowerBound() + (uParam.length() / 2.0);
                     p2 = vParam.lowerBound() + (vParam.length() / 2.0);
                  };
               if (p1ok==0) { ads_printf(_T("\n procedures GetNormalAndPoint failed"));return(rr);};
               AcGePoint2d ptParams(p1,p2);                                               
               AcGePoint3d pos = ((AcGeExternalBoundedSurface*)surf)->evalPoint(ptParams);
               ????
               return(rr);
            };
[/source2=c++arx]
:smileyvery-happy:


Thank you, for all

You replace "????"with three lines:

:smileysurprised:

[source=c++arx]

     AcGePoint3d pos = ((AcGeExternalBoundedSurface*)         
                                 surfaceGeometry)->evalPoint(ptParams);
       AcGePointOnSurface normalobj(*surfaceGeometry,ptParams);
      AcGeVector3d normal=normalobj.normal(ptParams);
     AcGePoint3dptdoi=normalobj.point(ptParams);  //euaici: ptdoi is idem with  pt
[/source=c++arx]

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 2 of 3 (208 Views)

Re: Can you convert .NEt to VisualC++ARX?

01-14-2013 05:37 AM in reply to: diagodose2009

If you mean automate conversion from C# to C++, no that's not going to be possible.

 

The basic ways that the APIs and the languages work are different, and becauss the managed wrappers often do more than just delegate to a native C++ API (mostly relating to marshaling data from native to managed and visa verse), it's not as simple as converting a call to a managed api into a call to a native API. There are also many managed types that have no direct native counterparts, or are radically different from their native counterparts.

 

If your intention is automating conversion as a way of getting around having to learn C++ and/or the native ObjectARX API, then please don't waste anyone's time with that.

Mentor
diagodose2009
Posts: 263
Registered: ‎12-04-2009
Message 3 of 3 (153 Views)

Re: Can you convert .NEt to VisualC++ARX?

01-15-2013 06:19 PM in reply to: DiningPhilosopher

Thank you, for all

You replace "????"with three lines:

:smileysurprised:

[source=c++arx]

     AcGePoint3d pos = ((AcGeExternalBoundedSurface*)         
                                 surfaceGeometry)->evalPoint(ptParams);
       AcGePointOnSurface normalobj(*surfaceGeometry,ptParams);
      AcGeVector3d normal=normalobj.normal(ptParams);
     AcGePoint3dptdoi=normalobj.point(ptParams);  //euaici: ptdoi is idem with  pt
[/source=c++arx]

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.