Daily update on 20250414-003153 by Nitload Youmu. Additional Message : Tech Issue: due to forbidden of multi-inheritance in C#, full ranslate fron EXPRESS to C# code is impossible, the EXPRESS interpreter in StgSharp will become a dialect
Add: A group of classes imported from lib https://github.com/ixmilia/step under MIT license, representing all STEP AP203 geometry objects Change: many change to classes from https://github.com/ixmilia/step to link data interfaces to those in StgSharp Freeze: implementation to StgSharp EXPRESS interpreter about collextion operation and element define grammer Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepAdvancedFace.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.Linq;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepAdvancedFace : StepFaceSurface
|
||||
{
|
||||
|
||||
private StepAdvancedFace() : base( string.Empty ) { }
|
||||
|
||||
public StepAdvancedFace( string name ) : base( name ) { }
|
||||
|
||||
public override StepItemType ItemType => StepItemType.AdvancedFace;
|
||||
|
||||
internal static StepAdvancedFace CreateFromSyntaxList(
|
||||
StepBinder binder,
|
||||
ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
StepAdvancedFace face = new StepAdvancedFace();
|
||||
enumerator.AssertEnumeratorCount( 4 );
|
||||
face.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
|
||||
object boundsList = enumerator.Values[ 1 ].GetValueList();
|
||||
face.Bounds.Clear();
|
||||
face.Bounds
|
||||
.AddRange(
|
||||
Enumerable.Range( 0, enumerator.Values.Count )
|
||||
.Select( _ => ( StepFaceBound )null ) );
|
||||
for( int i = 0; i < enumerator.Values.Count; i++ )
|
||||
{
|
||||
int j = i; // capture to avoid rebinding
|
||||
binder.BindValue(
|
||||
enumerator.Values[ j ], v => face.Bounds[ j ] = v.AsType<StepFaceBound>() );
|
||||
}
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 2 ], v => face.FaceGeometry = v.AsType<StepSurface>() );
|
||||
face.SameSense = ( enumerator.Values[ 3 ] as ExpBoolNode )!.Value;
|
||||
|
||||
return face;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepAxis2Placement.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepAxis2Placement : StepPlacement
|
||||
{
|
||||
|
||||
private StepCartesianPoint _location;
|
||||
private StepDirection _refDirection;
|
||||
|
||||
protected StepAxis2Placement( string name ) : base( name ) { }
|
||||
|
||||
public StepCartesianPoint Location
|
||||
{
|
||||
get { return _location; }
|
||||
set
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull( value );
|
||||
|
||||
_location = value;
|
||||
}
|
||||
}
|
||||
|
||||
public StepDirection RefDirection
|
||||
{
|
||||
get { return _refDirection; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_refDirection = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepAxis2Placement2D.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.Collections.Generic;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepAxis2Placement2D : StepAxis2Placement
|
||||
{
|
||||
|
||||
private StepAxis2Placement2D() : base( string.Empty ) { }
|
||||
|
||||
public StepAxis2Placement2D(
|
||||
string label,
|
||||
StepCartesianPoint location,
|
||||
StepDirection direction )
|
||||
: base( label )
|
||||
{
|
||||
Location = location;
|
||||
RefDirection = direction;
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.AxisPlacement2D;
|
||||
|
||||
internal static StepAxis2Placement2D CreateFromSyntaxList(
|
||||
StepBinder binder,
|
||||
ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
StepAxis2Placement2D axis = new StepAxis2Placement2D();
|
||||
enumerator.AssertEnumeratorCount( 3 );
|
||||
axis.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 1 ], v => axis.Location = v.AsType<StepCartesianPoint>() );
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 2 ], v => axis.RefDirection = v.AsType<StepDirection>() );
|
||||
return axis;
|
||||
}
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
yield return Location;
|
||||
yield return RefDirection;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepAxis2Placement3D.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepAxis2Placement3D : StepAxis2Placement
|
||||
{
|
||||
|
||||
private StepDirection _axis;
|
||||
|
||||
private StepAxis2Placement3D() : base( string.Empty ) { }
|
||||
|
||||
public StepAxis2Placement3D(
|
||||
string name,
|
||||
StepCartesianPoint location,
|
||||
StepDirection axis,
|
||||
StepDirection refDirection )
|
||||
: base( name )
|
||||
{
|
||||
Location = location;
|
||||
Axis = axis;
|
||||
RefDirection = refDirection;
|
||||
}
|
||||
|
||||
public StepDirection Axis
|
||||
{
|
||||
get { return _axis; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_axis = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.AxisPlacement3D;
|
||||
|
||||
internal static StepAxis2Placement3D CreateFromSyntaxList(
|
||||
StepBinder binder,
|
||||
ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
StepAxis2Placement3D axis = new StepAxis2Placement3D();
|
||||
enumerator.AssertEnumeratorCount( 4 );
|
||||
axis.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 1 ], v => axis.Location = v.AsType<StepCartesianPoint>() );
|
||||
binder.BindValue( syntaxList.Values[ 2 ], v => axis.Axis = v.AsType<StepDirection>() );
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 3 ], v => axis.RefDirection = v.AsType<StepDirection>() );
|
||||
return axis;
|
||||
}
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
yield return Location;
|
||||
yield return Axis;
|
||||
yield return RefDirection;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepBSplineCurve.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public enum StepBSplineCurveForm
|
||||
{
|
||||
|
||||
Polyline,
|
||||
CircularArc,
|
||||
EllipticalArc,
|
||||
ParabolicArc,
|
||||
HyperbolicArc,
|
||||
Unspecified
|
||||
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public abstract class StepBSplineCurve : StepBoundedCurve
|
||||
{
|
||||
|
||||
private const string CIRCULAR_ARC = "CIRCULAR_ARC";
|
||||
private const string ELLIPTIC_ARC = "ELLIPTIC_ARC";
|
||||
private const string HYPERBOLIC_ARC = "HYPERBOLIC_ARC";
|
||||
private const string PARABOLIC_ARC = "PARABOLIC_ARC";
|
||||
|
||||
private const string POLYLINE_FORM = "POLYLINE_FORM";
|
||||
private const string UNSPECIFIED = "UNSPECIFIED";
|
||||
|
||||
public StepBSplineCurve( string name, IEnumerable<StepCartesianPoint> controlPoints )
|
||||
: base( name )
|
||||
{
|
||||
ControlPointsList.AddRange( controlPoints );
|
||||
}
|
||||
|
||||
public StepBSplineCurve( string name, params StepCartesianPoint[] controlPoints )
|
||||
: this( name, ( IEnumerable<StepCartesianPoint> )controlPoints ) { }
|
||||
|
||||
public bool ClosedCurve { get; set; }
|
||||
|
||||
public bool SelfIntersect { get; set; }
|
||||
|
||||
public int Degree { get; set; }
|
||||
|
||||
public List<StepCartesianPoint> ControlPointsList { get; } = new List<StepCartesianPoint>();
|
||||
|
||||
public StepBSplineCurveForm CurveForm { get; set; } = StepBSplineCurveForm.Unspecified;
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
return ControlPointsList;
|
||||
}
|
||||
|
||||
protected static string GetCurveFormString( StepBSplineCurveForm form )
|
||||
{
|
||||
switch( form )
|
||||
{
|
||||
case StepBSplineCurveForm.Polyline:
|
||||
return POLYLINE_FORM;
|
||||
case StepBSplineCurveForm.CircularArc:
|
||||
return CIRCULAR_ARC;
|
||||
case StepBSplineCurveForm.EllipticalArc:
|
||||
return ELLIPTIC_ARC;
|
||||
case StepBSplineCurveForm.ParabolicArc:
|
||||
return PARABOLIC_ARC;
|
||||
case StepBSplineCurveForm.HyperbolicArc:
|
||||
return HYPERBOLIC_ARC;
|
||||
case StepBSplineCurveForm.Unspecified:
|
||||
return UNSPECIFIED;
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected static StepBSplineCurveForm ParseCurveForm( string enumerationValue )
|
||||
{
|
||||
switch( enumerationValue.ToUpperInvariant() )
|
||||
{
|
||||
case POLYLINE_FORM:
|
||||
return StepBSplineCurveForm.Polyline;
|
||||
case CIRCULAR_ARC:
|
||||
return StepBSplineCurveForm.CircularArc;
|
||||
case ELLIPTIC_ARC:
|
||||
return StepBSplineCurveForm.EllipticalArc;
|
||||
case PARABOLIC_ARC:
|
||||
return StepBSplineCurveForm.ParabolicArc;
|
||||
case HYPERBOLIC_ARC:
|
||||
return StepBSplineCurveForm.HyperbolicArc;
|
||||
default:
|
||||
return StepBSplineCurveForm.Unspecified;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepBSplineCurveWithKnots.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public enum StepKnotType
|
||||
{
|
||||
|
||||
UniformKnots,
|
||||
QuasiUniformKnots,
|
||||
PiecewiseBezierKnots,
|
||||
Unspecified
|
||||
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public class StepBSplineCurveWithKnots : StepBSplineCurve
|
||||
{
|
||||
|
||||
private const string PIECEWISE_BEZIER_KNOTS = "PIECEWISE_BEZIER_KNOTS";
|
||||
private const string QUASI_UNIFORM_KNOTS = "QUASI_UNIFORM_KNOTS";
|
||||
|
||||
private const string UNIFORM_KNOTS = "UNIFORM_KNOTS";
|
||||
private const string UNSPECIFIED = "UNSPECIFIED";
|
||||
|
||||
public StepBSplineCurveWithKnots(
|
||||
string name,
|
||||
IEnumerable<StepCartesianPoint> controlPoints )
|
||||
: base( name, controlPoints ) { }
|
||||
|
||||
public StepBSplineCurveWithKnots( string name, params StepCartesianPoint[] controlPoints )
|
||||
: base( name, controlPoints ) { }
|
||||
|
||||
public List<int> KnotMultiplicities { get; } = new List<int>();
|
||||
|
||||
public List<double> Knots { get; } = new List<double>();
|
||||
|
||||
public override StepItemType ItemType => StepItemType.BSplineCurveWithKnots;
|
||||
|
||||
public StepKnotType KnotSpec { get; set; } = StepKnotType.Unspecified;
|
||||
|
||||
internal static StepBSplineCurveWithKnots CreateFromSyntaxList(
|
||||
StepBinder binder,
|
||||
ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
enumerator.AssertEnumeratorCount( 9 );
|
||||
object controlPointsList = enumerator.Values[ 2 ].GetValueList();
|
||||
|
||||
StepBSplineCurveWithKnots spline = new StepBSplineCurveWithKnots(
|
||||
string.Empty, new StepCartesianPoint[controlPointsList.Values.Count] );
|
||||
spline.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
spline.Degree = ( enumerator.Values[ 1 ] as ExpIntNode )!.Value;
|
||||
|
||||
for( int i = 0; i < controlPointsList.Values.Count; i++ )
|
||||
{
|
||||
int j = i; // capture to avoid rebinding
|
||||
binder.BindValue(
|
||||
controlPointsList.Values[ j ],
|
||||
v => spline.ControlPointsList[ j ] = v.AsType<StepCartesianPoint>() );
|
||||
}
|
||||
|
||||
spline.CurveForm = ParseCurveForm( enumerator.Values[ 3 ].GetEnumerationValue() );
|
||||
spline.ClosedCurve = ( enumerator.Values[ 4 ] as ExpBoolNode )!.Value;
|
||||
spline.SelfIntersect = ( enumerator.Values[ 5 ]as ExpBoolNode )!.Value;
|
||||
|
||||
object knotMultiplicitiesList = enumerator.Values[ 6 ].GetValueList();
|
||||
spline.KnotMultiplicities.Clear();
|
||||
for( int i = 0; i < knotMultiplicitiesList.Values.Count; i++ ) {
|
||||
spline.KnotMultiplicities
|
||||
.Add( knotMultiplicitiesList.Values[ i ].GetIntegerValue() );
|
||||
}
|
||||
|
||||
object knotslist = enumerator.Values[ 7 ].GetValueList();
|
||||
spline.Knots.Clear();
|
||||
for( int i = 0; i < knotslist.Values.Count; i++ ) {
|
||||
spline.Knots.Add( knotslist.Values[ i ].GetRealVavlue() );
|
||||
}
|
||||
|
||||
spline.KnotSpec = ParseKnotSpec( enumerator.Values[ 8 ].GetEnumerationValue() );
|
||||
|
||||
return spline;
|
||||
}
|
||||
|
||||
private static string GetKnotSpec( StepKnotType spec )
|
||||
{
|
||||
switch( spec )
|
||||
{
|
||||
case StepKnotType.UniformKnots:
|
||||
return UNIFORM_KNOTS;
|
||||
case StepKnotType.QuasiUniformKnots:
|
||||
return QUASI_UNIFORM_KNOTS;
|
||||
case StepKnotType.PiecewiseBezierKnots:
|
||||
return PIECEWISE_BEZIER_KNOTS;
|
||||
case StepKnotType.Unspecified:
|
||||
return UNSPECIFIED;
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private static StepKnotType ParseKnotSpec( string enumerationValue )
|
||||
{
|
||||
switch( enumerationValue.ToUpperInvariant() )
|
||||
{
|
||||
case UNIFORM_KNOTS:
|
||||
return StepKnotType.UniformKnots;
|
||||
case QUASI_UNIFORM_KNOTS:
|
||||
return StepKnotType.QuasiUniformKnots;
|
||||
case PIECEWISE_BEZIER_KNOTS:
|
||||
return StepKnotType.PiecewiseBezierKnots;
|
||||
default:
|
||||
return StepKnotType.Unspecified;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepBoundedCurve.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepBoundedCurve : StepCurve
|
||||
{
|
||||
|
||||
protected StepBoundedCurve( string name ) : base( name ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepCartesianPoint.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepCartesianPoint : StepTriple
|
||||
{
|
||||
|
||||
private StepCartesianPoint() { }
|
||||
|
||||
public StepCartesianPoint( string label, float x, float y, float z )
|
||||
: base( label, x, y, z ) { }
|
||||
|
||||
public override StepItemType ItemType => StepItemType.CartesianPoint;
|
||||
|
||||
protected override int MinimumValueCount => 1;
|
||||
|
||||
internal static StepCartesianPoint CreateFromSyntaxList( ExpNode syntaxList )
|
||||
{
|
||||
return ( StepCartesianPoint )AssignTo( new StepCartesianPoint(), syntaxList );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepCircle.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepCircle : StepConic
|
||||
{
|
||||
|
||||
private StepAxis2Placement _position;
|
||||
|
||||
private StepCircle() : base( string.Empty ) { }
|
||||
|
||||
public StepCircle( string label, StepAxis2Placement position, float radius )
|
||||
: base( label )
|
||||
{
|
||||
Position = position;
|
||||
Radius = radius;
|
||||
}
|
||||
|
||||
public float Radius { get; set; }
|
||||
|
||||
public StepAxis2Placement Position
|
||||
{
|
||||
get { return _position; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_position = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.Circle;
|
||||
|
||||
internal static StepCircle CreateFromSyntaxList( StepBinder binder, ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
StepCircle circle = new StepCircle();
|
||||
enumerator.AssertEnumeratorCount( 3 );
|
||||
circle.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 1 ], v => circle.Position = v.AsType<StepAxis2Placement>() );
|
||||
circle.Radius = ( enumerator.Values[ 2 ]as ExpRealNumberNode )!.Value;
|
||||
return circle;
|
||||
}
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
yield return Position;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepConic.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepConic : StepCurve
|
||||
{
|
||||
|
||||
protected StepConic( string name ) : base( name ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepCurve.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepCurve : StepGeometricRepresentationItem
|
||||
{
|
||||
|
||||
protected StepCurve( string name ) : base( name ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepCylindricalSurface.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.Collections.Generic;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepCylindricalSurface : StepElementarySurface
|
||||
{
|
||||
|
||||
private StepCylindricalSurface() : base() { }
|
||||
|
||||
public StepCylindricalSurface( string name, StepAxis2Placement3D position, float radius )
|
||||
: base( name, position )
|
||||
{
|
||||
Radius = radius;
|
||||
}
|
||||
|
||||
public float Radius { get; set; }
|
||||
|
||||
public override StepItemType ItemType => StepItemType.CylindricalSurface;
|
||||
|
||||
internal static StepRepresentationItem CreateFromSyntaxList(
|
||||
StepBinder binder,
|
||||
ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
enumerator.AssertEnumeratorCount( 3 );
|
||||
StepCylindricalSurface surface = new StepCylindricalSurface();
|
||||
surface.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 1 ], v => surface.Position = v.AsType<StepAxis2Placement3D>() );
|
||||
surface.Radius = ( enumerator.Values[ 2 ]as ExpRealNumberNode )!.Value;
|
||||
return surface;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepDirection.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepDirection : StepTriple
|
||||
{
|
||||
|
||||
private StepDirection() { }
|
||||
|
||||
public StepDirection( string name, float x, float y, float z ) : base( name, x, y, z ) { }
|
||||
|
||||
public override StepItemType ItemType => StepItemType.Direction;
|
||||
|
||||
protected override int MinimumValueCount => 2;
|
||||
|
||||
internal static StepDirection CreateFromSyntaxList( ExpNode syntaxList )
|
||||
{
|
||||
return ( StepDirection )AssignTo( new StepDirection(), syntaxList );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepEdge.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.Collections.Generic;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepEdge : StepTopologicalRepresentationItem
|
||||
{
|
||||
|
||||
protected StepEdge() : base( string.Empty ) { }
|
||||
|
||||
protected StepEdge( string name, StepVertex edgeStart, StepVertex edgeEnd )
|
||||
: base( name )
|
||||
{
|
||||
EdgeStart = edgeStart;
|
||||
EdgeEnd = edgeEnd;
|
||||
}
|
||||
|
||||
public StepVertex EdgeStart { get; set; }
|
||||
|
||||
public StepVertex EdgeEnd { get; set; }
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
if( EdgeStart != null ) {
|
||||
yield return EdgeStart;
|
||||
}
|
||||
|
||||
if( EdgeEnd != null ) {
|
||||
yield return EdgeEnd;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepEdgeCurve.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepEdgeCurve : StepEdge
|
||||
{
|
||||
|
||||
private StepCurve _edgeGeometry;
|
||||
|
||||
private StepEdgeCurve() : base() { }
|
||||
|
||||
public StepEdgeCurve(
|
||||
string name,
|
||||
StepVertex edgeStart,
|
||||
StepVertex edgeEnd,
|
||||
StepCurve edgeGeometry,
|
||||
bool isSameSense )
|
||||
: base( name, edgeStart, edgeEnd )
|
||||
{
|
||||
EdgeGeometry = edgeGeometry;
|
||||
IsSameSense = isSameSense;
|
||||
}
|
||||
|
||||
public bool IsSameSense { get; set; }
|
||||
|
||||
public StepCurve EdgeGeometry
|
||||
{
|
||||
get { return _edgeGeometry; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_edgeGeometry = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.EdgeCurve;
|
||||
|
||||
internal static StepEdgeCurve CreateFromSyntaxList( StepBinder binder, ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
StepEdgeCurve edgeCurve = new StepEdgeCurve();
|
||||
enumerator.AssertEnumeratorCount( 5 );
|
||||
edgeCurve.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 1 ], v => edgeCurve.EdgeStart = v.AsType<StepVertex>() );
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 2 ], v => edgeCurve.EdgeEnd = v.AsType<StepVertex>() );
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 3 ], v => edgeCurve.EdgeGeometry = v.AsType<StepCurve>() );
|
||||
edgeCurve.IsSameSense = ( enumerator.Values[ 4 ]as ExpBoolNode )!.Value;
|
||||
return edgeCurve;
|
||||
}
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
foreach( StepRepresentationItem item in base.GetReferencedItems() ) {
|
||||
yield return item;
|
||||
}
|
||||
|
||||
yield return EdgeGeometry;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepEdgeLoop.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.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepEdgeLoop : StepLoop
|
||||
{
|
||||
|
||||
public StepEdgeLoop( string name, IEnumerable<StepOrientedEdge> edgeList )
|
||||
: base( name )
|
||||
{
|
||||
EdgeList = new List<StepOrientedEdge>( edgeList );
|
||||
}
|
||||
|
||||
public StepEdgeLoop( string name, params StepOrientedEdge[] edgeList )
|
||||
: this( name, ( IEnumerable<StepOrientedEdge> )edgeList ) { }
|
||||
|
||||
public List<StepOrientedEdge> EdgeList { get; private set; }
|
||||
|
||||
public override StepItemType ItemType => StepItemType.EdgeLoop;
|
||||
|
||||
internal static StepEdgeLoop CreateFromSyntaxList( StepBinder binder, ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
enumerator.AssertEnumeratorCount( 2 );
|
||||
object edgeSyntaxList = enumerator.Values[ 1 ].GetValueList();
|
||||
StepEdgeLoop edgeLoop = new StepEdgeLoop(
|
||||
string.Empty, new StepOrientedEdge[edgeSyntaxList.Values.Count] );
|
||||
edgeLoop.Name = enumerator.Values[ 0 ].GetStringValue();
|
||||
for( int i = 0; i < edgeSyntaxList.Values.Count; i++ )
|
||||
{
|
||||
int j = i; // capture to avoid rebinding
|
||||
binder.BindValue(
|
||||
edgeSyntaxList.Values[ j ],
|
||||
v => edgeLoop.EdgeList[ j ] = v.AsType<StepOrientedEdge>() );
|
||||
}
|
||||
|
||||
return edgeLoop;
|
||||
}
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
return EdgeList;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepElementarySurface.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepElementarySurface : StepSurface
|
||||
{
|
||||
|
||||
private StepAxis2Placement3D _position;
|
||||
|
||||
protected StepElementarySurface() : base( string.Empty ) { }
|
||||
|
||||
public StepElementarySurface( string name, StepAxis2Placement3D position )
|
||||
: base( name )
|
||||
{
|
||||
Position = position;
|
||||
}
|
||||
|
||||
public StepAxis2Placement3D Position
|
||||
{
|
||||
get { return _position; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_position = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
yield return Position;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepEllipse.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepEllipse : StepConic
|
||||
{
|
||||
|
||||
private StepAxis2Placement _position;
|
||||
|
||||
private StepEllipse() : base( string.Empty ) { }
|
||||
|
||||
public StepEllipse(
|
||||
string name,
|
||||
StepAxis2Placement position,
|
||||
double semiAxis1,
|
||||
double semiAxis2 )
|
||||
: base( name )
|
||||
{
|
||||
Position = position;
|
||||
SemiAxis1 = semiAxis1;
|
||||
SemiAxis2 = semiAxis2;
|
||||
}
|
||||
|
||||
public double SemiAxis1 { get; set; }
|
||||
|
||||
public double SemiAxis2 { get; set; }
|
||||
|
||||
public StepAxis2Placement Position
|
||||
{
|
||||
get { return _position; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_position = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.Ellipse;
|
||||
|
||||
internal static StepEllipse CreateFromSyntaxList( StepBinder binder, ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
StepEllipse ellipse = new StepEllipse();
|
||||
enumerator.AssertEnumeratorCount( 4 );
|
||||
ellipse.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 1 ], v => ellipse.Position = v.AsType<StepAxis2Placement>() );
|
||||
ellipse.SemiAxis1 = ( enumerator.Values[ 2 ] as ExpRealNumberNode )!.Value;
|
||||
ellipse.SemiAxis2 = ( enumerator.Values[ 3 ] as ExpRealNumberNode )!.Value;
|
||||
return ellipse;
|
||||
}
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
yield return Position;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepFace.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.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepFace : StepTopologicalRepresentationItem
|
||||
{
|
||||
|
||||
public StepFace( string name ) : base( name ) { }
|
||||
|
||||
public List<StepFaceBound> Bounds { get; } = new List<StepFaceBound>();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepFaceBound.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.Collections.Generic;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepFaceBound : StepTopologicalRepresentationItem
|
||||
{
|
||||
|
||||
protected StepFaceBound() : base( string.Empty ) { }
|
||||
|
||||
public StepFaceBound( string name, StepLoop bound, bool orientation )
|
||||
: base( name )
|
||||
{
|
||||
Bound = bound;
|
||||
Orientation = orientation;
|
||||
}
|
||||
|
||||
public bool Orientation { get; set; }
|
||||
|
||||
public override StepItemType ItemType => StepItemType.FaceBound;
|
||||
|
||||
public StepLoop Bound { get; set; }
|
||||
|
||||
internal static StepFaceBound CreateFromSyntaxList( StepBinder binder, ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
enumerator.AssertEnumeratorCount( 3 );
|
||||
StepFaceBound faceBound = new StepFaceBound();
|
||||
faceBound.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue( enumerator.Values[ 1 ], v => faceBound.Bound = v.AsType<StepLoop>() );
|
||||
faceBound.Orientation = ( enumerator.Values[ 2 ]as ExpBoolNode )!.Value;
|
||||
return faceBound;
|
||||
}
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
yield return Bound;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepFaceOuterBound.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepFaceOuterBound : StepFaceBound
|
||||
{
|
||||
|
||||
private StepFaceOuterBound() : base() { }
|
||||
|
||||
public StepFaceOuterBound( string name, StepLoop bound, bool orientation )
|
||||
: base( name, bound, orientation ) { }
|
||||
|
||||
public override StepItemType ItemType => StepItemType.FaceOuterBound;
|
||||
|
||||
internal static new StepFaceOuterBound CreateFromSyntaxList(
|
||||
StepBinder binder,
|
||||
ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
enumerator.AssertEnumeratorCount( 3 );
|
||||
StepFaceOuterBound faceOuterBound = new StepFaceOuterBound();
|
||||
faceOuterBound.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 1 ], v => faceOuterBound.Bound = v.AsType<StepLoop>() );
|
||||
faceOuterBound.Orientation = ( enumerator.Values[ 2 ]as ExpBoolNode )!.Value;
|
||||
return faceOuterBound;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepFaceSurface.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.Collections.Generic;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepFaceSurface : StepFace
|
||||
{
|
||||
|
||||
public StepFaceSurface( string name ) : base( name ) { }
|
||||
|
||||
public bool SameSense { get; set; }
|
||||
|
||||
public StepSurface FaceGeometry { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepGeometricRepresentationItem.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepGeometricRepresentationItem : StepRepresentationItem
|
||||
{
|
||||
|
||||
protected StepGeometricRepresentationItem( string name ) : base( name ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepItemType.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public enum StepItemType
|
||||
{
|
||||
|
||||
AdvancedFace,
|
||||
AxisPlacement2D,
|
||||
AxisPlacement3D,
|
||||
BSplineCurveWithKnots,
|
||||
CartesianPoint,
|
||||
Circle,
|
||||
CylindricalSurface,
|
||||
Direction,
|
||||
EdgeCurve,
|
||||
EdgeLoop,
|
||||
Ellipse,
|
||||
FaceBound,
|
||||
FaceOuterBound,
|
||||
Line,
|
||||
OrientedEdge,
|
||||
Plane,
|
||||
Vector,
|
||||
VertexPoint
|
||||
|
||||
}
|
||||
|
||||
internal static class StepItemTypeExtensions
|
||||
{
|
||||
|
||||
public const string AdvancedFaceText = "ADVANCED_FACE";
|
||||
public const string Axis2Placement2DText = "AXIS2_PLACEMENT_2D";
|
||||
public const string Axis2Placement3DText = "AXIS2_PLACEMENT_3D";
|
||||
public const string BSplineCurveWithKnotsText = "B_SPLINE_CURVE_WITH_KNOTS";
|
||||
public const string CartesianPointText = "CARTESIAN_POINT";
|
||||
public const string CircleText = "CIRCLE";
|
||||
public const string CylindricalSurfaceText = "CYLINDRICAL_SURFACE";
|
||||
public const string DirectionText = "DIRECTION";
|
||||
public const string EdgeCurveText = "EDGE_CURVE";
|
||||
public const string EdgeLoopText = "EDGE_LOOP";
|
||||
public const string EllipseText = "ELLIPSE";
|
||||
public const string FaceBoundText = "FACE_BOUND";
|
||||
public const string FaceOuterBoundText = "FACE_OUTER_BOUND";
|
||||
public const string LineText = "LINE";
|
||||
public const string OrientedEdgeText = "ORIENTED_EDGE";
|
||||
public const string PlaneText = "PLANE";
|
||||
public const string VectorText = "VECTOR";
|
||||
public const string VertexPointText = "VERTEX_POINT";
|
||||
|
||||
public static string GetItemTypeString( this StepItemType type )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
case StepItemType.AdvancedFace:
|
||||
return AdvancedFaceText;
|
||||
case StepItemType.AxisPlacement2D:
|
||||
return Axis2Placement2DText;
|
||||
case StepItemType.AxisPlacement3D:
|
||||
return Axis2Placement3DText;
|
||||
case StepItemType.BSplineCurveWithKnots:
|
||||
return BSplineCurveWithKnotsText;
|
||||
case StepItemType.CartesianPoint:
|
||||
return CartesianPointText;
|
||||
case StepItemType.Circle:
|
||||
return CircleText;
|
||||
case StepItemType.CylindricalSurface:
|
||||
return CylindricalSurfaceText;
|
||||
case StepItemType.Direction:
|
||||
return DirectionText;
|
||||
case StepItemType.EdgeCurve:
|
||||
return EdgeCurveText;
|
||||
case StepItemType.EdgeLoop:
|
||||
return EdgeLoopText;
|
||||
case StepItemType.Ellipse:
|
||||
return EllipseText;
|
||||
case StepItemType.FaceBound:
|
||||
return FaceBoundText;
|
||||
case StepItemType.FaceOuterBound:
|
||||
return FaceOuterBoundText;
|
||||
case StepItemType.Line:
|
||||
return LineText;
|
||||
case StepItemType.OrientedEdge:
|
||||
return OrientedEdgeText;
|
||||
case StepItemType.Plane:
|
||||
return PlaneText;
|
||||
case StepItemType.Vector:
|
||||
return VectorText;
|
||||
case StepItemType.VertexPoint:
|
||||
return VertexPointText;
|
||||
default:
|
||||
throw new InvalidOperationException( $"Unexpected item type {type}" );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepLine.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.Math;
|
||||
using StgSharp.Script;
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepLine : StepCurve
|
||||
{
|
||||
|
||||
private StepCartesianPoint _point;
|
||||
private StepVector _vector;
|
||||
|
||||
private StepLine() : base( string.Empty ) { }
|
||||
|
||||
public StepLine( string label, StepCartesianPoint point, StepVector vector )
|
||||
: base( label )
|
||||
{
|
||||
Point = point;
|
||||
Vector = vector;
|
||||
}
|
||||
|
||||
public StepCartesianPoint Point
|
||||
{
|
||||
get { return _point; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_point = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.Line;
|
||||
|
||||
public StepVector Vector
|
||||
{
|
||||
get { return _vector; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_vector = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static StepLine FromPoints(
|
||||
float x1,
|
||||
float y1,
|
||||
float z1,
|
||||
float x2,
|
||||
float y2,
|
||||
float z2 )
|
||||
{
|
||||
StepCartesianPoint start = new StepCartesianPoint( string.Empty, x1, y1, z1 );
|
||||
float dx = x2 - x1;
|
||||
float dy = y2 - y1;
|
||||
float dz = z2 - z1;
|
||||
float length = Scaler.Sqrt( dx * dx + dy * dy + dz * dz );
|
||||
float dxn = dx / length;
|
||||
float dyn = dy / length;
|
||||
float dzn = dz / length;
|
||||
StepVector vector = new StepVector(
|
||||
string.Empty, new StepDirection( string.Empty, dxn, dyn, dzn ), length );
|
||||
return new StepLine( string.Empty, start, vector );
|
||||
}
|
||||
|
||||
internal static StepLine CreateFromSyntaxList( StepBinder binder, ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
StepLine line = new StepLine();
|
||||
enumerator.AssertEnumeratorCount( 3 );
|
||||
line.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 1 ], v => line.Point = v.AsType<StepCartesianPoint>() );
|
||||
binder.BindValue( enumerator.Values[ 2 ], v => line.Vector = v.AsType<StepVector>() );
|
||||
return line;
|
||||
}
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
yield return Point;
|
||||
yield return Vector;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepLoop.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepLoop : StepTopologicalRepresentationItem
|
||||
{
|
||||
|
||||
public StepLoop( string name ) : base( name ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepOrientedEdge.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepOrientedEdge : StepEdge
|
||||
{
|
||||
|
||||
private StepEdge _edgeElement;
|
||||
|
||||
private StepOrientedEdge() { }
|
||||
|
||||
public StepOrientedEdge(
|
||||
string name,
|
||||
StepVertex edgeStart,
|
||||
StepVertex edgeEnd,
|
||||
StepEdge edgeElement,
|
||||
bool orientation )
|
||||
: base( name, edgeStart, edgeEnd )
|
||||
{
|
||||
EdgeElement = edgeElement;
|
||||
Orientation = orientation;
|
||||
}
|
||||
|
||||
public bool Orientation { get; set; }
|
||||
|
||||
public StepEdge EdgeElement
|
||||
{
|
||||
get { return _edgeElement; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_edgeElement = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.OrientedEdge;
|
||||
|
||||
internal static StepOrientedEdge CreateFromSyntaxList(
|
||||
StepBinder binder,
|
||||
ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
StepOrientedEdge orientedEdge = new StepOrientedEdge();
|
||||
enumerator.AssertEnumeratorCount( 5 );
|
||||
orientedEdge.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 1 ], v => orientedEdge.EdgeStart = v.AsType<StepVertex>() );
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 2 ], v => orientedEdge.EdgeEnd = v.AsType<StepVertex>() );
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 3 ], v => orientedEdge.EdgeElement = v.AsType<StepEdge>() );
|
||||
orientedEdge.Orientation = ( enumerator.Values[ 4 ]as ExpBoolNode )!.Value;
|
||||
return orientedEdge;
|
||||
}
|
||||
|
||||
internal override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
foreach( StepRepresentationItem item in base.GetReferencedItems() ) {
|
||||
yield return item;
|
||||
}
|
||||
|
||||
yield return EdgeElement;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepPlacement.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepPlacement : StepGeometricRepresentationItem
|
||||
{
|
||||
|
||||
protected StepPlacement( string name ) : base( name ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepPlane.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepPlane : StepElementarySurface
|
||||
{
|
||||
|
||||
private StepPlane() : base() { }
|
||||
|
||||
public StepPlane( string name, StepAxis2Placement3D position ) : base( name, position ) { }
|
||||
|
||||
public override StepItemType ItemType => StepItemType.Plane;
|
||||
|
||||
internal static StepPlane CreateFromSyntaxList( StepBinder binder, ExpNode syntaxList )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = new ExpNodeNextEnumerator( syntaxList );
|
||||
StepPlane plane = new StepPlane();
|
||||
enumerator.AssertEnumeratorCount( 2 );
|
||||
plane.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
binder.BindValue(
|
||||
enumerator.Values[ 1 ], v => plane.Position = v.AsType<StepAxis2Placement3D>() );
|
||||
return plane;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepPoint.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepPoint : StepGeometricRepresentationItem
|
||||
{
|
||||
|
||||
protected StepPoint( string name ) : base( name ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepRepresentationItem.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.Collections.Generic;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract partial class StepRepresentationItem
|
||||
{
|
||||
|
||||
protected StepRepresentationItem( string name )
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public abstract StepItemType ItemType { get; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
internal virtual IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepRepresentationItem_FromTypedParameter.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.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract partial class StepRepresentationItem
|
||||
{
|
||||
|
||||
internal static HashSet<string> UnsupportedItemTypes { get; } = new HashSet<string>();
|
||||
|
||||
internal static StepRepresentationItem FromTypedParameter(
|
||||
StepBinder binder,
|
||||
ExpNode itemSyntax )
|
||||
{
|
||||
StepRepresentationItem item = null!;
|
||||
if( itemSyntax is ExpElementInitializingNode initNode )
|
||||
{
|
||||
string name = initNode.EqualityTypeConvert.Name;
|
||||
switch( name )
|
||||
{
|
||||
case StepItemTypeExtensions.AdvancedFaceText:
|
||||
item = StepAdvancedFace.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.Axis2Placement2DText:
|
||||
item = StepAxis2Placement2D.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.Axis2Placement3DText:
|
||||
item = StepAxis2Placement3D.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.BSplineCurveWithKnotsText:
|
||||
item = StepBSplineCurveWithKnots.CreateFromSyntaxList(
|
||||
binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.CartesianPointText:
|
||||
item = StepCartesianPoint.CreateFromSyntaxList( initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.CircleText:
|
||||
item = StepCircle.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.CylindricalSurfaceText:
|
||||
item = StepCylindricalSurface.CreateFromSyntaxList( binder,
|
||||
initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.DirectionText:
|
||||
item = StepDirection.CreateFromSyntaxList( initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.EdgeCurveText:
|
||||
item = StepEdgeCurve.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.EdgeLoopText:
|
||||
item = StepEdgeLoop.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.EllipseText:
|
||||
item = StepEllipse.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.FaceBoundText:
|
||||
item = StepFaceBound.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.FaceOuterBoundText:
|
||||
item = StepFaceOuterBound.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.LineText:
|
||||
item = StepLine.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.OrientedEdgeText:
|
||||
item = StepOrientedEdge.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.PlaneText:
|
||||
item = StepPlane.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.VectorText:
|
||||
item = StepVector.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
case StepItemTypeExtensions.VertexPointText:
|
||||
item = StepVertexPoint.CreateFromSyntaxList( binder, initNode.Right );
|
||||
break;
|
||||
default:
|
||||
if( UnsupportedItemTypes.Add( name ) ) {
|
||||
Debug.WriteLine(
|
||||
$"Unsupported item {name} at {initNode.Line}, {initNode.Column}" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else
|
||||
{
|
||||
// TODO:
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepSurface.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepSurface : StepGeometricRepresentationItem
|
||||
{
|
||||
|
||||
public StepSurface( string name ) : base( name ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepTopologicalRepresentationItem.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepTopologicalRepresentationItem : StepRepresentationItem
|
||||
{
|
||||
|
||||
protected StepTopologicalRepresentationItem( string name ) : base( name ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepTriple.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.Math;
|
||||
|
||||
using StgSharp.Script;
|
||||
using StgSharp.Script.Express;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepTriple : StepPoint
|
||||
{
|
||||
|
||||
private Vec3 _coord;
|
||||
|
||||
protected StepTriple() : this( string.Empty, 0.0f, 0.0f, 0.0f ) { }
|
||||
|
||||
protected StepTriple( string name, float x, float y, float z )
|
||||
: base( name )
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
public float X
|
||||
{
|
||||
get => _coord.X;
|
||||
set => _coord.X = value;
|
||||
}
|
||||
|
||||
public float Y
|
||||
{
|
||||
get => _coord.Y;
|
||||
set => _coord.Y = value;
|
||||
}
|
||||
|
||||
public float Z
|
||||
{
|
||||
get => _coord.Z;
|
||||
set => _coord.Z = value;
|
||||
}
|
||||
|
||||
protected abstract int MinimumValueCount { get; }
|
||||
|
||||
public bool Equals( StepTriple other )
|
||||
{
|
||||
if( ( object )other == null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ItemType == other.ItemType && X == other.X && Y == other.Y && Z == other.Z && Name ==
|
||||
other.Name;
|
||||
}
|
||||
|
||||
public override bool Equals( object obj )
|
||||
{
|
||||
return ( obj is StepTriple triple ) && Equals( triple );
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode();
|
||||
}
|
||||
|
||||
internal static StepTriple AssignTo( StepTriple triple, ExpNode values )
|
||||
{
|
||||
ExpNodeNextEnumerator enumerator = values.GetEnumerator();
|
||||
enumerator.AssertEnumeratorCount( 2 );
|
||||
triple.Name = enumerator.Values[ 0 ].CodeConvertTemplate;
|
||||
object pointValues = enumerator.Values[ 1 ].GetValueList();
|
||||
pointValues.AssertEnumeratorCount( triple.MinimumValueCount, 3 );
|
||||
triple.X = pointValues.GetRealValueOrDefault( 0 );
|
||||
triple.Y = pointValues.GetRealValueOrDefault( 1 );
|
||||
triple.Z = pointValues.GetRealValueOrDefault( 2 );
|
||||
return triple;
|
||||
}
|
||||
|
||||
public static bool operator !=( StepTriple left, StepTriple right )
|
||||
{
|
||||
return !( left == right );
|
||||
}
|
||||
|
||||
public static bool operator ==( StepTriple left, StepTriple right )
|
||||
{
|
||||
if( ReferenceEquals( left, right ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if( ( object )left == null || ( object )right == null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return left.Equals( right );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepVector.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepVector : StepGeometricRepresentationItem
|
||||
{
|
||||
|
||||
private StepDirection _direction;
|
||||
|
||||
private StepVector() : base( string.Empty ) { }
|
||||
|
||||
public StepVector( string name, StepDirection direction, double length )
|
||||
: base( name )
|
||||
{
|
||||
Direction = direction;
|
||||
Length = length;
|
||||
}
|
||||
|
||||
public double Length { get; set; }
|
||||
|
||||
public StepDirection Direction
|
||||
{
|
||||
get { return _direction; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_direction = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.Vector;
|
||||
|
||||
internal static StepVector CreateFromSyntaxList( StepBinder binder, ExpNode syntaxList )
|
||||
{
|
||||
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 override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
yield return Direction;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepVertex.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public abstract class StepVertex : StepTopologicalRepresentationItem
|
||||
{
|
||||
|
||||
protected StepVertex( string name ) : base( name ) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StepVertexPoint.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;
|
||||
|
||||
namespace StgSharp.Modeling.Items
|
||||
{
|
||||
public class StepVertexPoint : StepVertex
|
||||
{
|
||||
|
||||
private StepCartesianPoint _location;
|
||||
|
||||
private StepVertexPoint() : base( string.Empty ) { }
|
||||
|
||||
public StepVertexPoint( string name, StepCartesianPoint location )
|
||||
: base( name )
|
||||
{
|
||||
Location = location;
|
||||
}
|
||||
|
||||
public StepCartesianPoint Location
|
||||
{
|
||||
get { return _location; }
|
||||
set
|
||||
{
|
||||
if( value == null ) {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
_location = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override StepItemType ItemType => StepItemType.VertexPoint;
|
||||
|
||||
internal static StepVertexPoint CreateFromSyntaxList(
|
||||
StepBinder binder,
|
||||
ExpNode syntaxList )
|
||||
{
|
||||
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 override IEnumerable<StepRepresentationItem> GetReferencedItems()
|
||||
{
|
||||
yield return Location;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user