This commit is contained in:
Nitload
2025-08-25 09:50:30 +08:00
parent bd0e31e922
commit 1359ff4ecc
1630 changed files with 738486 additions and 2399 deletions
+19 -18
View File
@@ -28,24 +28,23 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Model.Step;
using StgSharp.Script;
using StgSharp.Script.Express;
using System;
using System.Collections.Generic;
namespace StgSharp.Model.Step
namespace StgSharp.Modeling.Items
{
public class StepVector : StepGeometricRepresentationItem, IExpConvertableFrom<StepVector>
public class StepVector : StepGeometricRepresentationItem
{
private StepDirection _direction;
private StepVector( StepModel model ) : base( model ) { }
private StepVector() : base( string.Empty ) { }
public StepVector( StepModel model, StepDirection direction, double length )
: base( model )
public StepVector( string name, StepDirection direction, double length )
: base( name )
{
Direction = direction;
Length = length;
@@ -58,7 +57,9 @@ namespace StgSharp.Model.Step
get { return _direction; }
set
{
ArgumentNullException.ThrowIfNull( value );
if( value == null ) {
throw new ArgumentNullException();
}
_direction = value;
}
@@ -66,21 +67,21 @@ namespace StgSharp.Model.Step
public override StepItemType ItemType => StepItemType.Vector;
public void FromInstance( StepVector entity )
internal static StepVector CreateFromSyntaxList( StepBinder binder, ExpNode syntaxList )
{
base.FromInstance( entity );
_direction = entity.Direction;
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
StepVector vector = new StepVector();
enumerator.AssertEnumeratorCount( 3 );
vector.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
binder.BindValue(
enumerator.Values[ 1 ], v => vector.Direction = v.AsType<StepDirection>() );
vector.Length = ( enumerator.Values[ 2 ]as ExpRealNumberNode )!.Value;
return vector;
}
internal static StepVector FromSyntax( StepModel binder, ExpSyntaxNode syntaxList )
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
{
ExpNodePresidentEnumerator enumerator = new ExpNodePresidentEnumerator( syntaxList );
StepVector vector = new StepVector( binder );
enumerator.AssertEnumeratorCount( 3 );
vector.Name = ( enumerator[ 0 ]as ExpStringNode )!.Value;
vector.Direction = binder[ enumerator[ 1 ] ] as StepDirection;
vector.Length = ( enumerator[ 2 ]as ExpRealNumberNode )!.Value;
return vector;
yield return Direction;
}
}