Emily
2021.05.01
鋼構設計流程自動化
ref:
https://bit.ly/3e58D9I; https://bit.ly/3gTVIJt; https://bit.ly/3aUQglT
結構分析
BIM 整合
接頭檢核
鋼構設計流程自動化
結構分析
BIM 整合
接頭檢核
software1
software2
...
software_A
software_B
software_C
...
software_x
software_y
software_z
...
ref:
https://bit.ly/3e58D9I; https://bit.ly/3gTVIJt; https://bit.ly/3aUQglT;
鋼構設計流程自動化
結構分析軟體
BIM 整合軟體
鋼接頭檢核軟體
Data Standardlization
Via API
ref:
https://bit.ly/3e58D9I; https://bit.ly/3gTVIJt; https://bit.ly/3aUQglT
應用橋接模式(Bridge pattern),讓系統架構可抽換不同的軟體,主流程不與特定軟體耦合。
應用橋接模式(Bridge pattern),讓系統架構可抽換不同的軟體做整合,主流程不與特定軟體耦合。
應用橋接模式(Bridge pattern),讓系統架構可抽換不同的軟體做整合,主流程不與特定軟體耦合。
public class StructualAnlysisDataLayer : DataLayer
{
private StrucatualAnalysisConnector _connector;
public StructualAnlysisDataLayer(StrucatualAnalysisConnector connector)
{
_connector = connector;
}
public List<DesignGroup> GetDesignGroup()
{
return _connector.GetDesignGroup();
}
public List<SteelFrame> GetSteelFrameGroup(bool confirmSlopeBeam = false)
{
return _connector.GetSteelFrames(confirmSlopeBeam);
}
}public class StructualAnlysisDataLayer : DataLayer
{
private StrucatualAnalysisConnector _connector;
public StructualAnlysisDataLayer(StrucatualAnalysisConnector connector)
{
_connector = connector;
}
public List<DesignGroup> GetDesignGroup()
{
return _connector.GetDesignGroup();
}
public List<SteelFrame> GetSteelFrameGroup(bool confirmSlopeBeam = false)
{
return _connector.GetSteelFrames(confirmSlopeBeam);
}
}using SpecificSoftwareAPI;
using DAL;
public class StaadproConnector : StrucatualAnalysisConnector
{
// Identified some properties
public override List<DesignGroup> GetDesignGroup()
{
// implementied via software api
// ....
return groups;
}
public override List<SteelFrame> GetSteelFrames(bool configuration)
{
// implementied via software api
// ....
return steelFrames;
}
public override void SetLoadInfo()
{
// implementied via software api
// ....
}
}
}
using XXXWrapper;
using XXXXXWrapper;
using DAL;
static class Program
{
static void Main()
{
StrucatualAnalysisConnector AnalysisConnector = new StaadproConnector();
StructualAnlysisDataLayer AnalysisDataLayer = new StructualAnlysisDataLayer(AnalysisConnector);
List<Member> members = AnalysisDataLayer.GetSteelFrameGroup();
ConnectionDesignConnector teklaConnector = new TeklaConnector();
ConnectionDesignDataLayer = new ConnectionDesignDataLayer(teklaConnector);
ConnectionDesignDataLayer.CreateMember(members);
}
}
static void Main()
{
StrucatualAnalysisConnector AnalysisConnector = new StaadproConnector();
StructualAnlysisDataLayer AnalysisDataLayer = new StructualAnlysisDataLayer(AnalysisConnector);
List<Member> members = AnalysisDataLayer.GetSteelFrameGroup();
ConnectionDesignConnector teklaConnector = new TeklaConnector();
ConnectionDesignDataLayer = new ConnectionDesignDataLayer(teklaConnector);
ConnectionDesignDataLayer.CreateMember(members);
}
| Intersect |
|---|
| - position(X,Y,Z) - Members |
BCFJoints
CBVBJoints
.
.
.
VXRJoints
Input
Intersects
JointType
Output
| Concrete Visitor 1 | Concrete Visitor 2 | |
| Concrete Element A | ||
| Concrete Element B |
| BCFVisitor | BCWVisitor | CBVBVisitor | .... | ||
| Intersect | .... |
public class Intersect
{
public Node position { get; set; }
public List<Member> memberGroup { get; set; }
public void Accept(Visitor visitor)
{
visitor.Identify(this);
}
}public abstract class Visitor
{
protected List<Joint> Joints = new List<Joint>();
public Visitor() { }
public abstract void Identify(Intersect intersect);
public virtual List<Joint> GetJoints()
{
return Joints;
}
public virtual List<Joint> GetJoints(Intersect intersect)
{
this.Identify(intersect);
return Joints;
}
}public class BCWVisitor:Visitor
{
// ...
public override void Identify(Intersect intersect)
{
// get the properties of intersect to implement each BCWJoint
// ....
// add the result to Joints inheriated from base class
Joints.Add(...);
}
}public class VXRVisitor:Visitor
{
// ...
public override void Identify(Intersect intersect)
{
// get the properties of intersect to implement each VXRJoint
// ....
// add the result to Joints inheriated from base class
Joints.Add(...);
}
}public override List<Joint> GetJoints(string group, Visitor visitor)
{
List<Member> steelFrames = BeamApp.GetSteelFramesByGroup(group);
JointService jointService = new JointService(steelFrames);
List<Intersect> intersects = jointService.GetIntersects();
foreach(Intersect intersect in intersects)
{
intersect.Accept(visitor);
}
return visitor.GetJoints();
}將宣告一個物件類型這樣的操作封裝到Factory class中,就可以在執行期動態決定要new 哪個class
Myclass myclass = new Myclass();public class JointVisitorFactory
{
public Visitor CreateVisitor(ConnectionBase connection)
{
switch (connection.ConnectionJoint.JointType)
{
case Model.Connection.Joint.JointType.BCF:
return new BCFVisitor();
case Model.Connection.Joint.JointType.BCW:
return new BCWVisitor();
case Model.Connection.Joint.JointType.BG:
return new BGVisitor();
case Model.Connection.Joint.JointType.BS:
return new BSVisitor();
default:
return null;
}
}
}public class ConnectionFactory
{
public ConnectionBase Create(JointType jointType, string name)
{
var type = Type.GetType(
"DAL.Model.ConnectionByJoint" +
"." + jointType.ToString() +
"Connection", throwOnError: false);
if (type == null)
{
throw new InvalidOperationException(
jointType.ToString() + "is not a known joint type");
}
if (!typeof(ConnectionBase).IsAssignableFrom(type))
{
throw new InvalidOperationException(
type.Name +
"does not inferit from abstract connectionbase class");
}
Object[] args = { name, jointType };
return (ConnectionBase)Activator.CreateInstance(type, args);
}
}Reference: