Daily update on 20250414-003153 by Nitload Youmu. Additional Message : Tech Issue: due to forbidden of multi-inheritance in C#, full ranslate fron EXPRESS to C# code is impossible, the EXPRESS interpreter in StgSharp will become a dialect

Add: A group of classes imported from lib https://github.com/ixmilia/step under MIT license, representing all STEP AP203 geometry objects
Change: many change to classes from https://github.com/ixmilia/step to link data interfaces to those in StgSharp
Freeze: implementation to StgSharp EXPRESS interpreter about collextion operation and element define grammer

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-04-14 00:31:54 +08:00
parent 2692495dc8
commit 9457309c5a
69 changed files with 3318 additions and 117 deletions
+19 -20
View File
@@ -43,9 +43,8 @@ namespace StgSharp.Modeling.STEP
{
public partial class StepReader
{
private Regex expressionSpilitter = new Regex(
@"^#(?<id>[0-9]+)\s*?=\s*?(?<expression>\S.*?)\s*;$",
RegexOptions.Compiled );
private Regex expressionSpilitter = GetExpressionSplitter();
private ThreadLocal<ConcurrentQueue<StepCodeLine>> _codeLineQueue
= new ThreadLocal<ConcurrentQueue<StepCodeLine>>();
@@ -57,35 +56,35 @@ namespace StgSharp.Modeling.STEP
public void ReadDataSection()
{
if (_codeLineQueue.Value == null)
{
if( _codeLineQueue.Value == null ) {
_codeLineQueue.Value = new ConcurrentQueue<StepCodeLine>();
}
using (MemoryMappedViewStream ms = _memoryFile.CreateViewStream(
0, _size, MemoryMappedFileAccess.Read))
using( MemoryMappedViewStream ms = _memoryFile.CreateViewStream(
0, _size, MemoryMappedFileAccess.Read ) )
{
using (StreamReader sr = new StreamReader(ms))
using( StreamReader sr = new StreamReader( ms ) )
{
long pos = _headStart;
string line;
while (string.IsNullOrEmpty(line = sr.ReadLine()))
while( string.IsNullOrEmpty( line = sr.ReadLine()! ) )
{
switch (line)
Match match = expressionSpilitter.Match( line );
if( match.Success )
{
default:
break;
}
Match match = expressionSpilitter.Match(line);
if (match.Success)
{
int id = int.Parse(match.Groups["id"].Value);
string expression = match.Groups["expression"].Value;
StepCodeLine stepExpression = new StepCodeLine(id, expression);
_codeLineQueue.Value.Enqueue(stepExpression);
int id = int.Parse( match.Groups[ "id" ].Value );
string expression = match.Groups[ "expression" ].Value;
StepCodeLine stepExpression = new StepCodeLine( id, expression );
_codeLineQueue.Value.Enqueue( stepExpression );
}
}
}
}
}
[GeneratedRegex(
@"^#(?<id>[0-9]+)\s*?=\s*?(?<expression>\S.*?)\s*;$",
RegexOptions.Compiled | RegexOptions.Singleline )]
private static partial Regex GetExpressionSplitter();
}
}