Daily update on 20251020-041041 by Nitload Youmu. Additional Message : Code cleanup and new design of parallel (maybe THE THENTH VERSION? Tough work!).
Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -1,33 +1,30 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepBSplineCurveWithKnots.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
// -----------------------------------------------------------------------
|
||||
// file="StepBSplineCurveWithKnots"
|
||||
// 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:
|
||||
// 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.
|
||||
//
|
||||
// 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.Model.Step;
|
||||
using StgSharp.Script;
|
||||
using StgSharp.Script.Express;
|
||||
@@ -60,15 +57,11 @@ namespace StgSharp.Model.Step
|
||||
private const string UNIFORM_KNOTS = "UNIFORM_KNOTS";
|
||||
private const string UNSPECIFIED = "UNSPECIFIED";
|
||||
|
||||
public StepBSplineCurveWithKnots(
|
||||
StepModel model,
|
||||
IEnumerable<StepCartesianPoint> controlPoints )
|
||||
: base( model, controlPoints ) { }
|
||||
public StepBSplineCurveWithKnots(StepModel model, IEnumerable<StepCartesianPoint> controlPoints)
|
||||
: base(model, controlPoints) { }
|
||||
|
||||
public StepBSplineCurveWithKnots(
|
||||
StepModel model,
|
||||
params StepCartesianPoint[] controlPoints )
|
||||
: base( model, controlPoints ) { }
|
||||
public StepBSplineCurveWithKnots(StepModel model, params StepCartesianPoint[] controlPoints)
|
||||
: base(model, controlPoints) { }
|
||||
|
||||
public List<int> KnotMultiplicities { get; } = new List<int>();
|
||||
|
||||
@@ -78,59 +71,57 @@ namespace StgSharp.Model.Step
|
||||
|
||||
public StepKnotType KnotSpec { get; set; } = StepKnotType.Unspecified;
|
||||
|
||||
public void FromInstance( StepBSplineCurveWithKnots entity )
|
||||
public void FromInstance(StepBSplineCurveWithKnots entity)
|
||||
{
|
||||
base.FromInstance( entity );
|
||||
base.FromInstance(entity);
|
||||
KnotSpec = entity.KnotSpec;
|
||||
KnotMultiplicities.Clear();
|
||||
KnotMultiplicities.AddRange( entity.KnotMultiplicities );
|
||||
KnotMultiplicities.AddRange(entity.KnotMultiplicities);
|
||||
Knots.Clear();
|
||||
Knots.AddRange( entity.Knots );
|
||||
Knots.AddRange(entity.Knots);
|
||||
}
|
||||
|
||||
internal static StepBSplineCurveWithKnots FromSyntax(
|
||||
StepModel binder,
|
||||
ExpSyntaxNode syntaxList )
|
||||
internal static StepBSplineCurveWithKnots FromSyntax(StepModel binder, ExpSyntaxNode syntaxList)
|
||||
{
|
||||
ExpNodePresidentEnumerator enumerator = syntaxList .ToPresidentEnumerator();
|
||||
enumerator.AssertEnumeratorCount( 9 );
|
||||
ExpNodePresidentEnumerator controlPointsList = enumerator[ 2 ].TupleToPresidentEnumerator(
|
||||
enumerator.AssertEnumeratorCount(9);
|
||||
ExpNodePresidentEnumerator controlPointsList = enumerator[2].TupleToPresidentEnumerator(
|
||||
);
|
||||
|
||||
StepBSplineCurveWithKnots spline = new StepBSplineCurveWithKnots(
|
||||
binder, new StepCartesianPoint[controlPointsList.Count] );
|
||||
spline.Name = ( enumerator[ 0 ]as ExpStringNode )!.Value;
|
||||
spline.Degree = ( enumerator[ 1 ] as ExpIntNode )!.Value;
|
||||
binder, new StepCartesianPoint[controlPointsList.Count]);
|
||||
spline.Name = (enumerator[0]as ExpStringNode)!.Value;
|
||||
spline.Degree = (enumerator[1] as ExpIntNode)!.Value;
|
||||
|
||||
for( int i = 0; i < controlPointsList.Count; i++ )
|
||||
for (int i = 0; i < controlPointsList.Count; i++)
|
||||
{
|
||||
int j = i; // capture to avoid rebinding
|
||||
spline.ControlPointsList[ j ] = binder[ controlPointsList[ j ] ]as StepCartesianPoint;
|
||||
spline.ControlPointsList[j] = binder[controlPointsList[j]]as StepCartesianPoint;
|
||||
}
|
||||
|
||||
spline.CurveForm = ParseCurveForm( enumerator[ 3 ].CodeConvertTemplate );
|
||||
spline.ClosedCurve = ( enumerator[ 4 ] as ExpBoolNode )!.Value;
|
||||
spline.SelfIntersect = ( enumerator[ 5 ]as ExpBoolNode )!.Value;
|
||||
spline.CurveForm = ParseCurveForm(enumerator[3].CodeConvertTemplate);
|
||||
spline.ClosedCurve = (enumerator[4] as ExpBoolNode)!.Value;
|
||||
spline.SelfIntersect = (enumerator[5]as ExpBoolNode)!.Value;
|
||||
|
||||
ExpNodePresidentEnumerator knotMultiplicitiesList = enumerator[ 6 ].TupleToPresidentEnumerator(
|
||||
ExpNodePresidentEnumerator knotMultiplicitiesList = enumerator[6].TupleToPresidentEnumerator(
|
||||
);
|
||||
spline.KnotMultiplicities.Clear();
|
||||
for( int i = 0; i < knotMultiplicitiesList.Count; i++ ) {
|
||||
spline.KnotMultiplicities.Add( ( knotMultiplicitiesList[ i ]as ExpIntNode )!.Value );
|
||||
for (int i = 0; i < knotMultiplicitiesList.Count; i++) {
|
||||
spline.KnotMultiplicities.Add((knotMultiplicitiesList[i]as ExpIntNode)!.Value);
|
||||
}
|
||||
|
||||
ExpNodePresidentEnumerator knotsList = enumerator[ 7 ].TupleToPresidentEnumerator();
|
||||
ExpNodePresidentEnumerator knotsList = enumerator[7].TupleToPresidentEnumerator();
|
||||
spline.Knots.Clear();
|
||||
for( int i = 0; i < knotsList.Count; i++ ) {
|
||||
spline.Knots.Add( ( knotsList[ i ]as ExpRealNumberNode )!.Value );
|
||||
for (int i = 0; i < knotsList.Count; i++) {
|
||||
spline.Knots.Add((knotsList[i]as ExpRealNumberNode)!.Value);
|
||||
}
|
||||
|
||||
spline.KnotSpec = ParseKnotSpec( enumerator[ 8 ].CodeConvertTemplate );
|
||||
spline.KnotSpec = ParseKnotSpec(enumerator[8].CodeConvertTemplate);
|
||||
|
||||
return spline;
|
||||
}
|
||||
|
||||
private static string GetKnotSpec( StepKnotType spec )
|
||||
private static string GetKnotSpec(StepKnotType spec)
|
||||
{
|
||||
return spec switch
|
||||
{
|
||||
@@ -142,7 +133,7 @@ namespace StgSharp.Model.Step
|
||||
};
|
||||
}
|
||||
|
||||
private static StepKnotType ParseKnotSpec( string enumerationValue )
|
||||
private static StepKnotType ParseKnotSpec(string enumerationValue)
|
||||
{
|
||||
return enumerationValue.ToUpperInvariant() switch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user