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

    Extrude Cube

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 416 Views
    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 Offline
      Helper
      last edited by

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

      On 27/04/2008 at 07:52, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:    
      Platform:      
      Language(s) :

      ---------
      Hi. I'm a complete newbie at coffee, and so I got a lot of questions, but here is my concrete problem:
      I'm trying to write a script in coffee, which creates a cube and then extrudes one polygon. After a few hours of reading and testing I managed to write the following code:

      var doc = GetActiveDocument();
           if (!doc) return;
           var wuerfel = new(PolygonObject);
           wuerfel = AllocObject(Ocube);
           doc->InsertObject(wuerfel,NULL,NULL);
           var datac = new(BaseContainer);
           doc->SetActiveObject(wuerfel);
           
           CallCommand(12187);               //Polygon-Modus
           
                
           
           wuerfel = SendModelingCommand(MCOMMAND_MAKEEDITABLE, doc, wuerfel, datac, MODIFY_ALL);
           
           println(typeof(wuerfel));
           
           CallCommand(13323);
                
           var bc=new(BaseContainer);
           bc->SetData(MDATA_EXTRUDE_OFFSET, 5);     
           
           
           SendModelingCommand(ID_MODELING_EXTRUDE_TOOL, doc, wuerfel, bc, MODIFY_POLYGONSELECTION);

      GeEventAdd(REDRAW_ALL);

      My questions are:
      1. I think I made some things to complicated, or just not the best way. I would be pleased if you tell me, which things, as I'm a real newbie and thankful for every advise on that.

      2. Creating the cube works fine, making it editable also, but nothing is extrude. What's wrong here?

      3. How can I select a single polygon of the cube? I tried SetPolygonSelection on the cube, but either I did something wrong or you have to go another way with a cube.

      Thanks so far
      Basti

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 27/04/2008 at 10:18, xxxxxxxx wrote:

        First, you are creating a PolygonObject and then a CubeObject - which is it then? Do the AllocObject(Ocube) only. The result of SendModelingCommand() will be a PolygonObject representation of the cube.

        Don't go into Polygon mode before you Make Editable (this is an object-level command).

        3. answers 2. You need to select polygons before you can extrude them. When you have the 'editable' PolygonObject, use its SetPolygons() command. You will need a BaseSelect to make the selection. Have fun figuring out which polygon is which in the array if that is necessary.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 27/04/2008 at 13:43, xxxxxxxx wrote:

          I did it this way:

          var wuerfel = AllocObject(Ocube);
               doc->InsertObject(wuerfel,NULL,NULL);
                  [..]
               var selection;
               wuerfel->SetPolygon(1, selection);
                    
               var bc=new(BaseContainer);     
               bc->SetData(MDATA_EXTRUDE_OFFSET, 5);          
               SendModelingCommand(ID_MODELING_EXTRUDE_TOOL, doc, selection, bc, MODIFY_POLYGONSELECTION);

          But I still got an error: (5) Incompatible values...INTEGER/OBJECT
          and I don't know why.
          Can you please give me an example how to do this?

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

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

            On 27/04/2008 at 14:44, xxxxxxxx wrote:

            wuerfel->SetPolygonSelection([BaseSelect]).

            SetPolygon() literally sets a polygon (vertex indices) using the given polygon. It looks like SetPolygons() does the same but for the entire polygon array.

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