Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/06_question.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ labels: "type:question"
<!-- IN PARTICULAR PLEASE ENSURE THAT SENSITIVE OR INAPPROPRIATE INFORMATION IS NOT UPLOADED -->


<!-- If you would like to ask a question on Slack you can find a link and open invite on https://bhom.xyz -->
<!-- If you would like to ask a question on Slack you can find a link and open invite on https://bhom.xyz -->
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Closes #


### Additional comments
<!-- As required -->
<!-- As required -->
20 changes: 10 additions & 10 deletions PowershellScript.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using namespace System.IO
using namespace System.Collections.Generic

$softwareName = Read-Host "Please enter the software name."
$RFEM6 = Read-Host "Please enter the software name."

# Replace occurrences of "SoftwareName" in all files
# Replace occurrences of "RFEM6" in all files
Get-ChildItem -File -Recurse | ForEach-Object {
try {
(Get-Content $_.FullName) -replace 'SoftwareName', $softwareName | Set-Content $_.FullName
(Get-Content $_.FullName) -replace 'RFEM6', $RFEM6 | Set-Content $_.FullName
}
catch {}
}
Expand All @@ -16,11 +16,11 @@ $stack = [Stack[string]]::new()
$allPaths = [List[string]]::new()


# Get all files and directories containing "SoftwareName" recursively
# Get all files and directories containing "RFEM6" recursively
Get-ChildItem -Recurse -Directory | ForEach-Object {
$dirpath = $_.FullName
$dirname = Split-Path $dirpath -Leaf
if ($dirname.Contains("SoftwareName"))
if ($dirname.Contains("RFEM6"))
{
Write-Host "dirpath: " $dirpath
$stack.Push($dirpath)
Expand All @@ -32,7 +32,7 @@ Get-ChildItem -Recurse -Directory | ForEach-Object {
foreach ($file in [Directory]::EnumerateFiles($dirpath))
{
$filename = [Path]::GetFileName($file)
if ($filename.Contains('SoftwareName') -and -not $allPaths.Contains($file))
if ($filename.Contains('RFEM6') -and -not $allPaths.Contains($file))
{
Write-Host "filepath: " $file
$stack.Push($file)
Expand All @@ -43,7 +43,7 @@ Get-ChildItem -Recurse -Directory | ForEach-Object {

# Add root files
Get-ChildItem -File | ForEach-Object {
if ($_.FullName.Contains("SoftwareName")) {
if ($_.FullName.Contains("RFEM6")) {
Write-Host "filepath: " $_.FullName
$stack.Push($_.FullName)
}
Expand All @@ -56,12 +56,12 @@ while ($stack.Count) {

$filename = [Path]::GetFileName($poppedFullName)

if($filename.Contains('SoftwareName') -and $pathExists)
if($filename.Contains('RFEM6') -and $pathExists)
{
$newName = $filename.Replace('SoftwareName', $softwareName)
$newName = $filename.Replace('RFEM6', $RFEM6)

Write-Host "Renaming: " $poppedFullName " to: " $newName

Rename-Item -LiteralPath $poppedFullName -NewName $newName #-WhatIf
}
}
}
41 changes: 41 additions & 0 deletions RFEM6_Adapter/CRUD/Create/Node.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using BH.oM.Adapter;
using BH.oM.Structure.Elements;

using rfModel = Dlubal.WS.Rfem6.Model;

namespace BH.Adapter.RFEM6
{
public partial class RFEM6Adapter
{
private bool CreateCollection(IEnumerable<Node> bhNodes)
{

//NOTE:A geometric object has, in general, a parent_no = 0. The parent_no parameter becomes significant for example with loads.
int nodeId = model.get_first_free_number(rfModel.object_types.E_OBJECT_TYPE_NODE, 0);

for(int i = 0; i < bhNodes.Count(); i++)
{
Node bhNode = bhNodes.ToList()[i];

rfModel.node rfNode = new rfModel.node()
{
no = nodeId+i,
coordinates = new rfModel.vector_3d() { x = bhNode.Position.X, y = bhNode.Position.Y, z = bhNode.Position.Z },
coordinate_system_type = rfModel.node_coordinate_system_type.COORDINATE_SYSTEM_CARTESIAN,
coordinate_system_typeSpecified = true,
comment = "concrete part"
};
model.set_node(rfNode);

}


return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2022, the respective contributors. All rights reserved.
*
Expand Down Expand Up @@ -28,9 +28,9 @@
using System.Text;
using System.Threading.Tasks;

namespace BH.Adapter.SoftwareName
namespace BH.Adapter.RFEM6
{
public partial class SoftwareNameAdapter : BHoMAdapter
public partial class RFEM6Adapter : BHoMAdapter
{
// NOTE: CRUD folder methods
// All methods in the CRUD folder are used as "back-end" methods by the Adapter itself.
Expand All @@ -48,9 +48,23 @@ protected override bool ICreate<T>(IEnumerable<T> objects, ActionConfig actionCo
// In other words:
foreach (T obj in objects)
{
success &= Create(obj as dynamic);
}
//success &= Create(obj as dynamic);
if (objects.Count() > 0)
{
//AppLock();
try
{
model.begin_modification("Geometry");
success = CreateCollection(objects as dynamic); //Calls the correct CreateCollection method based on dynamic casting
}
finally
{
//AppUnlock();
model.finish_modification();
}

}
}
// Then place the specific Create methods below this method or, better, in separate file for each object type.
return success;
}
Expand All @@ -70,7 +84,7 @@ protected override bool ICreate<T>(IEnumerable<T> objects, ActionConfig actionCo
// Fallback case. If no specific Create is found, here we should handle what happens then.
protected bool Create(IBHoMObject obj)
{
BH.Engine.Base.Compute.RecordError("No specific Create method found for {obj.GetType().Name}.");
BH.Engine.Base.Compute.RecordError("No specific Create method found for" + obj.GetType().Name);
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2022, the respective contributors. All rights reserved.
*
Expand Down Expand Up @@ -27,9 +27,9 @@
using System.Text;
using System.Threading.Tasks;

namespace BH.Adapter.SoftwareName
namespace BH.Adapter.RFEM6
{
public partial class SoftwareNameAdapter : BHoMAdapter
public partial class RFEM6Adapter : BHoMAdapter
{
// Basic Delete method that deletes objects depending on their Type and Id.
// It gets called by the Push or by the Remove Adapter Actions.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2022, the respective contributors. All rights reserved.
*
Expand Down Expand Up @@ -29,9 +29,9 @@
using System.Text;
using System.Threading.Tasks;

namespace BH.Adapter.SoftwareName
namespace BH.Adapter.RFEM6
{
public partial class SoftwareNameAdapter : BHoMAdapter
public partial class RFEM6Adapter : BHoMAdapter
{
/***************************************************/
/**** Adapter overload method ****/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2022, the respective contributors. All rights reserved.
*
Expand Down Expand Up @@ -27,9 +27,9 @@
using System.Text;
using System.Threading.Tasks;

namespace BH.Adapter.SoftwareName
namespace BH.Adapter.RFEM6
{
public partial class SoftwareNameAdapter : BHoMAdapter
public partial class RFEM6Adapter : BHoMAdapter
{
// This method gets called when appropriate by the Push method contained in the base Adapter class.
// Unlike the Create, Delete and Read, this method already exposes a simple implementation: it calls Delete and then Create.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2022, the respective contributors. All rights reserved.
*
Expand All @@ -20,15 +20,15 @@
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using BH.oM.Adapters.SoftwareName;
using BH.oM.Adapters.RFEM6;
using BH.oM.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BH.Adapter.SoftwareName
namespace BH.Adapter.RFEM6
{
public static partial class Convert
{
Expand All @@ -38,7 +38,7 @@ public static partial class Convert

// Add methods for converting to BHoM from the specific software types.
// Example:
public static BHoMObject FromSoftwareName(this ExampleObject node)
public static BHoMObject FromRFEM6(this ExampleObject node)
{
//Insert code for convertion
throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2022, the respective contributors. All rights reserved.
*
Expand All @@ -20,15 +20,15 @@
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using BH.oM.Adapters.SoftwareName;
using BH.oM.Adapters.RFEM6;
using BH.oM.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BH.Adapter.SoftwareName
namespace BH.Adapter.RFEM6
{
public static partial class Convert
{
Expand All @@ -38,7 +38,7 @@ public static partial class Convert

// Add methods for converting from BHoM to the specific software types
// Example:
public static ExampleObject ToSoftwareName(this BHoMObject node)
public static ExampleObject ToRFEM6(this BHoMObject node)
{
//Insert code for convertion
throw new NotImplementedException();
Expand Down
Loading