Python: Make Object Editable



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

    On 06/10/2010 at 16:24, xxxxxxxx wrote:

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

    ---------
    Background:
    I'm trying to create a Python Generator object that will take a parametric spline object as an input and then spit out a standard spline with a B-Spline interpolation (specifically so I can round some of the harsh corners from a Turtle Mode MoSpline).

    My question:
    What is the equivalent of the "Make Object Editable" command in Python?

      
    import c4d   
    #B-Spliner: Converts all child spline objects into a single spline of type B   
      
    def makeEditable(obj) :   
        return obj.GetVirtualObjects() #This command doesn't exist, what should I use instead?   
      
    def splineToBSpline(spline_obj) :   
        return spline_obj   
      
    def main() :   
        return splineToBSpline(makeEditable(op.GetDown()))   
    


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

    On 28/09/2011 at 13:16, xxxxxxxx wrote:

    This seems to work:

      
    def MakeEditable(op) :   
        if debug: print "MakeEditable()"   
        if (not op) | op.CheckType(c4d.Opolygon) | op.CheckType(c4d.Ospline) : return op   
      
        op = [op.GetClone()]   
        doc = c4d.documents.BaseDocument()   
        doc.InsertObject(op[0],None,None)   
        op = c4d.utils.SendModelingCommand(   
                                 command = c4d.MCOMMAND_MAKEEDITABLE,   
                                 list = op,   
                                 mode = c4d.MODELINGCOMMANDMODE_EDGESELECTION,   
                                 doc = doc )   
        return op[0]   
    


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

    On 29/09/2011 at 09:54, xxxxxxxx wrote:

    You could also use BaseObject.GetCache().



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

    On 30/09/2011 at 06:56, xxxxxxxx wrote:

    c4d.CallCommand(12236) makes the currently selected object editable as well.



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

    On 01/10/2011 at 11:39, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    You could also use BaseObject.GetCache().

    THIS!!! so helpful, returns a polygon representation of almost any object... including cloners!



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

    On 02/10/2011 at 08:19, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Originally posted by xxxxxxxx

    You could also use BaseObject.GetCache().

    THIS!!! so helpful, returns a polygon representation of almost any object... including cloners!

    Please be very careful using this function. It's not always guaranteed that the caches are build. The only time this is guaranteed is during rendering. Always check if the returned cache is valid. Please check the docs of the other cache functions as well (GetDeformCache, CheckCache).

    cheers,
    Matthias



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

    On 02/10/2011 at 08:32, xxxxxxxx wrote:

    @Matthias: GetCache() returns 'None' while rendering, here. Is this what it's supposed to be ?
    (Btw, is it an error that this topic appears in Python AND SDK Help forum ?)



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

    On 02/10/2011 at 23:22, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Originally posted by xxxxxxxx

    Originally posted by xxxxxxxx

    You could also use BaseObject.GetCache().

    THIS!!! so helpful, returns a polygon representation of almost any object... including cloners!

    Please be very careful using this function. It's not always guaranteed that the caches are build. The only time this is guaranteed is during rendering. Always check if the returned cache is valid. Please check the docs of the other cache functions as well (GetDeformCache, CheckCache).

    cheers,
    Matthias

    [/QUOTE]

    i tend to find that simply checking what your object is before your get the cache can be useful too. if its not he specific object you are looking for... than no cache is built. generally speaking GetRad() can be useful as well, when you don't need all the polygons and just need to approximate the object's size.


Log in to reply