Multiple sendmodeling command in Import



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

    On 02/09/2009 at 13:33, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R11 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hello

    I write import plugin with polygon optimalization.
    If use MCOMMAND_OPTIMIZE and MCOMMAND_UNTRIANGULATE commands, sometimes get error messages

    Original Point Number: & Polygon Number: 12141 & 3548
    Optimized Polygon Number -> 3546
    Modeling Kernel Error: Failed
    Modeling Kernel Error: Failed
    Modeling Kernel Error: Invalid Kernel State

    Untriangulated Polygon Number - > 3546

    Whatever I tried to have the error message remains. Here is the code.

    > // ----------------------------------------------------------------------------- \> // Create polygon \> // ----------------------------------------------------------------------------- \> [lots of code] \>           // add polygon to the document // \>                doc->InsertObject(op,cobj,NULL); \>                op->Message(MSG_UPDATE); \> \>           //poligon optimize \>                GePrint("Original Point Number: & Polygon Number: " + LongToString(pointCount) + " & " + LongToString(polygonCount)); \>                if (!PolygonOptimize     (doc, bc, op, parameters)) return FALSE; \>                GePrint("Optimized Polygon Number -> "+ LongToString(op->GetPolygonCount())); \> \>           //Untriangulate \>                if (parameters.optimizeuntriang) \>                { \>                     if (!PolygonUntriang     (doc, bc, op, parameters)) return FALSE; \>                     GePrint("Untriangulated Polygon Number -> "+ LongToString(op->GetPolygonCount())); \>                } \> [/lots of code] \>                      \>                      \> // ----------------------------------------------------------------------------- \> // Polygon optimize \> // ----------------------------------------------------------------------------- \> Bool AC4DPOLY::PolygonOptimize     (BaseDocument \*doc, BaseContainer bc, PolygonObject     \*op, ImportParameters parameters) \> { \>      bc.SetBool(MDATA_OPTIMIZE_POINTS,TRUE); \>      bc.SetBool(MDATA_OPTIMIZE_UNUSEDPOINTS,TRUE); \>      if (parameters.optimizemain) \>      { \>           bc.SetBool(MDATA_OPTIMIZE_POLYGONS,parameters.optimizepoly); \>           bc.SetReal(MDATA_OPTIMIZE_TOLERANCE,parameters.optimizepointdistance); \>      } \>      else \>      { \>           bc.SetBool(MDATA_OPTIMIZE_POLYGONS,FALSE); \>           bc.SetReal(MDATA_OPTIMIZE_TOLERANCE,0.0); \>      } \> \>      ModelingCommandData md; \>      md.doc = doc; \>      md.op = op; \>      md.bc = &bc; \> \>      SendModelingCommand(MCOMMAND_OPTIMIZE,md); \> \>      return TRUE; \> } \> \> // ----------------------------------------------------------------------------- \> // Polygon untriangulate \> // ----------------------------------------------------------------------------- \> Bool AC4DPOLY::PolygonUntriang     (BaseDocument \*doc, BaseContainer bc, PolygonObject \*op, ImportParameters parameters) \> { \>      bc.SetBool(MDATA_UNTRIANGULATE_NGONS,parameters.optimizeuntriang_ngon); \>      bc.SetBool(MDATA_UNTRIANGULATE_ANGLE,parameters.optimizeuntriang_ev); \>      bc.SetReal(MDATA_UNTRIANGULATE_ANGLE_RAD,parameters.optimizeuntriang_rad); \> \>      ModelingCommandData md; \>      md.doc = doc; \>      md.op = op; \>      md.bc = &bc; \> \>      SendModelingCommand(MCOMMAND_UNTRIANGULATE,md); \> \>      return TRUE; \> }

    Any help would be greatly appreciated.
    Regard Dinnye



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

    On 02/09/2009 at 13:58, xxxxxxxx wrote:

    This error occurs if the value MDATA_UNTRIANGULATE_NGONS is TRUE


Log in to reply