Join command result offset



  • Hello,

    I've received a problem from a user with an object that our modifier is not translating correctly. What's unique about this setup is that contains "a spline wrap using an external spline to modify a sweep's input spline". Sounds ugly, better to open the attached project. The object we need to cache is Reep, and somewhere inside it there's the Reep-Wrap-03 modifier ( a Spline Wrap). It's strength is 100%, and it cancels out the generator's transform. Any translation and rotation have no effect on the final polygon.

    I'using the MCOMMAND_JOIN modeling command to get a copy of Reep of an object for later processing but the resulting polygon is always offset by the original generator's current transform. If I execute the Make Editable or Current State To Object commands on it, the result is correct, but not using the Join command.

    As an example, I'm using this script in Python that gives me the same result as the C++ API. Running it the joined polygon will be offset from the original generator cache. The same script using MCOMMAND_CURRENTSTATETOOBJECT does not generate the offset.

    import c4d
    
    def main() :
        olist = [ doc.SearchObject("Reep") ]
        settings = c4d.BaseContainer()
        res = c4d.utils.SendModelingCommand(command = c4d.MCOMMAND_JOIN, list = olist,  bc = settings, doc = doc)                      
        doc.InsertObject(res[0].GetClone())    
        c4d.EventAdd()
        
    if __name__=='__main__':
        main()
    

    Is there anything I can do to get the same result from the JOIN command, without that offset?

    Ediatble_isolated.c4d



  • Hi @rsodre thanks for contacting us, I will inform development team. However, there is no workaround for that except either offset back the point or offset the whole object. Note that in R21 the behavior changed and now points are in the correct world location (it actually resets the position of the axis) but the axis of the generated object is not into the same world pos.

    So here the workaround with the axis offset that will end with the same behavior from R20 and R21 and where points are in the correct World Position but not the axis.

    import c4d
    
    def main() :
        sweep = doc.SearchObject("Reep")
        
        olist = [sweep]
        settings = c4d.BaseContainer()
        res = c4d.utils.SendModelingCommand(command = c4d.MCOMMAND_JOIN, list = olist,  bc = settings, doc = doc)
        
        if c4d.GetC4DVersion() < 21000:
            res[0].SetAbsPos(c4d.Vector())
            
        doc.InsertObject(res[0].GetClone())
        c4d.EventAdd()
        
    if __name__=='__main__':
        main()
    

    just FYI, I'm still investigating the issue anyway is there a reason to not use MCOMMAND_CURRENTSTATETOOBJECT?

    Cheers,
    Maxime.



  • @m_adam Hi Maxime,

    Thanks for this workaround, indeed puts the polygon on the right place.

    Best,
    roger


Log in to reply