Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Move Axis Pbm

    SDK Help
    0
    2
    299
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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);
          
          
          
      
      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post