public override LinearElementCollection EnterLinearElements(string prompt = "Enter linear elements") { GetObject gO = new GetObject(); gO.SetCustomGeometryFilter(new GetObjectGeometryFilter(FilterHandles)); gO.GeometryFilter = ObjectType.Curve; gO.SetCommandPrompt(prompt); if (gO.GetMultiple(1, 0) == GetResult.Cancel) { throw new OperationCanceledException("Operation cancelled by user"); } var result = new LinearElementCollection(); foreach (ObjRef rObj in gO.Objects()) { if (Host.Instance.Handles.Links.ContainsSecond(rObj.ObjectId)) { Guid guid = Host.Instance.Handles.Links.GetFirst(rObj.ObjectId); Element element = Core.Instance.ActiveDocument?.Model?.Elements[guid]; if (element != null && element is LinearElement) { result.Add((LinearElement)element); } } } return(result); }
public override bool Execute(ExecutionInfo exInfo = null) { Beams = new LinearElementCollection(); VertexCollection verts = new VertexCollection(SupportPoints); MeshFaceCollection faces = Mesh.DelaunayTriangulationXY(verts); if (Perimeter != null) { faces.CullOutsideXY(Perimeter); } faces.Quadrangulate(); IList <MeshEdge> edges = faces.ExtractUniqueEdges(); foreach (MeshEdge mE in edges) { LinearElement lEl = Model.Create.LinearElement(mE.ToLine(), exInfo); lEl.Family = BeamSection; Beams.Add(lEl); } PanelBoundaries = faces.ExtractFaceBoundaries(); return(true); }
public override bool Execute(ExecutionInfo exInfo = null) { TopChordElements = new LinearElementCollection(); BottomChordElements = new LinearElementCollection(); PostElements = new LinearElementCollection(); BracingElements = new LinearElementCollection(); if (TopChord != null && BottomChord != null) { int divisions; double maxLength = Math.Max(TopChord.Length, BottomChord.Length); if (NodeSpacing <= 0 || maxLength / NodeSpacing > 1000) { //Auto-determine appropriate node spacing Vector[] samplePointsT = TopChord.Divide(4); Vector[] samplePointsB = BottomChord.Divide(4); double tDist = 0; for (int i = 0; i < 5; i++) { tDist += samplePointsB[i].DistanceTo(samplePointsT[i]); } tDist /= 5; divisions = (int)(maxLength / tDist).Round(2); } else { divisions = (int)Math.Ceiling(maxLength / NodeSpacing); } if (divisions > 0) { Vector[] topPts = TopChord.Divide(divisions); Vector[] bottomPts = BottomChord.Divide(divisions); //foreach (Vector v in topPts) TopChordNodes.Add(Model.Create.Node(v, 0, exInfo)); //foreach (Vector v in bottomPts) BottomChordNodes.Add(Model.Create.Node(v, 0, exInfo)); for (int i = 0; i < topPts.Length - 1; i++) { //Node tNode0 = TopChordNodes[i]; //Node tNode1 = TopChordNodes[i + 1]; //Node bNode0 = BottomChordNodes[i]; //Node bNode1 = BottomChordNodes[i + 1]; Vector tNode0 = topPts[i]; Vector tNode1 = topPts[i + 1]; Vector bNode0 = bottomPts[i]; Vector bNode1 = bottomPts[i + 1]; TopChordElements.Add(Model.Create.LinearElement(tNode0, tNode1, ChordSection, exInfo)); BottomChordElements.Add(Model.Create.LinearElement(bNode0, bNode1, ChordSection, exInfo)); if (i > 0) { PostElements.Add(Model.Create.LinearElement(tNode0, bNode0, PostSection, exInfo)); } if (i < topPts.Length / 2) { BracingElements.Add(Model.Create.LinearElement(tNode0, bNode1, BracingSection, exInfo)); } else { BracingElements.Add(Model.Create.LinearElement(bNode0, tNode1, BracingSection, exInfo)); } } TopChordElements.GenerateNodes(new NodeGenerationParameters()); BottomChordElements.GenerateNodes(new NodeGenerationParameters()); PostElements.GenerateNodes(new NodeGenerationParameters()); BracingElements.GenerateNodes(new NodeGenerationParameters()); TopChordNodes = TopChordElements.GetNodes(); BottomChordNodes = BottomChordElements.GetNodes(); TopChordNodes.ClearAttachedData(); BottomChordNodes.ClearAttachedData(); } } return(true); }
public override bool Execute(ExecutionInfo exInfo = null) { Columns = new LinearElementCollection(); PrimaryBeams = new LinearElementCollection(); SecondaryBeams = new LinearElementCollection(); int sCount = 0; if (SecondarySpacing > 0) { sCount = (int)Math.Ceiling(XSpacing / SecondarySpacing); } double z = FirstStoreyHeight; double zLast = 0; for (int i = 1; i <= StoreyCount; i++) { for (int j = 0; j < XCount; j++) { for (int k = 0; k < YCount; k++) { Vector pt00 = SetOut.LocalToGlobal((j - 1) * XSpacing, (k - 1) * YSpacing, z); Vector pt10 = SetOut.LocalToGlobal(j * XSpacing, (k - 1) * YSpacing, z); Vector pt01 = SetOut.LocalToGlobal((j - 1) * XSpacing, k * YSpacing, z); Vector pt11 = SetOut.LocalToGlobal(j * XSpacing, k * YSpacing, z); // Column: Columns.Add(Model.Create.LinearElement(pt11.WithZ(zLast), pt11, ColumnSection, exInfo)); if (j > 0) { // Primary beams: PrimaryBeams.Add(Model.Create.LinearElement(pt01, pt11, PrimaryBeamSection, exInfo)); } if (k > 0) { // Secondary beams: SecondaryBeams.Add(Model.Create.LinearElement(pt10, pt11, SecondaryBeamSection, exInfo)); if (j > 0 && sCount > 1) { for (int s = 1; s < sCount; s++) { SecondaryBeams.Add(Model.Create.LinearElement( pt00.Interpolate(pt10, ((double)s) / sCount), pt01.Interpolate(pt11, ((double)s) / sCount), SecondaryBeamSection, exInfo)); } } } //TODO: Intermediate secondaries } } zLast = z; z += StoreyHeight; } Columns.GenerateNodes(new NodeGenerationParameters()); PrimaryBeams.GenerateNodes(new NodeGenerationParameters()); SecondaryBeams.GenerateNodes(new NodeGenerationParameters()); return(true); }