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="StepBSplineSurface.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
// -----------------------------------------------------------------------
|
||||
// file="StepBSplineSurface"
|
||||
// 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 CommunityToolkit.HighPerformance;
|
||||
|
||||
using StgSharp.Script.Express;
|
||||
@@ -74,7 +71,7 @@ namespace StgSharp.Model.Step
|
||||
public const string TOROIDAL_SURF_TEXT = "TOROIDAL_SURF";
|
||||
public const string UNSPECIFIED_TEXT = "UNSPECIFIED";
|
||||
|
||||
public StepBSplineSurface( StepModel model ) : base( model ) { }
|
||||
public StepBSplineSurface(StepModel model) : base(model) { }
|
||||
|
||||
public bool UClosed { get; set; }
|
||||
|
||||
@@ -88,62 +85,62 @@ namespace StgSharp.Model.Step
|
||||
|
||||
public int UUpper => ControlPointsList.Count - 1;
|
||||
|
||||
public int VUpper => ControlPointsList[ 0 ].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 )
|
||||
public static StepBSplineSurface CreateFromSyntax(StepModel binder, ExpSyntaxNode syntax)
|
||||
{
|
||||
ExpNodePresidentEnumerator enumerator = syntax.ToPresidentEnumerator();
|
||||
enumerator.AssertEnumeratorCount( 7 );
|
||||
StepBSplineSurface ret = new StepBSplineSurface( binder );
|
||||
enumerator.AssertEnumeratorCount(7);
|
||||
StepBSplineSurface ret = new StepBSplineSurface(binder);
|
||||
|
||||
ret.UDegree = ( enumerator[ 0 ] as ExpIntNode ).Value;
|
||||
ret.VDegree = ( enumerator[ 1 ] as ExpIntNode ).Value;
|
||||
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 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 );
|
||||
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++ )
|
||||
for (int j = 0; j < points.Count; j++)
|
||||
{
|
||||
StepCartesianPoint p = binder[ aspan[ i ] as StepEntityInstanceNode ] as StepCartesianPoint;
|
||||
ls[ j ] = p;
|
||||
StepCartesianPoint p = binder[aspan[i] as StepEntityInstanceNode] as StepCartesianPoint;
|
||||
ls[j] = p;
|
||||
}
|
||||
ret.ControlPointsList.Add( pList );
|
||||
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;
|
||||
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 )
|
||||
public void FromInstance(StepBSplineSurface entity)
|
||||
{
|
||||
base.FromInstance( 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 ) );
|
||||
foreach (List<StepCartesianPoint> list in entity.ControlPointsList) {
|
||||
ControlPointsList.Add(new List<StepCartesianPoint>(list));
|
||||
}
|
||||
SurfaceForm = entity.SurfaceForm;
|
||||
}
|
||||
|
||||
protected static StepBSplineSurfaceForm GetSurfaceForm( string literal )
|
||||
protected static StepBSplineSurfaceForm GetSurfaceForm(string literal)
|
||||
{
|
||||
return literal switch
|
||||
{
|
||||
@@ -162,7 +159,7 @@ namespace StgSharp.Model.Step
|
||||
};
|
||||
}
|
||||
|
||||
protected static string GetSurfaceFormString( StepBSplineSurfaceForm form )
|
||||
protected static string GetSurfaceFormString(StepBSplineSurfaceForm form)
|
||||
{
|
||||
return form switch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user