Move Axis Pbm



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/04/2004 at 00:26, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   7.3 
    Platform:   Windows  ; Mac  ;  
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hi,
    I wanna move an object axis to the point which has been selected by the user. I have written the following code in COFFEE which is not working properly. Some time its okay but not always. Can any one help me to find out the problem?
    Thanks in advance.

        
        
        
        
          doc = GetActiveDocument(); // Get Active Document  
          obj = GetActiveObject(doc); // Get Active Object
        
        
        
        
          // Check which point has been selected by the user  
          cnt = obj->GetPointCount();  
          bs = obj->GetPointSelection();  
          for(i=0; i<=cnt; i++)  
          {   
           if(bs->IsSelected(i))  
           {   
            globalpt = obj->GetMg()->GetMulP(obj->GetPoint(i));  
            break;  
           }  
          }
        
        
        
        
          // Move all the points position into an array... ptarray;
        
        
        
        
          ptarray = new(array, cnt+1);  
          for(i=0; i<cnt; i++)  
           ptarray[i] = obj->GetMg()->GetMulP(obj->GetPoint(i));
        
        
        
        
          // Move the object to the selected point's position  
          obj->SetPosition(globalpt);
        
        
        
        
          // Now move all the points back to its previous position  
          m = obj->GetMg();  
          m->Invert();
        
        
        
        
          for(i=0; i<cnt; i++)  
          obj->SetPoint(i, m->GetMulP(ptarray[i]));
        
        
        
        
          obj->Message(MSG_UPDATE);
        
        
        
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/04/2004 at 20:00, xxxxxxxx wrote:

    I got it guys. Thanks...
    Charles.


Log in to reply