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
+21 -17
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 StepVertexPoint : StepVertex, IExpConvertableFrom<StepVertexPoint>
public class StepVertexPoint : StepVertex
{
private StepCartesianPoint _location;
public StepVertexPoint( StepModel model ) : base( model ) { }
private StepVertexPoint() : base( string.Empty ) { }
public StepVertexPoint( StepModel model, StepCartesianPoint location )
: base( model )
public StepVertexPoint( string name, StepCartesianPoint location )
: base( name )
{
Location = location;
}
@@ -55,27 +54,32 @@ namespace StgSharp.Model.Step
get { return _location; }
set
{
ArgumentNullException.ThrowIfNull( value );
if( value == null ) {
throw new ArgumentNullException();
}
_location = value;
}
}
public override StepItemType ItemType => StepItemType.VertexPoint;
public void FromInstance( StepVertexPoint entity )
internal static StepVertexPoint CreateFromSyntaxList(
StepBinder binder,
ExpNode syntaxList )
{
base.FromInstance( entity );
this.Location = entity.Location;
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
StepVertexPoint vertex = new StepVertexPoint();
enumerator.AssertEnumeratorCount( 2 );
vertex.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
binder.BindValue(
enumerator.Values[ 1 ], v => vertex.Location = v.AsType<StepCartesianPoint>() );
return vertex;
}
internal static StepVertexPoint FromSyntax( StepModel binder, ExpSyntaxNode syntaxList )
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
{
ExpNodePresidentEnumerator enumerator = new ExpNodePresidentEnumerator( syntaxList );
StepVertexPoint vertex = new StepVertexPoint( binder );
enumerator.AssertEnumeratorCount( 2 );
vertex.Name = ( enumerator[ 0 ]as ExpStringNode )!.Value;
vertex.Location = binder[ enumerator[ 1 ] ] as StepCartesianPoint;
return vertex;
yield return Location;
}
}