Inventor Customization

Reply
Contributor
Fleuve
Posts: 16
Registered: ‎08-06-2010
Message 1 of 2 (236 Views)
Accepted Solution

need Surface GetParamAtPoint and GetPointAtParam Advice?

236 Views, 1 Replies
05-21-2012 05:04 PM

The problem begin with recreating a surface with cylinder inside an Edge loop boundary.

EdgeLoopCylinder.png

 

If you remark, this edge loop have not proper start to respect a sweeping philosophy (min to max) and this edge loop was not really symetric (we have 2 missing point on other side of edge)... To correct the problem I've decide to rebuild params array with only one parameter (U) and re-ordered it (in unique data array)... When I Apply GetParamAtPoint, I get that... (everything working fine at this point).

 

 

UVMAP.png

 

Now I try to reverse function to reach each bottom of each U Parameter (SORTED UNIQUE U VALUE)... I push any value of E1, A1, D1 and i'm still get B point in anyway.

 

        CComPtr<SurfaceEvaluator> pSurfEval;
        Face->get_Evaluator(&pSurfEval);
       

        CComSafeArray<double> *GuessParams =  new CComSafeArray<double>;
        CComSafeArray<double> *MaxDeviations =  new CComSafeArray<double>;
        CComSafeArray<double> *Params =  new CComSafeArray<double>;
        CComSafeArray<double> *SolutionNatures =  new CComSafeArray<double>;
        CComSafeArray<double> *Point =  new CComSafeArray<double>;
        
        for (long i = 0; i < CurveLoop->GetNbLoop(); i++)
        {
            for (long j = 0; j < CurveLoop->GetNbPointAtLoop(i); j++)
            {
                CRDVertex* SPoint = CurveLoop->GetPoint(CurveLoop->GetPointAtLoop(i, j));
                
                Point->Add(SPoint->x);
                Point->Add(SPoint->y);
                Point->Add(SPoint->z);
                

                //This Part Working Well
                pSurfEval->GetParamAtPoint(Point->GetSafeArrayPtr(), (*GuessParams).GetSafeArrayPtr(), (*MaxDeviations).GetSafeArrayPtr(), (*Params).GetSafeArrayPtr(), (*SolutionNatures).GetSafeArrayPtr());
                wprintf_s(L"Point (%lf, %lf, %lf) @ UV LIST (%lf, %lf)\n", (*Point)[0], (*Point)[1], (*Point)[2], (*Params)[1], (*Params)[0]);
               
                GuessParams->Destroy();
                MaxDeviations->Destroy();
                Params->Destroy();
                SolutionNatures->Destroy();
                Point->Destroy();
            }
        }

        Params->Add(-3.1416);
        Params->Add(2.0);
            
        pSurfEval->GetPointAtParam(Params->GetSafeArrayPtr(), (*Point).GetSafeArrayPtr());
        wprintf_s(L"Test %lf, %lf, %lf\n", (*Point)[0], (*Point)[1], (*Point)[2]);

 

         FOR EACH U

             create line (U, V min) - (U, V max)

              FOR EACH segement in EdgeLoop

                   Detect Intersection

                   if Intersection Detect add in array

 

Q. Why I still have always the same TEST point?

 

Q. If I enter outer value like (E1) does E gonna be on surface or out surface?

 

Q. I will create virtual line thru V cylinder limit and put in a unique vlaue vector to retreive peer-point. Does SDK have "two line intersection" function or have you an idea to reach V limit (min max) for a U Value. Because when i'm gonna rebuild U Array I'm not know V value for missing point.

 

     FOR EACH U

          create line (U, V min) - (U, V max)

          FOR EACH segement in EdgeLoop

                Detect Intersection

                if Intersection Detect add in array

 

 

Thanks....

 

         

Contributor
Fleuve
Posts: 16
Registered: ‎08-06-2010
Message 2 of 2 (200 Views)

Re: need Surface GetParamAtPoint and GetPointAtParam Advice?

05-24-2012 10:35 AM in reply to: Fleuve

I found It!!! At Once I found time to fix it! Let's me explain

 

1. The problem come with CComSafeArray<double>

2. Combined with a loop.

3. At begin I use Param like input and Point like output. After I reverse, I use Point like input and Param like output and every data become STUCK because some function like GetParamAtPoint and GetPointAtParam renew the output pointer inside the function.... To avoid this probleme, you must re-new input variable (CComSafeArray<double>) before readd data OR another solution that I've think is use Non-Pointer variable for input and Pointer variable for output... Like this you can destroy without renew variable.

4. Unfortunately we don't have CleanArray function and we must use Destroy to clean it.


Corrected Code

 

CComSafeArray<double> *GuessParams =  new CComSafeArray<double>;
CComSafeArray<double> *MaxDeviations =  new CComSafeArray<double>;
CComSafeArray<double> *SolutionNatures =  new CComSafeArray<double>;
CComSafeArray<double> *OutputParam =  new CComSafeArray<double>;              // Pointer Variable
CComSafeArray<double> InputParams;                                                                      // Non Pointer-Variable
        
for (long i = 0; i < CurveLoop->GetNbLoop(); i++)
{
   for (long j = 0; j < CurveLoop->GetNbPointAtLoop(i); j++)
    {
        CRDVertex* SPoint = CurveLoop->GetPoint(CurveLoop->GetPointAtLoop(i, j));
           
        InputParams.Add(SPoint->x);
        InputParams.Add(SPoint->y);
        InputParams.Add(SPoint->z);
                
        //wprintf_s(L"Point (%lf, %lf, %lf) ", (*Point)[0], (*Point)[1], (*Point)[2]);
        pSurfEval->GetParamAtPoint(InputParams.GetSafeArrayPtr(), GuessParams->GetSafeArrayPtr(), MaxDeviations->GetSafeArrayPtr(), OutputParam->GetSafeArrayPtr(), SolutionNatures->GetSafeArrayPtr());
        //wprintf_s(L"@ UV LIST (%lf, %lf)\n", (*Params)[0], (*Params)[1]);

        //wprintf_s(L"GetPrim(\"Null\", null, null, null);\n");
        //wprintf_s(L"Translate(null, %lf, 0, %lf, siAbsolute, siView, siObj, siXYZ, true, null, null, null, null, null, null, null, null, 0, null);\n", (*Params)[1], (*Params)[0]);
    

        double U = (*OutputParam)[0];
        double V = (*OutputParam)[1];

        GuessParams->Destroy();
        MaxDeviations->Destroy();
        SolutionNatures->Destroy();

        OutputParam->Destroy();
        InputParams.Destroy();

        InputParams.Add(U);
        InputParams.Add(V);
                        
        pSurfEval->GetPointAtParam(InputParams.GetSafeArrayPtr(), OutputParam->GetSafeArrayPtr());
        //wprintf_s(L"//Test %lf, %lf, %lf\n", (*Point)[0], (*Point)[1], (*Point)[2]);

        wprintf_s(L"GetPrim(\"Null\", null, null, null);\n");
        wprintf_s(L"Translate(null, %lf, %lf, %lf, siAbsolute, siView, siObj, siXYZ, true, null, null, null, null, null, null, null, null, 0, null);\n", (*OutputParam)[0], (*OutputParam)[1], (*OutputParam)[2]);

        OutputParam->Destroy();
        InputParams.Destroy();
     }
}

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube