On 02/05/2015 at 13:01, xxxxxxxx wrote:
Is there any way to perform a Bridge command in code?
I have two meshes. I can easily select the polygons I want to connect.
But, how can I define the point of mesh #1 that should connect to a point in mesh #2 ?
On 03/05/2015 at 04:32, xxxxxxxx wrote:
It is stated in the SDK to look into the toolbridge.h file to check out the parameters.
This toolbridge.h file contains this:
MDATA_BRIDGE_ELEMENT1 =1100, //LONG
MDATA_BRIDGE_ELEMENT2 =1101, //LONG
MDATA_BRIDGE_ELEMENT3 =1102, //LONG
MDATA_BRIDGE_ELEMENT4 =1103, //LONG
MDATA_BRIDGE_OBJINDEX1 =1104, //LONG
MDATA_BRIDGE_OBJINDEX2 =1105, //LONG
MDATA_BRIDGE_OBJINDEX3 =1106, //LONG
MDATA_BRIDGE_OBJINDEX4 =1107, //LONG
MDATA_BRIDGE_DELETE =1108, //BOOL
MDATA_BRIDGE_ISO =1109, //BOOL
I know what the MDATA_BRIDGE_DELETE is but what exactly are those:
On 04/05/2015 at 00:22, xxxxxxxx wrote:
the exact use the Bridge tool depends on what exactly you want to do with it and the context in which it is used (point, poly mode etc.)
So if you want to create a bridge between the selected polygons of two polygon objects the code could look like this:
settings = c4d.BaseContainer()
# polygon objects
settings[c4d.MDATA_BRIDGE_OBJINDEX1] = poly1
settings[c4d.MDATA_BRIDGE_OBJINDEX2] = poly2
# the selected polygons
settings[c4d.MDATA_BRIDGE_ELEMENT1] = 1
settings[c4d.MDATA_BRIDGE_ELEMENT2] = 3
# point indices to define the first edge
settings[c4d.MDATA_BRIDGE_ELEMENT3] = 4
settings[c4d.MDATA_BRIDGE_ELEMENT4] = 6
commandid = c4d.ID_MODELING_BRIDGE_TOOL
objdoc = doc
flags = c4d.MODELINGCOMMANDFLAGS_CREATEUNDO
mode = c4d.MODELINGCOMMANDMODE_POLYGONSELECTION
c4d.utils.SendModelingCommand(command=commandid, list=[poly1,poly2], doc=objdoc, flags=flags, bc = settings, mode=mode)
On 04/05/2015 at 01:29, xxxxxxxx wrote:
That is exactly what I was needing, Sebastian. Thank you.
I will try it as soon as I get home.
By the way, what is the MDATA_BRIDGE_ISO for?
p.s. The SDK would benefit from some additional information about some commands. Just sending the reader to .h file is not enough.
On 04/05/2015 at 12:10, xxxxxxxx wrote:
Damn, it is not working
Here is my code:
bc[c4d.MDATA_BRIDGE_OBJINDEX1] = the_trunk
bc[c4d.MDATA_BRIDGE_OBJINDEX2] = result
bc[c4d.MDATA_BRIDGE_ELEMENT1] = selection
bc[c4d.MDATA_BRIDGE_ELEMENT2] = polygon_count-1
bc[c4d.MDATA_BRIDGE_ELEMENT3] = idx1[index1]
bc[c4d.MDATA_BRIDGE_ELEMENT4] = idx2[index2]
bc[c4d.MDATA_BRIDGE_DELETE] = True
What could I be doing wrong?
On 06/05/2015 at 05:57, xxxxxxxx wrote:
I finally managed to make it work (sort of), by using IsolateObjects to create a new document where I perform the Bridge command.
Now I have a new problem, but I will create a new post for it.