.NET

.NET

Reply
Collaborator
263 Posts
3 Kudos
6 Solutions
Post 1 of 3
Accepted Solution

Can you convert .NEt to VisualC++ARX?

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


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]

Highlighted
Collaborator
370 Posts
178 Kudos
39 Solutions
Post 2 of 3

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.

Collaborator
263 Posts
3 Kudos
6 Solutions
Post 3 of 3

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:

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]

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Community Alert

The Autodesk Community Forums, Blogs, and Idea Boards will be in read only mode starting on 2/12 at 9PM PST through 12PM PST on 2/13. Please see the following for more information: Site Maintenance Notification

Announcements
Community Alert | The Autodesk Community Forums, Blogs, and Idea Boards will be in read only mode starting on 2/12 at 9PM PST through 12PM PST on 2/13. Please see the following for more information: Site Maintenance Notification