On 25/05/2017 at 11:41, xxxxxxxx wrote:
Hi DayDreamer, thanks for writing us and welcome to our community.
With reference to your question on how to use the ID_MODELING_WELD_TOOL via SendModellingCommand, I first recommend you to give a look at SendModelingCommand() in the Python API in order to understand how to properly format the SendModellingCommand call.
The Weld command in Cinema is supposed to operate with points or edges or polygons previously selected on an editable mesh to collapse the points inferred by the selected entities on a specific location. So far in order to have the SendModelingCommand delivering the expected action you have at least have an editable mesh with two points selected (or an edge or a polygon).
That said, let's see how the different (and relevant) options change the final welding behaviour
- MDATA_WELD_TOPOINT : if set to True the welding operation weld all the selected entities on the point specified in MDATA_WELD_POINT or on the point referred by the MDATA_WELD_POINTINDEX
- MDATA_WELD_POINT : the position where all the entities will be welded if MDATA_WELD_TOPOINT is True
- MDATA_WELD_POINTINDEX : the index of the point (in the PolygonObject) where all the selected entities will be welded on if MDATA_WELD_TOPOINT is True
Suppose you have a simple plane made up of for quads (numbers are representing the points indexes)
1-----5-----2
| | |
4-----8-----6
| | |
0-----7-----3
To weld points 0 and 7 (they are selected before running the script) on point 4:
...
# Create the BaseContainer to define the tool settings
settings = c4d.BaseContainer()
# Specify the settings
settings[c4d.MDATA_WELD_TOPOINT] = True
settings[c4d.MDATA_WELD_POINTINDEX] = 4
settings[c4d.MDATA_WELD_OBJECTINDEX] = op
# Execute the SendModelingCommand
res = utils.SendModelingCommand(command = c4d.ID_MODELING_WELD_TOOL,
list = [op],
mode = c4d.MODELINGCOMMANDMODE_POINTSELECTION,
bc = settings,
doc = doc)
# Update the scene
c4d.EventAdd()
...
To weld instead the bottom/right polygon (the polygon is selected before running the script) on point (0,100,-100) :
...
# Create the BaseContainer to define the tool settings
settings = c4d.BaseContainer()
# Specify the settings
settings[c4d.MDATA_WELD_POINT] = c4d.Vector(0,100,-100)
settings[c4d.MDATA_WELD_TOPOINT] = True
# Execute the SendModelingCommand
res = utils.SendModelingCommand(command = c4d.ID_MODELING_WELD_TOOL,
list = [op],
mode = c4d.MODELINGCOMMANDMODE_POLYGONSELECTION,
bc = settings,
doc = doc)
# Update the scene
c4d.EventAdd()
...
Finally to weld the two points connecting the edge formed by point 4 & 8 (the edge is selected before running the script) on their middle point:
...
# Create the BaseContainer to define the tool settings
settings = c4d.BaseContainer() #nothing needs to be set since by default middle point is considered
# Execute the SendModelingCommand
res = utils.SendModelingCommand(command = c4d.ID_MODELING_WELD_TOOL,
list = [op],
mode = c4d.MODELINGCOMMANDMODE_EDGESELECTION,
bc = settings,
doc = doc)
# Update the scene
c4d.EventAdd()
....
I hope this few notes could help you to understand a bit more on how the welding tool can be used and i leave to you diving deeper mixing options and primitives.
Best, Riccardo