本文整理汇总了C#中PortId类的典型用法代码示例。如果您正苦于以下问题:C# PortId类的具体用法?C# PortId怎么用?C# PortId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PortId类属于命名空间,在下文中一共展示了PortId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migrationData = new NodeMigrationData(data.Document);
// Create DSFunction node
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
"Autodesk.DesignScript.Geometry.Solid.BySweep",
"[email protected]" +
"Autodesk.DesignScript.Geometry.Curve,Autodesk.DesignScript.Geometry.Curve");
migrationData.AppendNode(newNode);
string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);
// Update connectors
PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
PortId oldInPort3 = new PortId(newNodeId, 3, PortType.Input);
PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);
PortId newInPort1 = new PortId(newNodeId, 1, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
XmlElement connector3 = data.FindFirstConnector(oldInPort3);
data.RemoveFirstConnector(oldInPort1);
//connector1.RemoveAll();
data.ReconnectToPort(connector0, newInPort1);
data.ReconnectToPort(connector3, newInPort0);
return migrationData;
}
示例2: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migratedData = new NodeMigrationData(data.Document);
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);
//create the node itself
XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll",
"FamilyInstance.ByPointAndLevel",
"[email protected],Point,Level");
migratedData.AppendNode(dsRevitNode);
string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);
//create and reconnect the connecters
PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
XmlElement connector1 = data.FindFirstConnector(oldInPort1);
PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
XmlElement connector2 = data.FindFirstConnector(oldInPort2);
PortId newInPort0 = new PortId(dsRevitNodeId, 0, PortType.Input);
PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.Input);
PortId newInPort2 = new PortId(dsRevitNodeId, 2, PortType.Input);
data.ReconnectToPort(connector0, newInPort1);
data.ReconnectToPort(connector1, newInPort0);
data.ReconnectToPort(connector2, newInPort2);
return migratedData;
}
示例3: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migrationData = new NodeMigrationData(data.Document);
// Create DSFunction node
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
"Geometry.Transform", "[email protected],CoordinateSystem");
migrationData.AppendNode(newNode);
string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);
// Create new node
XmlElement identityCoordinateSystem = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 0, "ProtoGeometry.dll",
"CoordinateSystem.Identity",
"CoordinateSystem.Identity");
migrationData.AppendNode(identityCoordinateSystem);
// Update connectors
PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
PortId newInPort2 = new PortId(newNodeId, 2, PortType.Input);
XmlElement connector1 = data.FindFirstConnector(oldInPort1);
data.ReconnectToPort(connector1, newInPort2);
data.CreateConnector(identityCoordinateSystem, 0, newNode, 1);
return migrationData;
}
示例4: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migrationData = new NodeMigrationData(data.Document);
// Create DSFunction node
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
"Plane.ByOriginNormal", "[email protected],Vector");
migrationData.AppendNode(newNode);
string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);
//append asVector Node
XmlElement pointAsVector0 = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 1, "ProtoGeometry.dll",
"Point.AsVector", "Point.AsVector");
migrationData.AppendNode(pointAsVector0);
string pointAsVector0Id = MigrationManager.GetGuidFromXmlElement(pointAsVector0);
// Update connectors
PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
PortId pToV = new PortId(pointAsVector0Id, 0, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
XmlElement connector1 = data.FindFirstConnector(oldInPort1);
data.ReconnectToPort(connector0, pToV);
data.ReconnectToPort(connector1, oldInPort0);
data.CreateConnector(pointAsVector0, 0, newNode, 1);
return migrationData;
}
示例5: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migrationData = new NodeMigrationData(data.Document);
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);
// Create nodes
XmlElement referencePoint = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(referencePoint,
"RevitNodes.dll", "ReferencePoint.ByPoint",
"[email protected]");
migrationData.AppendNode(referencePoint);
string referencePointId = MigrationManager.GetGuidFromXmlElement(referencePoint);
XmlElement pointAtParameter = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 0, "ProtoGeometry.dll",
"Surface.PointAtParameter", "[email protected],double");
migrationData.AppendNode(pointAtParameter);
string pointAtParameterId = MigrationManager.GetGuidFromXmlElement(pointAtParameter);
XmlElement uvU = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 1, "ProtoGeometry.dll", "UV.U", "UV.U");
migrationData.AppendNode(uvU);
string uvUId = MigrationManager.GetGuidFromXmlElement(uvU);
XmlElement uvV = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 2, "ProtoGeometry.dll", "UV.V", "UV.V");
migrationData.AppendNode(uvV);
string uvVId = MigrationManager.GetGuidFromXmlElement(uvV);
// Update connectors
PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
PortId papInPort0 = new PortId(pointAtParameterId, 0, PortType.Input);
PortId uvUInPort0 = new PortId(uvUId, 0, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
XmlElement connector1 = data.FindFirstConnector(oldInPort1);
XmlElement connectorUv = null;
if (connector1 != null)
{
connectorUv = MigrationManager.CreateFunctionNodeFrom(connector1);
data.CreateConnector(connectorUv);
}
if (connectorUv != null)
{
PortId uvVInPort0 = new PortId(uvVId, 0, PortType.Input);
data.ReconnectToPort(connectorUv, uvVInPort0);
}
data.ReconnectToPort(connector0, papInPort0);
data.ReconnectToPort(connector1, uvUInPort0);
data.CreateConnector(uvU, 0, pointAtParameter, 1);
data.CreateConnector(uvV, 0, pointAtParameter, 2);
data.CreateConnector(pointAtParameter, 0, referencePoint, 0);
return migrationData;
}
示例6: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
// This migration assumes that the first input of the old node is
// always an XYZ and never a Transform.
NodeMigrationData migrationData = new NodeMigrationData(data.Document);
// Create DSFunction node
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);
var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
"Arc.ByCenterPointRadiusAngle", "[email protected],double,double,double,Vector");
migrationData.AppendNode(newNode);
string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);
// Create new nodes
XmlElement zAxisNode = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 0, "ProtoGeometry.dll", "Vector.ZAxis", "Vector.ZAxis");
migrationData.AppendNode(zAxisNode);
string zAxisNodeId = MigrationManager.GetGuidFromXmlElement(zAxisNode);
XmlElement toDegreeNodeStart = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 1, "DSCoreNodes.dll",
"Math.RadiansToDegrees", "[email protected]");
migrationData.AppendNode(toDegreeNodeStart);
string toDegreeNodeStartId = MigrationManager.GetGuidFromXmlElement(toDegreeNodeStart);
XmlElement toDegreeNodeEnd = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 2, "DSCoreNodes.dll",
"Math.RadiansToDegrees", "[email protected]");
migrationData.AppendNode(toDegreeNodeEnd);
string toDegreeNodeEndId = MigrationManager.GetGuidFromXmlElement(toDegreeNodeEnd);
PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
XmlElement connector2 = data.FindFirstConnector(oldInPort2);
PortId oldInPort3 = new PortId(oldNodeId, 3, PortType.Input);
XmlElement connector3 = data.FindFirstConnector(oldInPort3);
PortId toDegreeNodeStartPort = new PortId(toDegreeNodeStartId, 0, PortType.Input);
PortId toDegreeNodeEndPort = new PortId(toDegreeNodeEndId, 0, PortType.Input);
// Update connectors
data.ReconnectToPort(connector2, toDegreeNodeStartPort);
data.ReconnectToPort(connector3, toDegreeNodeEndPort);
data.CreateConnector(toDegreeNodeStart, 0, newNode, 2);
data.CreateConnector(toDegreeNodeEnd, 0, newNode, 3);
data.CreateConnector(zAxisNode, 0, newNode, 4);
return migrationData;
}
示例7: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migratedData = new NodeMigrationData(data.Document);
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);
//create the node itself
XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll",
"FaceAnalysisDisplay.ByViewFacePointsAndValues",
"[email protected],FaceReference,double[][],double[]");
migratedData.AppendNode(dsRevitNode);
string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);
XmlElement documentNode = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 0, "RevitNodes.dll",
"Document.Current", "Document.Current");
migratedData.AppendNode(documentNode);
XmlElement activeViewNode = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 1, "RevitNodes.dll",
"Document.ActiveView", "Document.ActiveView");
migratedData.AppendNode(activeViewNode);
//create and reconnect the connecters
PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
XmlElement connector1 = data.FindFirstConnector(oldInPort1);
PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
PortId oldInPort3 = new PortId(oldNodeId, 3, PortType.Input);
XmlElement connector3 = data.FindFirstConnector(oldInPort3);
PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.Input);
PortId newInPort2 = new PortId(dsRevitNodeId, 2, PortType.Input);
PortId newInPort3 = new PortId(dsRevitNodeId, 3, PortType.Input);
data.ReconnectToPort(connector0, newInPort3);
data.ReconnectToPort(connector1, newInPort2);
data.ReconnectToPort(connector3, newInPort1);
data.RemoveFirstConnector(oldInPort2);
data.CreateConnector(documentNode, 0, activeViewNode, 0);
data.CreateConnector(activeViewNode, 0, dsRevitNode, 0);
return migratedData;
}
示例8: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migrationData = new NodeMigrationData(data.Document);
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);
// Create DSFunction node
XmlElement newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(newNode, "RevitNodes.dll",
"StructuralFraming.ByCurveLevelUpVectorAndType",
"[email protected],Level,Vector,StructuralType,FamilySymbol");
migrationData.AppendNode(newNode);
string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);
// Create new nodes
XmlElement one = MigrationManager.CreateCodeBlockNodeModelNode(
data.Document, oldNode, 0, "1");
migrationData.AppendNode(one);
string oneId = MigrationManager.GetGuidFromXmlElement(one);
XmlElement level = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 1, "RevitNodes.dll",
"Level.ByElevation", "[email protected]");
migrationData.AppendNode(level);
string levelId = MigrationManager.GetGuidFromXmlElement(level);
// Assume that structural framing created by 0.6.3 is always Beam
XmlElement beam = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 2, "RevitNodes.dll",
"StructuralType.Beam", "StructuralType.Beam");
migrationData.AppendNode(beam);
string beamId = MigrationManager.GetGuidFromXmlElement(beam);
// Update connectors
PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
XmlElement connector1 = data.FindFirstConnector(oldInPort1);
PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);
PortId newInPort4 = new PortId(newNodeId, 4, PortType.Input);
data.CreateConnector(one, 0, level, 0);
data.CreateConnector(level, 0, newNode, 1);
data.CreateConnector(beam, 0, newNode, 3);
data.ReconnectToPort(connector0, newInPort4);
data.ReconnectToPort(connector1, newInPort0);
return migrationData;
}
示例9: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
var migrationData = new NodeMigrationData(data.Document);
// Create DSFunction node
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
"Surface.CoordinateSystemAtParameter", "[email protected],double");
migrationData.AppendNode(newNode);
string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);
// Update connectors
PortId facePort = new PortId(newNodeId, 0, PortType.Input);
PortId uvPort = new PortId(newNodeId, 1, PortType.Input);
PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);
XmlElement uvPortConnector = data.FindFirstConnector(uvPort);
XmlElement facePortConnector = data.FindFirstConnector(facePort);
data.ReconnectToPort(facePortConnector, newInPort0);
if (uvPortConnector != null)
{
// Create new nodes only when the old node is connected to a UV node
XmlElement nodeU = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 0, "ProtoGeometry.dll", "UV.U", "UV.U");
migrationData.AppendNode(nodeU);
string nodeUId = MigrationManager.GetGuidFromXmlElement(nodeU);
XmlElement nodeV = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 1, "ProtoGeometry.dll", "UV.V", "UV.V");
migrationData.AppendNode(nodeV);
string nodeVId = MigrationManager.GetGuidFromXmlElement(nodeV);
// Update connectors
PortId newInPortNodeU = new PortId(nodeUId, 0, PortType.Input);
string nodeUVId = uvPortConnector.GetAttribute("start").ToString();
data.ReconnectToPort(uvPortConnector, newInPortNodeU);
data.CreateConnector(nodeU, 0, newNode, 1);
data.CreateConnector(nodeV, 0, newNode, 2);
data.CreateConnectorFromId(nodeUVId, 0, nodeVId, 0);
}
return migrationData;
}
示例10: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migrationData = new NodeMigrationData(data.Document);
// Create DSFunction node
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
"Point.ByCylindricalCoordinates", "[email protected],double,double,double");
migrationData.AppendNode(newNode);
string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);
// Create new node
XmlElement identityCoordinateSystem = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 0, "ProtoGeometry.dll",
"CoordinateSystem.Identity",
"CoordinateSystem.Identity");
migrationData.AppendNode(identityCoordinateSystem);
XmlElement converterNode = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 1, "DSCoreNodes.dll",
"Math.RadiansToDegrees", "[email protected]");
migrationData.AppendNode(converterNode);
string converterNodeId = MigrationManager.GetGuidFromXmlElement(converterNode);
// Update connectors
PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
PortId newInPort3 = new PortId(newNodeId, 3, PortType.Input);
PortId converterInPort = new PortId(converterNodeId, 0, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
XmlElement connector1 = data.FindFirstConnector(oldInPort1);
data.ReconnectToPort(connector0, newInPort3);
data.ReconnectToPort(connector1, converterInPort);
data.CreateConnector(converterNode, 0, newNode, 1);
data.CreateConnector(identityCoordinateSystem, 0, newNode, 0);
// Add default values
foreach (XmlNode child in oldNode.ChildNodes)
newNode.AppendChild(child.Clone());
return migrationData;
}
示例11: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migrationData = new NodeMigrationData(data.Document);
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);
XmlElement codeBlockNode = MigrationManager.CreateCodeBlockNodeModelNode(
data.Document, oldNode, 0,
"domain[0][0]..domain[1][0]..#ucount+1;\n" +
"domain[0][1]..domain[1][1]..#vcount+1;");
migrationData.AppendNode(codeBlockNode);
string codeBlockNodeId = MigrationManager.GetGuidFromXmlElement(codeBlockNode);
XmlElement uvNode = MigrationManager.CreateFunctionNode(data.Document, oldNode, 1,
"ProtoGeometry.dll", "UV.ByCoordinates", "[email protected],double");
uvNode.SetAttribute("lacing", "CrossProduct");
migrationData.AppendNode(uvNode);
XmlElement flattenNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(flattenNode, "",
"Flatten", "Flatten");
flattenNode.SetAttribute("lacing", "Shortest");
migrationData.AppendNode(flattenNode);
// Update connectors
PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
PortId newInPort0 = new PortId(codeBlockNodeId, 0, PortType.Input);
PortId newInPort1 = new PortId(codeBlockNodeId, 1, PortType.Input);
PortId newInPort2 = new PortId(codeBlockNodeId, 2, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
XmlElement connector1 = data.FindFirstConnector(oldInPort1);
XmlElement connector2 = data.FindFirstConnector(oldInPort2);
data.ReconnectToPort(connector0, newInPort0);
data.ReconnectToPort(connector1, newInPort1);
data.ReconnectToPort(connector2, newInPort2);
data.CreateConnector(codeBlockNode, 0, uvNode, 0);
data.CreateConnector(codeBlockNode, 1, uvNode, 1);
data.CreateConnector(uvNode, 0, flattenNode, 0);
return migrationData;
}
示例12: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migratedData = new NodeMigrationData(data.Document);
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);
//create the node itself
XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll",
"AxonometricView.ByEyePointAndTarget",
"[email protected],Point,var,string,bool");
migratedData.AppendNode(dsRevitNode);
string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);
//create and reconnect the connecters
PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
XmlElement connector1 = data.FindFirstConnector(oldInPort1);
PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
XmlElement connector2 = data.FindFirstConnector(oldInPort2);
PortId oldInPort3 = new PortId(oldNodeId, 3, PortType.Input);
XmlElement connector3 = data.FindFirstConnector(oldInPort3);
PortId oldInPort4 = new PortId(oldNodeId, 4, PortType.Input);
XmlElement connector4 = data.FindFirstConnector(oldInPort4);
PortId newInPort0 = new PortId(dsRevitNodeId, 0, PortType.Input);
PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.Input);
PortId newInPort2 = new PortId(dsRevitNodeId, 2, PortType.Input);
PortId newInPort3 = new PortId(dsRevitNodeId, 3, PortType.Input);
PortId newInPort4 = new PortId(dsRevitNodeId, 4, PortType.Input);
data.ReconnectToPort(connector0, newInPort0);
data.ReconnectToPort(connector1, newInPort1);
data.ReconnectToPort(connector2, newInPort3);
data.ReconnectToPort(connector3, newInPort2);
data.ReconnectToPort(connector4, newInPort4);
return migratedData;
}
示例13: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migrationData = new NodeMigrationData(data.Document);
// Create DSFunction node
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
"Line.ByStartPointEndPoint", "[email protected],Point");
migrationData.AppendNode(newNode);
string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);
// Update connectors
PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
XmlElement connector1 = data.FindFirstConnector(oldInPort1);
data.ReconnectToPort(connector1, newInPort0);
if (connector1 != null)
{
// Create new node only when the old node is connected to a normal vector
XmlElement translateNode = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 0, "ProtoGeometry.dll", "Geometry.Translate",
"[email protected]");
migrationData.AppendNode(translateNode);
string translateNodeId = MigrationManager.GetGuidFromXmlElement(translateNode);
// Update connectors
PortId newInPortTranslate1 = new PortId(translateNodeId, 1, PortType.Input);
string nodeOriginId = connector1.GetAttribute("start").ToString();
data.CreateConnector(translateNode, 0, newNode, 1);
data.CreateConnectorFromId(nodeOriginId, 0, translateNodeId, 0);
data.ReconnectToPort(connector0, newInPortTranslate1);
}
return migrationData;
}
示例14: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
NodeMigrationData migrationData = new NodeMigrationData(data.Document);
// Create DSFunction node
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
var converterNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(converterNode, "DSCoreNodes.dll",
"Math.DegreesToRadians", "[email protected]");
migrationData.AppendNode(converterNode);
string converterNodeId = MigrationManager.GetGuidFromXmlElement(converterNode);
// Create new node
XmlElement atanNode = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 0, "DSCoreNodes.dll",
"Math.Atan", "[email protected]");
migrationData.AppendNode(atanNode);
string atanNodeId = MigrationManager.GetGuidFromXmlElement(atanNode);
// Update connectors
PortId oldInPort0 = new PortId(converterNodeId, 0, PortType.Input);
PortId newInPortAtan = new PortId(atanNodeId, 0, PortType.Input);
XmlElement connector0 = data.FindFirstConnector(oldInPort0);
data.ReconnectToPort(connector0, newInPortAtan);
data.CreateConnector(atanNode, 0, converterNode, 0);
return migrationData;
}
示例15: Migrate_0630_to_0700
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
{
var migrationData = new NodeMigrationData(data.Document);
// Create DSFunction node
XmlElement oldNode = data.MigratedNodes.ElementAt(0);
var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
"Geometry.Intersect", "[email protected]");
migrationData.AppendNode(newNode);
string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);
var oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
var connector0 = data.FindFirstConnector(oldInPort0);
var oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
var connector1 = data.FindFirstConnector(oldInPort1);
data.ReconnectToPort(connector0, oldInPort0);
data.ReconnectToPort(connector1, oldInPort1);
// reconnect output port at 1 to 0
var oldXYZOut = new PortId(newNodeId, 1, PortType.Output);
var newXyzOut = new PortId(newNodeId, 0, PortType.Output);
var xyzConnects = data.FindConnectors(oldXYZOut);
if (xyzConnects != null)
{
xyzConnects.ToList().ForEach(x => data.ReconnectToPort(x, newXyzOut));
}
// get u parm
if (connector0 != null)
{
var crvInputNodeId = connector0.Attributes["start"].Value;
var crvInputIndex = int.Parse(connector0.Attributes["start_index"].Value);
// make parm at point node
var parmAtPt = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 0, "ProtoGeometry.dll",
"Curve.ParameterAtPoint",
"[email protected]");
migrationData.AppendNode(parmAtPt);
var parmAtPtId = MigrationManager.GetGuidFromXmlElement(parmAtPt);
// connect output of project to parm at pt
data.CreateConnectorFromId(crvInputNodeId, crvInputIndex, parmAtPtId, 0);
data.CreateConnector(newNode, 0, parmAtPt, 1);
// reconnect remaining output ports to new nodes
var newTOut = new PortId(parmAtPtId, 0, PortType.Output);
var oldTOut = new PortId(newNodeId, 2, PortType.Output);
var oldTConnectors = data.FindConnectors(oldTOut);
oldTConnectors.ToList().ForEach(x => data.ReconnectToPort(x, newTOut));
}
// get v parm
if (connector1 != null)
{
var crvInputNodeId = connector1.Attributes["start"].Value;
var crvInputIndex = int.Parse(connector1.Attributes["start_index"].Value);
// make parm at point node
var parmAtPt = MigrationManager.CreateFunctionNode(
data.Document, oldNode, 0, "ProtoGeometry.dll",
"Curve.ParameterAtPoint",
"[email protected]");
migrationData.AppendNode(parmAtPt);
var parmAtPtId = MigrationManager.GetGuidFromXmlElement(parmAtPt);
// connect output of project to parm at pt
data.CreateConnectorFromId(crvInputNodeId, crvInputIndex, parmAtPtId, 0);
data.CreateConnector(newNode, 0, parmAtPt, 1);
// reconnect remaining output ports to new nodes
var newTOut = new PortId(parmAtPtId, 0, PortType.Output);
var oldTOut = new PortId(newNodeId, 3, PortType.Output);
var oldTConnectors = data.FindConnectors(oldTOut);
oldTConnectors.ToList().ForEach(x => data.ReconnectToPort(x, newTOut));
}
return migrationData;
}