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:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,62 @@
|
||||
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(517,5): warning MSB8004: Output 目录未以斜杠结尾。 此生成实例将添加斜杠,因为必须有这个斜杠才能正确计算 Output 目录。
|
||||
StgSharpC.c
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\StgSharpC.c(14,30): warning C4244: “函数”: 从“uint64_t”转换到“GLuint”,可能丢失数据
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\StgSharpC.c(16,43): warning C4244: “函数”: 从“uint64_t”转换到“GLuint”,可能丢失数据
|
||||
mat4.c
|
||||
string.c
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\string.c(21,54): warning C4267: “return”: 从“size_t”转换到“int”,可能丢失数据
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(9,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\string.c(36,54): warning C4267: “return”: 从“size_t”转换到“int”,可能丢失数据
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(9,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(11,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(11,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(20,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(20,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(22,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(22,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(24,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(24,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(26,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(26,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(36,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(36,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(38,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(38,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(40,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(40,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(42,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(42,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(51,54): warning C4028: 形参 1 与声明不同
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(51,84): warning C4028: 形参 2 与声明不同
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(53,22): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(54,22): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(55,22): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(56,22): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(59,28): warning C4013: “det_mat3_internal”未定义;假设外部返回 int
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(59,28): warning C4244: “函数”: 从“int”转换到“float”,可能丢失数据
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(59,62): warning C4244: “函数”: 从“int”转换到“float”,可能丢失数据
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(60,28): warning C4244: “函数”: 从“int”转换到“float”,可能丢失数据
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(60,62): warning C4244: “函数”: 从“int”转换到“float”,可能丢失数据
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(61,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(69,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(69,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(70,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(70,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(71,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(71,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(72,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(72,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(77,38): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(77,63): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(78,38): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(78,63): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(88,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(88,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(89,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(89,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(90,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(90,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(91,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(91,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(96,38): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(96,63): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(97,38): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(97,63): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
|
||||
StgSharpC.vcxproj -> D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\build\StgSharp.C.dll
|
||||
|
||||
@@ -1031,7 +1031,7 @@ $LN3:
|
||||
00051 62 f1 7c 48 11
|
||||
00 vmovups ZMMWORD PTR [rax], zmm0
|
||||
|
||||
; 103 : }
|
||||
; 103 : }
|
||||
|
||||
00057 48 8d a5 c8 00
|
||||
00 00 lea rsp, QWORD PTR [rbp+200]
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -32,42 +32,34 @@ using StgSharp.HighPerformance;
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace StgSharp.Data
|
||||
{
|
||||
public class RandomGenerator
|
||||
public unsafe class RandomGenerator
|
||||
{
|
||||
|
||||
private byte[] currentKey;
|
||||
|
||||
private readonly byte[] originKey;
|
||||
private int cycleCount;
|
||||
private SHA512 hash;
|
||||
|
||||
public RandomGenerator() : this( DateTime.UtcNow.ToBinary() ) { }
|
||||
|
||||
public RandomGenerator( object source )
|
||||
{
|
||||
try {
|
||||
if( source == null ) {
|
||||
throw new ArgumentNullException( nameof( source ) );
|
||||
}
|
||||
XmlSerializer s = new XmlSerializer( source.GetType() );
|
||||
using( StringWriter sw = new StringWriter() ) {
|
||||
s.Serialize( sw, source );
|
||||
string data = sw.ToString();
|
||||
originKey = Encoding.UTF8.GetBytes( data );
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull( source );
|
||||
XmlSerializer s = new XmlSerializer( source.GetType() );
|
||||
using( StringWriter sw = new StringWriter() )
|
||||
{
|
||||
s.Serialize( sw, source );
|
||||
string data = sw.ToString();
|
||||
originKey = Encoding.Unicode.GetBytes( data );
|
||||
}
|
||||
catch( Exception ) {
|
||||
throw;
|
||||
currentKey = [0,0,0,0];
|
||||
fixed( byte* o = originKey, c = currentKey ) {
|
||||
*( int* )c = UnsafeCompute.CityHashSimplify( ( char* )o, 0, originKey.Length / 2 );
|
||||
}
|
||||
hash = SHA512.Create();
|
||||
originKey = hash.ComputeHash( originKey );
|
||||
currentKey = originKey;
|
||||
cycleCount = 0;
|
||||
}
|
||||
|
||||
@@ -78,53 +70,45 @@ namespace StgSharp.Data
|
||||
|
||||
public unsafe int GenRandomInt()
|
||||
{
|
||||
M128 source = PrivateRand();
|
||||
uint source = PrivateRand();
|
||||
cycleCount++;
|
||||
|
||||
/*
|
||||
float d0 = MathF.Sin(1 / source.Read<float>(0));
|
||||
float d1 = MathF.Sin(1 / source.Read<float>(1));
|
||||
float d2 = MathF.Sin(1 / source.Read<float>(2));
|
||||
float d3 = MathF.Sin(1 / source.Read<float>(3));
|
||||
|
||||
source.Write<short>(0, *( short*)&d3);
|
||||
source.Write<short>(2, *((short*)&d2+1));
|
||||
source.Write<short>(4, *( short*)&d1);
|
||||
source.Write<short>(6, *((short*)&d0+1));
|
||||
|
||||
/**/
|
||||
|
||||
return source.Read<int>( cycleCount % 4 );
|
||||
M64 m = new M64();
|
||||
m.Write<uint>( 0, source );
|
||||
m.Write<uint>( 1, source );
|
||||
return ( m << ( cycleCount % 32 ) ).Read<int>( 1 );
|
||||
}
|
||||
|
||||
public byte GenRandomInt8()
|
||||
{
|
||||
cycleCount++;
|
||||
if( cycleCount % 64 == 0 ) {
|
||||
if( cycleCount % 4 == 0 ) {
|
||||
PrivateRand();
|
||||
}
|
||||
return currentKey[ cycleCount % 64 ];
|
||||
return currentKey[ cycleCount % 4 ];
|
||||
}
|
||||
|
||||
public float GenRandomSingle()
|
||||
{
|
||||
cycleCount++;
|
||||
|
||||
while( true ) {
|
||||
M128 source = PrivateRand();
|
||||
|
||||
while( true )
|
||||
{
|
||||
uint
|
||||
temp0 = source.Read<uint>( 0 ),
|
||||
temp1 = source.Read<uint>( 2 );
|
||||
temp0 = PrivateRand(),
|
||||
temp1 = PrivateRand();
|
||||
|
||||
if( temp0 * temp1 != 0 ) {
|
||||
if( temp0 * temp1 != 0 )
|
||||
{
|
||||
float ret = ( ( temp0 % temp1 ) * 1.0f ) / temp1;
|
||||
if( ret < 0.335f ) {
|
||||
if( ret < 0.335f )
|
||||
{
|
||||
ret = ret * ( ( ret * ( -0.7811934f ) ) + 1.4489113f );
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
ret = ( ret * ( ( ret * ( -0.1158368f ) ) + 1.0580600f ) ) + 0.0590584f;
|
||||
}
|
||||
if( ret > 1 ) {
|
||||
if( ret > 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
return ret;
|
||||
@@ -138,27 +122,14 @@ namespace StgSharp.Data
|
||||
cycleCount = 0;
|
||||
}
|
||||
|
||||
private unsafe M128 PrivateRand()
|
||||
private unsafe uint PrivateRand()
|
||||
{
|
||||
currentKey = hash.ComputeHash( currentKey );
|
||||
M128 ret;
|
||||
fixed( byte* bptr = currentKey ) {
|
||||
switch( ( cycleCount % 16 ) / 4 ) {
|
||||
case 0:
|
||||
ret = *( ( ( M128* )bptr ) + 0 );
|
||||
break;
|
||||
case 1:
|
||||
ret = *( ( ( M128* )bptr ) + 1 );
|
||||
break;
|
||||
case 2:
|
||||
ret = *( ( ( M128* )bptr ) + 2 );
|
||||
break;
|
||||
case 3:
|
||||
ret = *( ( ( M128* )bptr ) + 3 );
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
uint ret;
|
||||
fixed( byte* bptr = currentKey )
|
||||
{
|
||||
*( int* )bptr = UnsafeCompute.CityHashSimplify(
|
||||
( char* )bptr, currentKey.Length / 2 );
|
||||
ret = *( uint* )bptr;
|
||||
}
|
||||
|
||||
//Console.WriteLine(ret.ToString(16));
|
||||
|
||||
@@ -65,11 +65,7 @@ namespace StgSharp.Geometries
|
||||
public Vec3 Coord
|
||||
{
|
||||
get => coord;
|
||||
set
|
||||
{
|
||||
coord = value;
|
||||
coordVec.W = 1;
|
||||
}
|
||||
set { coord = value; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="M64.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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.HighPerformance
|
||||
{
|
||||
[StructLayout( LayoutKind.Explicit, Pack = 8 )]
|
||||
public unsafe struct M64 : IRegisterType
|
||||
{
|
||||
|
||||
[FieldOffset( 0 )] private fixed byte buffer[ 8 ];
|
||||
[FieldOffset( 0 )] private ulong value;
|
||||
|
||||
public M64()
|
||||
{
|
||||
Unsafe.SkipInit( out this );
|
||||
value = 0;
|
||||
}
|
||||
|
||||
public ref T AsRef<T>() where T: struct,INumber<T>
|
||||
{
|
||||
return ref Unsafe.As<byte, T>( ref buffer[ 0 ] );
|
||||
}
|
||||
|
||||
public override bool Equals( object obj )
|
||||
{
|
||||
return obj is M64 m64 && this == m64;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return value.GetHashCode();
|
||||
}
|
||||
|
||||
public T Read<T>( int index ) where T: struct, INumber<T>
|
||||
{
|
||||
return Unsafe.As<byte, T>( ref buffer[ index * sizeof( T ) ] );
|
||||
}
|
||||
|
||||
public void Write<T>( int index, T value ) where T: struct, INumber<T>
|
||||
{
|
||||
Unsafe.As<byte, T>( ref buffer[ index * sizeof( T ) ] ) = value;
|
||||
}
|
||||
|
||||
public static bool operator !=( M64 left, M64 right )
|
||||
{
|
||||
return !( left == right );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static M64 operator <<( M64 m, int shift )
|
||||
{
|
||||
return new M64
|
||||
{
|
||||
value = m.value << shift
|
||||
};
|
||||
}
|
||||
|
||||
public static bool operator ==( M64 left, M64 right )
|
||||
{
|
||||
return left.value == right.value;
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static M64 operator >>( M64 m, int shift )
|
||||
{
|
||||
return new M64
|
||||
{
|
||||
value = m.value >> shift
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Common")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+148b0fed4a1abaaeaa3a28e7c7b088590805ebef")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2692495dc8460e1f60a2d073f162c5f526e1ba1b")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Common")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Common")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/148b0fed4a1abaaeaa3a28e7c7b088590805ebef/*"}}
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/2692495dc8460e1f60a2d073f162c5f526e1ba1b/*"}}
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Generator")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e3741687a706609a1d0055c3fd11f41945838a70")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2692495dc8460e1f60a2d073f162c5f526e1ba1b")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Generator")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Generator")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IStepEntity.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.Express;
|
||||
|
||||
namespace StgSharp.Modeling.STEP
|
||||
{
|
||||
public interface IStepEntity<TSelf> : IExpMarshalType<TSelf> where TSelf: IStepEntity<TSelf> { }
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,9 +43,8 @@ namespace StgSharp.Modeling.STEP
|
||||
{
|
||||
public partial class StepReader
|
||||
{
|
||||
private Regex expressionSpilitter = new Regex(
|
||||
@"^#(?<id>[0-9]+)\s*?=\s*?(?<expression>\S.*?)\s*;$",
|
||||
RegexOptions.Compiled );
|
||||
|
||||
private Regex expressionSpilitter = GetExpressionSplitter();
|
||||
|
||||
private ThreadLocal<ConcurrentQueue<StepCodeLine>> _codeLineQueue
|
||||
= new ThreadLocal<ConcurrentQueue<StepCodeLine>>();
|
||||
@@ -57,35 +56,35 @@ namespace StgSharp.Modeling.STEP
|
||||
|
||||
public void ReadDataSection()
|
||||
{
|
||||
if (_codeLineQueue.Value == null)
|
||||
{
|
||||
if( _codeLineQueue.Value == null ) {
|
||||
_codeLineQueue.Value = new ConcurrentQueue<StepCodeLine>();
|
||||
}
|
||||
using (MemoryMappedViewStream ms = _memoryFile.CreateViewStream(
|
||||
0, _size, MemoryMappedFileAccess.Read))
|
||||
using( MemoryMappedViewStream ms = _memoryFile.CreateViewStream(
|
||||
0, _size, MemoryMappedFileAccess.Read ) )
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(ms))
|
||||
using( StreamReader sr = new StreamReader( ms ) )
|
||||
{
|
||||
long pos = _headStart;
|
||||
string line;
|
||||
while (string.IsNullOrEmpty(line = sr.ReadLine()))
|
||||
while( string.IsNullOrEmpty( line = sr.ReadLine()! ) )
|
||||
{
|
||||
switch (line)
|
||||
Match match = expressionSpilitter.Match( line );
|
||||
if( match.Success )
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Match match = expressionSpilitter.Match(line);
|
||||
if (match.Success)
|
||||
{
|
||||
int id = int.Parse(match.Groups["id"].Value);
|
||||
string expression = match.Groups["expression"].Value;
|
||||
StepCodeLine stepExpression = new StepCodeLine(id, expression);
|
||||
_codeLineQueue.Value.Enqueue(stepExpression);
|
||||
int id = int.Parse( match.Groups[ "id" ].Value );
|
||||
string expression = match.Groups[ "expression" ].Value;
|
||||
StepCodeLine stepExpression = new StepCodeLine( id, expression );
|
||||
_codeLineQueue.Value.Enqueue( stepExpression );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[GeneratedRegex(
|
||||
@"^#(?<id>[0-9]+)\s*?=\s*?(?<expression>\S.*?)\s*;$",
|
||||
RegexOptions.Compiled | RegexOptions.Singleline )]
|
||||
private static partial Regex GetExpressionSplitter();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Model")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d270b6b1f8220e14d01610bd55f11c0b4908af39")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2692495dc8460e1f60a2d073f162c5f526e1ba1b")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Model")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Model")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/d270b6b1f8220e14d01610bd55f11c0b4908af39/*"}}
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/2692495dc8460e1f60a2d073f162c5f526e1ba1b/*"}}
|
||||
@@ -42,6 +42,8 @@ namespace StgSharp.Script
|
||||
where TType: ITypeSource<TType>
|
||||
{
|
||||
|
||||
private Token? _lastToken;
|
||||
|
||||
private TNode[] _nodeArray = new TNode[4];
|
||||
private Token[] _operatorArray = new Token[4];
|
||||
private Token[] _tokenArray = new Token[4];
|
||||
@@ -51,6 +53,7 @@ namespace StgSharp.Script
|
||||
|
||||
private Stack<bool> _isNode = new Stack<bool>();
|
||||
private Stack<Stack<TNode>> _statementCache = new Stack<Stack<TNode>>();
|
||||
private TNode _lastNode;
|
||||
|
||||
public CompileStack()
|
||||
{
|
||||
@@ -58,6 +61,8 @@ namespace StgSharp.Script
|
||||
_statementCache.Push( new Stack<TNode>() );
|
||||
}
|
||||
|
||||
public bool IsLastAddedOperator { get; private set; }
|
||||
|
||||
public CompileDepthMark CurrentDepthMark
|
||||
{
|
||||
get => _depthStack.Peek();
|
||||
@@ -180,6 +185,7 @@ namespace StgSharp.Script
|
||||
_nodeArray[ _nodeCount ] = node;
|
||||
_nodeCount++;
|
||||
_isNode.Push( true );
|
||||
IsLastAddedOperator = false;
|
||||
}
|
||||
|
||||
public void PushOperand( Token token )
|
||||
@@ -190,6 +196,7 @@ namespace StgSharp.Script
|
||||
_tokenArray[ _tokenCount ] = token;
|
||||
_tokenCount++;
|
||||
_isNode.Push( false );
|
||||
IsLastAddedOperator = false;
|
||||
}
|
||||
|
||||
public void PushOperator( Token token )
|
||||
@@ -199,6 +206,7 @@ namespace StgSharp.Script
|
||||
}
|
||||
_operatorArray[ _operatorCount ] = token;
|
||||
_operatorCount++;
|
||||
IsLastAddedOperator = true;
|
||||
}
|
||||
|
||||
public T StateOfCurrentDepth<T>() where T: class, ICompileDepthState
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ExpElementInitializingNode.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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public class ExpElementInitializingNode : ExpNode
|
||||
{
|
||||
|
||||
private ExpMetaRefNode _type;
|
||||
private ExpNode _init;
|
||||
|
||||
public ExpElementInitializingNode(
|
||||
Token source,
|
||||
ExpMetaRefNode type,
|
||||
ExpNode initParameter )
|
||||
: base( source )
|
||||
{
|
||||
_type = type;
|
||||
_init = initParameter;
|
||||
}
|
||||
|
||||
public override ExpNode Left => _type;
|
||||
|
||||
public override ExpNode Right => _init;
|
||||
|
||||
public override IExpElementSource EqualityTypeConvert => _type.SourceRef;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,8 @@ namespace StgSharp.Script.Express
|
||||
|
||||
string Name { get; }
|
||||
|
||||
public void AddMember( string name, ExpNode memberNode );
|
||||
|
||||
public void Analyse();
|
||||
|
||||
public bool TryGetMember( string name, out ExpNode memberNode );
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -40,13 +42,40 @@ namespace StgSharp.Script.Express
|
||||
public class ExpNodeNextEnumerator : IEnumerator<ExpNode>
|
||||
{
|
||||
|
||||
private ExpNode _begin;
|
||||
private ExpNode _current;
|
||||
|
||||
private List<ExpNode> _begin = new List<ExpNode>();
|
||||
|
||||
public ExpNodeNextEnumerator( ExpNode token )
|
||||
{
|
||||
_begin = token;
|
||||
_begin[ 0 ] = token;
|
||||
_current = token;
|
||||
ExpNode t = token;
|
||||
while( !ReferenceEquals( t.Next, token ) && t.Next != null )
|
||||
{
|
||||
t = t.Next;
|
||||
_begin.Add( t );
|
||||
}
|
||||
}
|
||||
|
||||
public ExpNode this[ int index ]
|
||||
{
|
||||
get
|
||||
{
|
||||
ArgumentOutOfRangeException.ThrowIfNegative( index );
|
||||
ArgumentOutOfRangeException.ThrowIfGreaterThan( index, _begin.Count );
|
||||
return _begin[ index ];
|
||||
}
|
||||
}
|
||||
|
||||
public List<ExpNode> Values => _begin;
|
||||
|
||||
public void AssertEnumeratorCount( int count )
|
||||
{
|
||||
if( _begin.Count != count ) {
|
||||
throw new InvalidOperationException(
|
||||
$"Enumerator count mismatch. Expected {count}, but got {_begin.Count}." );
|
||||
}
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
@@ -66,13 +95,12 @@ namespace StgSharp.Script.Express
|
||||
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
_current = _begin;
|
||||
_current = _begin[ 0 ];
|
||||
}
|
||||
|
||||
object IEnumerator.Current => throw new NotImplementedException();
|
||||
object IEnumerator.Current => _current;
|
||||
|
||||
ExpNode IEnumerator<ExpNode>.Current => throw new NotImplementedException(
|
||||
);
|
||||
ExpNode IEnumerator<ExpNode>.Current => _current;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,6 @@ namespace StgSharp.Script.Express
|
||||
}
|
||||
|
||||
//Many thing miss here
|
||||
|
||||
_cache.PushOperand( ExpElementMemberNameNode.Create( t ) );
|
||||
|
||||
return true;
|
||||
@@ -258,6 +257,17 @@ namespace StgSharp.Script.Express
|
||||
{
|
||||
_cache.PushOperand( ExpInstanceReferenceNode.MakeReferenceFrom( t, instance ) );
|
||||
return true;
|
||||
} else if( _cache.IsLastAddedOperator )
|
||||
{
|
||||
if( _cache.PeekOperand( out _,
|
||||
out ExpNode? typenode ) && typenode is ExpMetaRefNode typeRef )
|
||||
{
|
||||
_cache.PopOperand( out _, out _ );
|
||||
_local.AddMember( t.Value, typeRef.SourceRef.CreateInstanceNode( t ) );
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ namespace StgSharp.Script.Express
|
||||
|
||||
private CompileStack<ExpNode, IExpElementSource> _cache;
|
||||
private ExpNode _lastStatement;
|
||||
|
||||
private ExpSchema _context;
|
||||
private IExpElementSource _local;
|
||||
|
||||
@@ -107,8 +106,9 @@ namespace StgSharp.Script.Express
|
||||
case TokenFlag.Symbol_Unary or TokenFlag.Symbol_Binary:
|
||||
TryAppendSymbol( expToken );
|
||||
break;
|
||||
case TokenFlag.Member:
|
||||
TryAppendMember( expToken );
|
||||
case TokenFlag.Number or TokenFlag.String:
|
||||
ExpElementInstance node = ExpElementInstance.CreateLiteral( expToken );
|
||||
_cache.PushOperand( node );
|
||||
break;
|
||||
case TokenFlag.Separator_Left:
|
||||
TryAppendPrefixSeparator( expToken );
|
||||
@@ -125,9 +125,8 @@ namespace StgSharp.Script.Express
|
||||
case TokenFlag.Index_Right:
|
||||
TryAppendIndexRight( expToken );
|
||||
break;
|
||||
case TokenFlag.Number or TokenFlag.String:
|
||||
ExpElementInstance node = ExpElementInstance.CreateLiteral( expToken );
|
||||
_cache.PushOperand( node );
|
||||
case TokenFlag.Member:
|
||||
TryAppendMember( expToken );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IExpMarshalType.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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Script.Express
|
||||
{
|
||||
public interface IExpMarshalType<TSelf>
|
||||
{
|
||||
|
||||
static abstract TSelf Create( string name, ExpNode node );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a4b2e9a8056c03f25a0aa3136f09d28ba86763fe")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2692495dc8460e1f60a2d073f162c5f526e1ba1b")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/7b7b5ee475ba81a574fedf4772a213a798ba4c27/*"}}
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/2692495dc8460e1f60a2d073f162c5f526e1ba1b/*"}}
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpDebug")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d270b6b1f8220e14d01610bd55f11c0b4908af39")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2692495dc8460e1f60a2d073f162c5f526e1ba1b")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharpDebug")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpDebug")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/d270b6b1f8220e14d01610bd55f11c0b4908af39/*"}}
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/2692495dc8460e1f60a2d073f162c5f526e1ba1b/*"}}
|
||||
Reference in New Issue
Block a user