Join command result offset
rsodre last edited by rsodre
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.
MCOMMAND_JOINmodeling 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_CURRENTSTATETOOBJECTdoes 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.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?
m_adam last edited by m_adam
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.SetAbsPos(c4d.Vector()) doc.InsertObject(res.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?
rsodre last edited by
@m_adam Hi Maxime,
Thanks for this workaround, indeed puts the polygon on the right place.