Skip to content

Commit

Permalink
Updated to filter "Types::" prefix in SysML imported descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickRitchie committed Dec 27, 2023
1 parent 925bb70 commit 7fd624c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
23 changes: 11 additions & 12 deletions build/MTConnect.NET-SysML-Import/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@
using System.Text.Json;

var xmlPath = @"D:\TrakHound\MTConnect\MTConnectSysMLModel.xml";
//var outputPath = @"C:\temp\mtconnect-model-results";


var mtconnectModel = MTConnectModel.Parse(xmlPath);


//var jsonOptions = new JsonSerializerOptions();
//jsonOptions.WriteIndented = true;
//jsonOptions.DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault;
//jsonOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;

//var json = JsonSerializer.Serialize(mtconnectModel, options: jsonOptions);
//await File.WriteAllTextAsync(@"C:\temp\mtconnect-model.json", json);


//RenderJsonFile();
RenderCommonClasses();
RenderJsonComponents();
RenderXmlComponents();


void RenderJsonFile()
{
var jsonOptions = new JsonSerializerOptions();
jsonOptions.WriteIndented = true;
jsonOptions.DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault;
jsonOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;

var json = JsonSerializer.Serialize(mtconnectModel, options: jsonOptions);
File.WriteAllText(@"C:\temp\mtconnect-model.json", json);
}

void RenderCommonClasses()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
namespace MTConnect.Devices.Components
{
/// <summary>
/// Component that organize Component Types::Axis types.
/// Component that organize Component Axis types.
/// </summary>
public class AxesComponent : Component, IOrganizerComponent
{
public const string TypeId = "Axes";
public const string NameId = "axesComponent";
public new const string DescriptionText = "Component that organize Component Types::Axis types.";
public new const string DescriptionText = "Component that organize Component Axis types.";

public override string TypeDescription => DescriptionText;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
namespace MTConnect.Devices.Components
{
/// <summary>
/// Component Types::Axis that provides prismatic motion along a fixed axis.
/// Component Axis that provides prismatic motion along a fixed axis.
/// </summary>
public class LinearComponent : Component
{
public const string TypeId = "Linear";
public const string NameId = "linearComponent";
public new const string DescriptionText = "Component Types::Axis that provides prismatic motion along a fixed axis.";
public new const string DescriptionText = "Component Axis that provides prismatic motion along a fixed axis.";

public override string TypeDescription => DescriptionText;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
namespace MTConnect.Devices.Components
{
/// <summary>
/// Component Types::Axis that provides rotation about a fixed axis.
/// Component Axis that provides rotation about a fixed axis.
/// </summary>
public class RotaryComponent : Component
{
public const string TypeId = "Rotary";
public const string NameId = "rotaryComponent";
public new const string DescriptionText = "Component Types::Axis that provides rotation about a fixed axis.";
public new const string DescriptionText = "Component Axis that provides rotation about a fixed axis.";

public override string TypeDescription => DescriptionText;

Expand Down
1 change: 1 addition & 0 deletions libraries/MTConnect.NET-SysML/ModelHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ public static string ProcessDescription(string text)
result = result.Replace("\n", "");
result = result.Replace("\r", "");
result = result.Replace("\"", "'");
result = result.Replace("Types::", "");
result = UppercaseFirstWord(result);


Expand Down

0 comments on commit 7fd624c

Please sign in to comment.