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]
Solved! Go to Solution.
Solved by diagodose2009. Go to Solution.
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.
Thank you, for all
You replace "????"with three lines:
[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.