Daily update on 20250618-051714 by Nitload Youmu. Additional Message : Brief support to collection operation in EXPRESS. A collection type added in core lib and compilestack.
Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpSyntaxAnalyzer.Enum.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Script;
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Model.Step
|
||||
{
|
||||
internal partial class StepExpSyntaxAnalyzer
|
||||
{
|
||||
|
||||
private static string ParseStepEnumLiteral( string source )
|
||||
{
|
||||
int length = source.Length;
|
||||
ReadOnlySpan<char> span = source.AsSpan();
|
||||
if( length > 2 && span[ 0 ] == '.' && span[ length - 1 ] == '.' ) {
|
||||
return span.Slice( 1, length - 2 ).ToString();
|
||||
}
|
||||
throw new ExpInvalidSyntaxException( $"\"{source}\" is not a valid enum syntax" );
|
||||
}
|
||||
|
||||
private void TryAppendEnum( Token e )
|
||||
{
|
||||
ExpSyntaxNode node = e.Value switch
|
||||
{
|
||||
".T." => new ExpBoolNode( e, true, true ),
|
||||
".F." => new ExpBoolNode( e, false, true ),
|
||||
".U." => new ExpLogicValueNode( e, ExpLogic.Unknown, true ),
|
||||
_ => ExpEnumLiteralNode.Create( e, ParseStepEnumLiteral ),
|
||||
};
|
||||
_cache.PushOperand( node );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepBSplineSurface.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using CommunityToolkit.HighPerformance;
|
||||
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Model.Step
|
||||
{
|
||||
public enum StepBSplineSurfaceForm
|
||||
{
|
||||
|
||||
PLANE_SURF,
|
||||
CYLINDRICAL_SURF,
|
||||
CONICAL_SURF,
|
||||
SPHERICAL_SURF,
|
||||
TOROIDAL_SURF,
|
||||
SURF_OF_REVOLUTION,
|
||||
RULED_SURF,
|
||||
GENERALISED_CONE,
|
||||
QUADRIC_SURF,
|
||||
SURF_OF_LINEAR_EXTRUSION,
|
||||
UNSPECIFIED,
|
||||
|
||||
}
|
||||
|
||||
public class StepBSplineSurface : StepBoundedSurface, IExpConvertableFrom<StepBSplineSurface>
|
||||
{
|
||||
|
||||
public const string CONICAL_SURF_TEXT = "CONICAL_SURF";
|
||||
public const string CYLINDRICAL_SURF_TEXT = "CYLINDRICAL_SURF";
|
||||
public const string GENERALISED_CONE_TEXT = "GENERALISED_CONE";
|
||||
public const string PLANE_SURF_TEXT = "PLANE_SURF";
|
||||
public const string QUADRIC_SURF_TEXT = "QUADRIC_SURF";
|
||||
public const string RULED_SURF_TEXT = "RULED_SURF";
|
||||
public const string SPHERICAL_SURF_TEXT = "SPHERICAL_SURF";
|
||||
public const string SURF_OF_LINEAR_EXTRUSION_TEXT = "SURF_OF_LINEAR_EXTRUSION";
|
||||
public const string SURF_OF_REVOLUTION_TEXT = "SURF_OF_REVOLUTION";
|
||||
public const string TOROIDAL_SURF_TEXT = "TOROIDAL_SURF";
|
||||
public const string UNSPECIFIED_TEXT = "UNSPECIFIED";
|
||||
|
||||
public StepBSplineSurface( StepModel model ) : base( model ) { }
|
||||
|
||||
public bool UClosed { get; set; }
|
||||
|
||||
public bool VClosed { get; set; }
|
||||
|
||||
public bool SelfIntersections { get; set; }
|
||||
|
||||
public int UDegree { get; set; }
|
||||
|
||||
public int VDegree { get; set; }
|
||||
|
||||
public int UUpper => ControlPointsList.Count - 1;
|
||||
|
||||
public int VUpper => ControlPointsList[ 0 ].Count - 1;
|
||||
|
||||
public List<List<StepCartesianPoint>> ControlPointsList { get; set; }
|
||||
= new List<List<StepCartesianPoint>>();
|
||||
|
||||
public StepBSplineSurfaceForm SurfaceForm { get; set; }
|
||||
|
||||
public static StepBSplineSurface CreateFromSyntax( StepModel binder, ExpSyntaxNode syntax )
|
||||
{
|
||||
ExpNodePresidentEnumerator enumerator = syntax.ToPresidentEnumerator();
|
||||
enumerator.AssertEnumeratorCount( 7 );
|
||||
StepBSplineSurface ret = new StepBSplineSurface( binder );
|
||||
|
||||
ret.UDegree = ( enumerator[ 0 ] as ExpIntNode ).Value;
|
||||
ret.VDegree = ( enumerator[ 1 ] as ExpIntNode ).Value;
|
||||
|
||||
ExpNodePresidentEnumerator pointList = enumerator[ 2 ].TupleToPresidentEnumerator();
|
||||
pointList.AssertEnumeratorCount( 2, int.MaxValue );
|
||||
for( int i = 0; i < pointList.Count; i++ )
|
||||
{
|
||||
ExpNodePresidentEnumerator points = pointList[ i ].TupleToPresidentEnumerator();
|
||||
points.AssertEnumeratorCount( 2, int.MaxValue );
|
||||
List<StepCartesianPoint> pList = new List<StepCartesianPoint>( points.Count );
|
||||
CollectionsMarshal.SetCount( pList, points.Count );
|
||||
Span<StepCartesianPoint> ls = CollectionsMarshal.AsSpan( pList );
|
||||
Span<ExpSyntaxNode> aspan = points.AsSpan();
|
||||
for( int j = 0; j < points.Count; j++ )
|
||||
{
|
||||
StepCartesianPoint p = binder[ aspan[ i ] as StepEntityInstanceNode ] as StepCartesianPoint;
|
||||
ls[ j ] = p;
|
||||
}
|
||||
ret.ControlPointsList.Add( pList );
|
||||
}
|
||||
|
||||
ret.SurfaceForm = GetSurfaceForm( enumerator[ 3 ].CodeConvertTemplate );
|
||||
ret.UClosed = ( enumerator[ 4 ] as ExpBoolNode ).Value;
|
||||
ret.VClosed = ( enumerator[ 5 ] as ExpBoolNode ).Value;
|
||||
ret.SelfIntersections = ( enumerator[ 6 ] as ExpBoolNode ).Value;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void FromInstance( StepBSplineSurface entity )
|
||||
{
|
||||
base.FromInstance( entity );
|
||||
UClosed = entity.UClosed;
|
||||
VClosed = entity.VClosed;
|
||||
UDegree = entity.UDegree;
|
||||
VDegree = entity.VDegree;
|
||||
ControlPointsList.Clear();
|
||||
foreach( List<StepCartesianPoint> list in entity.ControlPointsList ) {
|
||||
ControlPointsList.Add( new List<StepCartesianPoint>( list ) );
|
||||
}
|
||||
SurfaceForm = entity.SurfaceForm;
|
||||
}
|
||||
|
||||
protected static StepBSplineSurfaceForm GetSurfaceForm( string literal )
|
||||
{
|
||||
return literal switch
|
||||
{
|
||||
CONICAL_SURF_TEXT => StepBSplineSurfaceForm.PLANE_SURF,
|
||||
CYLINDRICAL_SURF_TEXT => StepBSplineSurfaceForm.CYLINDRICAL_SURF,
|
||||
GENERALISED_CONE_TEXT => StepBSplineSurfaceForm.CONICAL_SURF,
|
||||
PLANE_SURF_TEXT => StepBSplineSurfaceForm.SPHERICAL_SURF,
|
||||
QUADRIC_SURF_TEXT => StepBSplineSurfaceForm.TOROIDAL_SURF,
|
||||
RULED_SURF_TEXT => StepBSplineSurfaceForm.SURF_OF_REVOLUTION,
|
||||
SPHERICAL_SURF_TEXT => StepBSplineSurfaceForm.RULED_SURF,
|
||||
SURF_OF_LINEAR_EXTRUSION_TEXT => StepBSplineSurfaceForm.GENERALISED_CONE,
|
||||
SURF_OF_REVOLUTION_TEXT => StepBSplineSurfaceForm.QUADRIC_SURF,
|
||||
TOROIDAL_SURF_TEXT => StepBSplineSurfaceForm.SURF_OF_LINEAR_EXTRUSION,
|
||||
UNSPECIFIED_TEXT => StepBSplineSurfaceForm.UNSPECIFIED,
|
||||
_ => StepBSplineSurfaceForm.UNSPECIFIED,
|
||||
};
|
||||
}
|
||||
|
||||
protected static string GetSurfaceFormString( StepBSplineSurfaceForm form )
|
||||
{
|
||||
return form switch
|
||||
{
|
||||
StepBSplineSurfaceForm.PLANE_SURF => CONICAL_SURF_TEXT,
|
||||
StepBSplineSurfaceForm.CYLINDRICAL_SURF => CYLINDRICAL_SURF_TEXT,
|
||||
StepBSplineSurfaceForm.CONICAL_SURF => GENERALISED_CONE_TEXT,
|
||||
StepBSplineSurfaceForm.SPHERICAL_SURF => PLANE_SURF_TEXT,
|
||||
StepBSplineSurfaceForm.TOROIDAL_SURF => QUADRIC_SURF_TEXT,
|
||||
StepBSplineSurfaceForm.SURF_OF_REVOLUTION => RULED_SURF_TEXT,
|
||||
StepBSplineSurfaceForm.RULED_SURF => SPHERICAL_SURF_TEXT,
|
||||
StepBSplineSurfaceForm.GENERALISED_CONE => SURF_OF_LINEAR_EXTRUSION_TEXT,
|
||||
StepBSplineSurfaceForm.QUADRIC_SURF => SURF_OF_REVOLUTION_TEXT,
|
||||
StepBSplineSurfaceForm.SURF_OF_LINEAR_EXTRUSION => TOROIDAL_SURF_TEXT,
|
||||
StepBSplineSurfaceForm.UNSPECIFIED => UNSPECIFIED_TEXT,
|
||||
_ => UNSPECIFIED_TEXT
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepBoundedSurface.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Model.Step
|
||||
{
|
||||
public class StepBoundedSurface : StepSurface, IExpConvertableFrom<StepBoundedSurface>
|
||||
{
|
||||
|
||||
public StepBoundedSurface( StepModel model ) : base( model ) { }
|
||||
|
||||
public override StepItemType ItemType => StepItemType.BoundedSurface;
|
||||
|
||||
public void FromInstance( StepBoundedSurface entity )
|
||||
{
|
||||
base.FromInstance( entity );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepBoundedSurfaceCurve.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Model.Step
|
||||
{
|
||||
internal class StepBoundedSurfaceCurve : StepBoundedCurve, IExpConvertableFrom<StepBoundedSurfaceCurve, StepSurfaceCurve>
|
||||
{
|
||||
|
||||
public StepBoundedSurfaceCurve( StepModel model ) : base( model ) { }
|
||||
|
||||
public StepCurve Parent { get; set; } = null!;
|
||||
|
||||
public void FromInstance( StepSurfaceCurve entity )
|
||||
{
|
||||
base.FromInstance( entity );
|
||||
}
|
||||
|
||||
public void FromInstance( StepBoundedSurfaceCurve entity )
|
||||
{
|
||||
base.FromInstance( entity );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepPcurveOrSurface.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Model.Step.Items
|
||||
{
|
||||
public class StepPCurveOrSurface : StepGeometricRepresentationItem, IExpConvertableFrom<StepPCurveOrSurface>
|
||||
{
|
||||
|
||||
public StepPCurveOrSurface( StepModel model ) : base( model ) { }
|
||||
|
||||
public void FromInstance( StepPCurveOrSurface entity )
|
||||
{
|
||||
base.FromInstance( entity );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepSurfaceCurve.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Model.Step
|
||||
{
|
||||
public class StepSurfaceCurve : StepCurve, IExpConvertableFrom<StepSurfaceCurve>
|
||||
{
|
||||
|
||||
public StepSurfaceCurve( StepModel model ) : base( model ) { }
|
||||
|
||||
public StepCurve Curve3D { get; set; }
|
||||
|
||||
public void FromInstance( StepSurfaceCurve entity )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepEntityLabel.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
using StgSharp.PipeLine;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Model.Step
|
||||
{
|
||||
public record class StepEntityLabel : PipelineNodeLabel
|
||||
{
|
||||
public StepEntityLabel( int id )
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public int Id { get; init; }
|
||||
|
||||
public override int ComputeHashCode()
|
||||
{
|
||||
return Id;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"StepEntityLabel: {Id}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepEntityUnsupportedException.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Model.Step
|
||||
{
|
||||
internal class StepEntityUnsupportedException : Exception { }
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepUncertainElement.Parse.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Model.Step
|
||||
{
|
||||
public partial class StepUninitializedEntity
|
||||
{
|
||||
|
||||
private static StepRepresentationItem ConvertSimpleEntity(
|
||||
StepModel context,
|
||||
ExpFunctionCallingNode calling )
|
||||
{
|
||||
string name = calling.FunctionCaller.Name;
|
||||
return name switch
|
||||
{
|
||||
ExpressStepUtil.AdvancedFaceText => StepAdvancedFace.FromSyntax(
|
||||
context, calling.Right ),
|
||||
ExpressStepUtil.Axis2Placement2DText => StepAxis2Placement2D.FromSyntax(
|
||||
context, calling.Right ),
|
||||
ExpressStepUtil.Axis2Placement3DText => StepAxis2Placement3D.FromSyntax(
|
||||
context, calling.Right ),
|
||||
ExpressStepUtil.BSplineCurveWithKnotsText => StepBSplineCurveWithKnots.FromSyntax(
|
||||
context, calling.Right ),
|
||||
ExpressStepUtil.CartesianPointText => StepCartesianPoint.FromSyntax(
|
||||
context, calling.Right ),
|
||||
ExpressStepUtil.CircleText => StepCircle.FromSyntax( context, calling.Right ),
|
||||
ExpressStepUtil.CylindricalSurfaceText => StepCylindricalSurface.FromSyntax(
|
||||
context, calling.Right ),
|
||||
ExpressStepUtil.DirectionText => StepDirection.FromSyntax( context, calling.Right ),
|
||||
ExpressStepUtil.EdgeCurveText => StepEdgeCurve.FromSyntax( context, calling.Right ),
|
||||
ExpressStepUtil.EdgeLoopText => StepEdgeLoop.FromSyntax( context, calling.Right ),
|
||||
ExpressStepUtil.EllipseText => StepEllipse.FromSyntax( context, calling.Right ),
|
||||
ExpressStepUtil.FaceBoundText => StepFaceBound.FromSyntax( context, calling.Right ),
|
||||
ExpressStepUtil.FaceOuterBoundText => StepFaceOuterBound.FromSyntax(
|
||||
context, calling.Right ),
|
||||
ExpressStepUtil.LineText => StepLine.FromSyntax( context, calling.Right ),
|
||||
ExpressStepUtil.OrientedEdgeText => StepOrientedEdge.FromSyntax(
|
||||
context, calling.Right ),
|
||||
ExpressStepUtil.PlaneText => StepPlane.FromSyntax( context, calling.Right ),
|
||||
ExpressStepUtil.VectorText => StepVector.FromSyntax( context, calling.Right ),
|
||||
ExpressStepUtil.VertexPointText => StepVertexPoint.FromSyntax(
|
||||
context, calling.Right ),
|
||||
_ => throw new StepEntityUnsupportedException()
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepUncertainEntity.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the ¡°Software¡±), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED ¡°AS IS¡±,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Microsoft.CodeAnalysis.Operations;
|
||||
|
||||
using StgSharp;
|
||||
|
||||
using StgSharp.Model.Step;
|
||||
using StgSharp.PipeLine;
|
||||
using StgSharp.Script;
|
||||
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Dynamic;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace StgSharp.Model.Step
|
||||
{
|
||||
public partial class StepUninitializedEntity : StepEntityBase, IConvertableToPipelineNode
|
||||
{
|
||||
|
||||
internal const string InName = "in", OutName = "out";
|
||||
|
||||
private ExpSyntaxNode _data;
|
||||
|
||||
internal StepUninitializedEntity( StepModel model, int id )
|
||||
{
|
||||
Context = model;
|
||||
Id = id;
|
||||
}
|
||||
|
||||
internal StepUninitializedEntity( StepModel model, StepEntityLabel label )
|
||||
{
|
||||
Context = model;
|
||||
Label = label;
|
||||
}
|
||||
|
||||
internal StepUninitializedEntity(
|
||||
StepModel model,
|
||||
int id,
|
||||
ExpSyntaxNode initialization,
|
||||
IEnumerable<int> dependency )
|
||||
{
|
||||
Context = model;
|
||||
Id = id;
|
||||
_data = initialization;
|
||||
if( dependency == null )
|
||||
{
|
||||
Dependencies = [];
|
||||
} else
|
||||
{
|
||||
Dependencies = dependency;
|
||||
}
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.Unknown;
|
||||
|
||||
internal static HashSet<string> UnsupportedItemTypes { get; } = new HashSet<string>();
|
||||
|
||||
internal StepEntityBase? ConvertToAccurate()
|
||||
{
|
||||
/*
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if( Dependencies is null || _data is null )
|
||||
{
|
||||
builder.Append( "---------------------------" );
|
||||
builder.Append( "************************" );
|
||||
Console.WriteLine(
|
||||
$"Building entity {Id} from thread {Environment.CurrentManagedThreadId} with dependency:{builder.ToString()} " );
|
||||
} else
|
||||
{
|
||||
foreach( int item in Dependencies ) {
|
||||
builder.Append( $"{item}," );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
/**/
|
||||
if( _data is ExpFunctionCallingNode initNode )
|
||||
{
|
||||
string name = initNode.FunctionCaller.Name;
|
||||
StepEntityBase? entity = ConvertSimpleEntity( Context, initNode );
|
||||
if( entity is null )
|
||||
{
|
||||
UnsupportedItemTypes.Add( name );
|
||||
return null;
|
||||
}
|
||||
return entity;
|
||||
} else if( _data is StepComplexEntityNode complex )
|
||||
{
|
||||
/**/
|
||||
ExpNodeTempEnumerator enumerator = new ExpNodeTempEnumerator( complex.Right, true );
|
||||
StepRepresentationItem entity = null!;
|
||||
while( enumerator.MoveNext() )
|
||||
{
|
||||
if( enumerator.Current is not ExpFunctionCallingNode init ) {
|
||||
throw new InvalidCastException();
|
||||
}
|
||||
StepRepresentationItem? e = ConvertSimpleEntity( Context, init );
|
||||
if( e is null )
|
||||
{
|
||||
//throw new NotImplementedException( $"Unknown entity type in sequence {Id}" );
|
||||
return null;
|
||||
}
|
||||
if( entity is null )
|
||||
{
|
||||
entity = e;
|
||||
} else
|
||||
{
|
||||
entity = StepDataParser.Implement( entity, e );
|
||||
}
|
||||
}
|
||||
return entity;
|
||||
/**/
|
||||
return null;
|
||||
} else
|
||||
{
|
||||
throw new ExpInvalidSyntaxException( "Name of entity is required." );
|
||||
}
|
||||
}
|
||||
|
||||
internal void FromSequence( StepEntityDefineSequence sequence )
|
||||
{
|
||||
ExpSyntaxNode node = sequence.Expression;
|
||||
if( node is not ExpBinaryOperatorNode assign ) {
|
||||
throw new ExpInvalidSyntaxException( "Not an assign expression " );
|
||||
}
|
||||
StepEntityInstanceNode? idNode = assign.Left as StepEntityInstanceNode;
|
||||
if( idNode!.Id != this.Id ) {
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
FromSequenceUnsafe( sequence );
|
||||
}
|
||||
|
||||
internal void FromSequenceUnsafe( StepEntityDefineSequence sequence )
|
||||
{
|
||||
ExpSyntaxNode assign = ( sequence.Expression as ExpBinaryOperatorNode )!;
|
||||
ExpSyntaxNode initNode;
|
||||
if( ( assign.Right is ExpFunctionCallingNode f ) )
|
||||
{
|
||||
initNode = assign.Right;
|
||||
ExpEntityTypeName = f.FunctionCaller.Name;
|
||||
} else if( ( assign.Right is StepComplexEntityNode c ) )
|
||||
{
|
||||
initNode = assign.Right;
|
||||
ExpNodeTempEnumerator enumerator = new ExpNodeTempEnumerator( c.Right, false );
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append( "Complex entity initialization: " );
|
||||
int count = 0;
|
||||
while( enumerator.MoveNext() )
|
||||
{
|
||||
if( count > 0 ) {
|
||||
sb.Append( " <-> " );
|
||||
}
|
||||
f = ( enumerator.Current as ExpFunctionCallingNode )!;
|
||||
sb.Append( $"{f.FunctionCaller.Name}" );
|
||||
count++;
|
||||
}
|
||||
ExpEntityTypeName = sb.ToString();
|
||||
} else
|
||||
{
|
||||
throw new ExpInvalidSyntaxException(
|
||||
"Entity init or complex entity define is required." );
|
||||
}
|
||||
if( _data is not null ) {
|
||||
return;
|
||||
}
|
||||
_data = initNode!;
|
||||
Dependencies = sequence.Dependencies ?? [];
|
||||
}
|
||||
|
||||
void IConvertableToPipelineNode.NodeMain(
|
||||
in Dictionary<string, PipelineNodeInPort> input,
|
||||
in Dictionary<string, PipelineNodeOutPort> output )
|
||||
{
|
||||
try
|
||||
{
|
||||
StepEntityBase? entity = ConvertToAccurate();
|
||||
if( entity is not null )
|
||||
{
|
||||
entity.FromInstance( this );
|
||||
Context.ReplaceEntity( this, entity );
|
||||
}
|
||||
}
|
||||
catch( StepEntityUnsupportedException ) { }
|
||||
catch( Exception ex )
|
||||
{
|
||||
throw new Exception( $"Step decoder crashed when building entity {Id}", ex );
|
||||
}
|
||||
|
||||
//Context.ReplaceEntity( this, entity );
|
||||
PipelineNodeOutPort.SkipAll( output );
|
||||
}
|
||||
|
||||
IEnumerable<string> IConvertableToPipelineNode.InputPortName => [InName];
|
||||
|
||||
PipelineNodeOperation IConvertableToPipelineNode.Operation => ( this as IConvertableToPipelineNode ).NodeMain;
|
||||
|
||||
IEnumerable<string> IConvertableToPipelineNode.OutputPortName => [OutName];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepUnsupportedEntity.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Model.Step
|
||||
{
|
||||
public class StepUnsupportedEntity : StepEntityBase
|
||||
{
|
||||
|
||||
private ExpSyntaxNode _initSequence;
|
||||
|
||||
public StepUnsupportedEntity( StepModel model, int id, string name, ExpSyntaxNode sequence )
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
_initSequence = sequence;
|
||||
Context = model;
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.Unknown;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user