.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can you convert .NEt to VisualC++ARX?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
diagodose2009
601 Views, 2 Replies

Can you convert .NEt to VisualC++ARX?

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]
Smiley Very Happy


Tags (1)
2 REPLIES 2
Message 2 of 3

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.

Message 3 of 3

Thank you, for all

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

Smiley Surprised

[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]

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost