Connecting/glueing shapes in C#

G

Guy..L

I run this code to glue one shape to the next (this is a method from an
extension class for Shape):

public static void Attach(this Shape end, Shape main)
{
short sxn = (short)VisSectionIndices.visSectionConnectionPts;

main.get_CellsU("Connections.End.X").GlueTo(end.get_CellsSRC(sxn, 0, 0));
}

When I report on the connections To and From main I then see that two
connections have been made...

Connects
main visBegin end visConnectionPoint
man visEnd end visConnectionPoint

FromConnects

What gives? I only want to add one connection, specifically in this case
from main!Connections.End to end!Pin.

I've already added Connections.Begin and Connections.End rows to the main
object to point to certain geometry cells in main.

FYI. Here's the code to do that report.

StringBuilder q = new StringBuilder();

q.Append("Connects in " + s.Name + ", " + s.NameU + ", " +
s.NameID);
if (s.Master != null)
q.AppendLine(", Master: " + s.Master.Name);
else
q.AppendLine();

foreach (Connect c in s.Connects)
{
q.Append(c.FromSheet.Name + "\t");
q.Append(Enum.GetName(typeof(VisFromParts), c.FromPart) +
"\t");
q.Append(c.ToSheet.Name + "\t");
q.AppendLine(Enum.GetName(typeof(VisToParts), c.ToPart) + "
(" + c.ToPart.ToString() + ")");
}
q.AppendLine();
q.AppendLine("FromConnects in " + s.Name);
foreach (Connect c in s.FromConnects)
{
q.Append(c.FromSheet.Name + "\t");
q.Append(Enum.GetName(typeof(VisFromParts), c.FromPart) +
"\t");
q.Append(c.ToSheet.Name + "\t");
q.AppendLine(Enum.GetName(typeof(VisToParts), c.ToPart) + "
(" + c.ToPart.ToString() + ")");
}
return q.ToString();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top