EgtExch3dm 2.5k2 :
- primo rilascio.
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
# /
|
||||
/revision.h
|
||||
/*.aps
|
||||
/*.ncb
|
||||
/*.suo
|
||||
/*.user
|
||||
/*.sdf
|
||||
/*.opensdf
|
||||
/Debug32
|
||||
/Release32
|
||||
/Trial32
|
||||
/Debug64
|
||||
/Release64
|
||||
/ipch
|
||||
/bin
|
||||
/obj
|
||||
/.vs
|
||||
@@ -0,0 +1,23 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2023-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllMain.h Data : 14.11.23 Versione : 2.5k2
|
||||
// Contenuto : Prototipi funzioni per uso locale della DLL.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 14.11.23 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EgtILogger.h"
|
||||
#include <string>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ILogger* GetEE3Logger( void) ;
|
||||
const std::string& GetEE3Key( void) ;
|
||||
bool GetEE3NetHwKey( void) ;
|
||||
bool VerifyKey( int nKeyOpt) ;
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2023-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EE3DllMain.cpp Data : 14.11.23 Versione : 2.5k2
|
||||
// Contenuto : Inizializzazione della DLL.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 14.11.23 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EE3DllMain.h"
|
||||
#include "/EgtDev/Include/EGnGetModuleVer.h"
|
||||
#include "/EgtDev/Include/EGnGetKeyData.h"
|
||||
#include "/EgtDev/Include/EgtTrace.h"
|
||||
|
||||
//--------------------------- Costanti ----------------------------------------
|
||||
#if defined( _WIN64) && defined( _DEBUG)
|
||||
const char* EE3_STR = "EgtExch3dmD64.dll ver. " ;
|
||||
#elif defined( _WIN64)
|
||||
const char* EE3_STR = "EgtExch3dmR64.dll ver. " ;
|
||||
#elif defined( _WIN32) && defined( _DEBUG)
|
||||
const char* EE3_STR = "EgtExch3dmD32.dll ver. " ;
|
||||
#else
|
||||
const char* EE3_STR = "EgtExch3dmR32.dll ver. " ;
|
||||
#endif
|
||||
const int STR_DIM = 40 ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static HINSTANCE s_hModule = NULL ;
|
||||
static char s_szEE3NameVer[STR_DIM] ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL APIENTRY
|
||||
DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
|
||||
if ( dwReason == DLL_PROCESS_ATTACH) {
|
||||
// Controllo commentato per problemi con VB.NET
|
||||
//#if defined( NDEBUG)
|
||||
// BOOL IsDbgPresent = FALSE ;
|
||||
// CheckRemoteDebuggerPresent( GetCurrentProcess(), &IsDbgPresent) ;
|
||||
// if ( IsDbgPresent)
|
||||
// return 0 ;
|
||||
//#endif
|
||||
s_hModule = hModule ;
|
||||
EGT_TRACE( "EgtExch3dm.dll Initializing!\n") ;
|
||||
}
|
||||
else if ( dwReason == DLL_PROCESS_DETACH) {
|
||||
s_hModule = NULL ;
|
||||
EGT_TRACE( "EgtExch3dm.dll Terminating!\n") ;
|
||||
}
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const char*
|
||||
GetEE3Version( void)
|
||||
{
|
||||
std::string sVer ;
|
||||
|
||||
GetModuleVersion( s_hModule, sVer) ;
|
||||
sprintf_s( s_szEE3NameVer, STR_DIM, "%s%s", EE3_STR, sVer.c_str()) ;
|
||||
|
||||
return s_szEE3NameVer ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static ILogger* s_pLogger = nullptr ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
SetEE3Logger( ILogger* pLogger)
|
||||
{
|
||||
s_pLogger = pLogger ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ILogger*
|
||||
GetEE3Logger( void)
|
||||
{
|
||||
return s_pLogger ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static std::string s_sKey ;
|
||||
static bool s_bNetHwKey = false ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
SetEE3Key( const std::string& sKey)
|
||||
{
|
||||
s_sKey = sKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
SetEE3NetHwKey( bool bNetHwKey)
|
||||
{
|
||||
s_bNetHwKey = bNetHwKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const std::string&
|
||||
GetEE3Key( void)
|
||||
{
|
||||
return s_sKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
GetEE3NetHwKey( void)
|
||||
{
|
||||
return s_bNetHwKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
VerifyKey( int nKeyOpt)
|
||||
{
|
||||
// Controllo della licenza
|
||||
unsigned int nOpt1, nOpt2 ;
|
||||
int nOptExpDays ;
|
||||
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
if ( ! GetEE3NetHwKey())
|
||||
nRet = GetKeyOptions( GetEE3Key(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
if ( nRet != KEY_OK && ! EqualNoCase( GetEE3Key(), "EE3Base")) {
|
||||
if ( nRet != KEY_OK) {
|
||||
std::string sErr = "Error on Key (EE3/" + ToString( nRet) + ")" ;
|
||||
LOG_ERROR( GetEE3Logger(), sErr.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
if ( ( nOpt1 & ( KEYOPT_EEX_INPBASE|KEYOPT_EEX_EXPBASE)) == 0 ||
|
||||
( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) ||
|
||||
nOptExpDays < GetCurrDay()) {
|
||||
std::string sErr = "Warning on Key (EE3/OPT)" ;
|
||||
LOG_ERROR( GetEE3Logger(), sErr.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34221.43
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtExch3dm", "EgtExch3dm.vcxproj", "{D1A76918-1E81-4851-9B6F-2B1DB0EFB2A4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D1A76918-1E81-4851-9B6F-2B1DB0EFB2A4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D1A76918-1E81-4851-9B6F-2B1DB0EFB2A4}.Debug|x64.Build.0 = Debug|x64
|
||||
{D1A76918-1E81-4851-9B6F-2B1DB0EFB2A4}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{D1A76918-1E81-4851-9B6F-2B1DB0EFB2A4}.Debug|x86.Build.0 = Debug|Win32
|
||||
{D1A76918-1E81-4851-9B6F-2B1DB0EFB2A4}.Release|x64.ActiveCfg = Release|x64
|
||||
{D1A76918-1E81-4851-9B6F-2B1DB0EFB2A4}.Release|x64.Build.0 = Release|x64
|
||||
{D1A76918-1E81-4851-9B6F-2B1DB0EFB2A4}.Release|x86.ActiveCfg = Release|Win32
|
||||
{D1A76918-1E81-4851-9B6F-2B1DB0EFB2A4}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {2667F08C-F801-4E10-BB21-2A7F501982D9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,240 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{d1a76918-1e81-4851-9b6f-2b1db0efb2a4}</ProjectGuid>
|
||||
<RootNamespace>EgtExch3dm</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<TargetName>$(ProjectName)D$(PlatformArchitecture)</TargetName>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<TargetName>$(ProjectName)R$(PlatformArchitecture)</TargetName>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<TargetName>$(ProjectName)D$(PlatformArchitecture)</TargetName>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<TargetName>$(ProjectName)R$(PlatformArchitecture)</TargetName>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EE3;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>C:\EgtDev\Extern\OxySec\Lib\x32\xnodus32.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEB32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(TargetDir)$(TargetName).pdb \EgtDev\Lib\
|
||||
copy $(TargetDir)$(TargetName).lib \EgtDev\Lib\
|
||||
copy $(TargetPath) \EgtProg\DllD32</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EE3;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>false</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableUAC>true</EnableUAC>
|
||||
<AdditionalDependencies>C:\EgtDev\Extern\OxySec\Lib\x32\xnodus32.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEB32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(TargetDir)$(TargetName).lib \EgtDev\Lib\
|
||||
copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EE3;_DEBUG;EGTEXCH3DM_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>C:\EgtDev\Extern\OxySec\Lib\x64\xnodus.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEB64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(TargetDir)$(TargetName).pdb \EgtDev\Lib\
|
||||
copy $(TargetDir)$(TargetName).lib \EgtDev\Lib\
|
||||
copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EE3;NDEBUG;EGTEXCH3DM_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>C:\EgtDev\Extern\OxySec\Lib\x64\xnodus.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEB64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(TargetDir)$(TargetName).lib \EgtDev\Lib\
|
||||
copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Include\EE3DllMain.h" />
|
||||
<ClInclude Include="..\Include\EE3Export3dm.h" />
|
||||
<ClInclude Include="..\Include\EE3Import3dm.h" />
|
||||
<ClInclude Include="DllMain.h" />
|
||||
<ClInclude Include="Export3dm.h" />
|
||||
<ClInclude Include="Import3dm.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EE3DllMain.cpp" />
|
||||
<ClCompile Include="Export3dm.cpp" />
|
||||
<ClCompile Include="Import3dm.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtExch3dm.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Include">
|
||||
<UniqueIdentifier>{11088a38-0d50-4722-b177-1b9a9474d5db}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DllMain.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EE3DllMain.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Export3dm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Import3dm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EE3Export3dm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EE3Import3dm.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EE3DllMain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Export3dm.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Import3dm.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtExch3dm.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+708
@@ -0,0 +1,708 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Export3dm.cpp Data : 21.09.23 Versione :
|
||||
// Contenuto : Implementazione della classe per l'esportazione in formato 3dm.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 21.09.23 DB Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "Export3dm.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EE3DllMain.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkGeoObjType.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Extern/opennurbs/Include/opennurbs.h"
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
|
||||
|
||||
using namespace std ;
|
||||
//N.B.:
|
||||
// se si vuole richiamare qualche variabile di default definita in una classe come statica e a cui viene assegnato un valore
|
||||
// nel file opennurbs_statics.cpp bisogna richiamarla in questo elenco per evitare problemi di compilazione ( errore di LINK)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IExport3dm*
|
||||
CreateExport3dm( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IExport3dm*> ( new( nothrow) Export3dm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::SetOptions( int nFilter)
|
||||
{
|
||||
m_nFilter = nFilter ;
|
||||
CalcGroupFilter() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static void
|
||||
Internal_SetExampleModelProperties( ONX_Model& model, const char* source_file_name)
|
||||
{
|
||||
const bool bHaveFileName = ( nullptr != source_file_name && 0 != source_file_name[0]) ;
|
||||
if ( ! bHaveFileName)
|
||||
source_file_name = "" ;
|
||||
|
||||
model.m_sStartSectionComments = "This file was created using openNURBS to convert an .nge into .3dm" ;
|
||||
|
||||
// set application information
|
||||
const ON_wString wide_source_file_name( source_file_name) ;
|
||||
|
||||
model.m_properties.m_Application.m_application_URL = L"http://www.opennurbs.org" ;
|
||||
|
||||
// set revision history information
|
||||
model.m_properties.m_RevisionHistory.NewRevision() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
{
|
||||
Internal_SetExampleModelProperties( m_model, sFile.c_str()) ;
|
||||
ON::Begin() ;
|
||||
// verifico il DB geometrico
|
||||
if ( pGDB == nullptr) {
|
||||
LOG_ERROR( GetEE3Logger(), "Export3dm : Error on GeomDB")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// verifico l'Id dell'oggetto da esportare
|
||||
if ( ! pGDB->ExistsObj( nId)) {
|
||||
LOG_ERROR( GetEE3Logger(), "Export3dm : Error on Id")
|
||||
return false ;
|
||||
}
|
||||
|
||||
//// file settings ( units, tolerances, views, ...)
|
||||
//// OPTIONAL - change values from defaults
|
||||
m_model.m_settings.m_ModelUnitsAndTolerances.m_unit_system = ON::LengthUnitSystem::Millimeters ;
|
||||
m_model.m_settings.m_ModelUnitsAndTolerances.m_absolute_tolerance = 0.01 ;
|
||||
m_model.m_settings.m_ModelUnitsAndTolerances.m_angle_tolerance = ON_PI/180.0 ;// radians
|
||||
m_model.m_settings.m_ModelUnitsAndTolerances.m_relative_tolerance = 0.01 ;// 1%
|
||||
m_model.m_settings.m_current_material_source = ON::object_material_source::material_from_object ;
|
||||
m_model.m_settings.m_RenderSettings.m_bFlatShade = true ;
|
||||
|
||||
// creo un iteratore
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( pGDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
pIter->GoTo( nId) ;
|
||||
// esporto l'oggetto e i suoi eventuali figli
|
||||
bool bOk = ExportObject( *pIter, 0) ;
|
||||
|
||||
// stampo il file
|
||||
int version = 7 ;
|
||||
// errors printed to stdout
|
||||
ON_TextLog error_log ;
|
||||
// writes model to archive
|
||||
bOk = bOk && m_model.Write( ConvertString( sFile).c_str(), version, &error_log) ;
|
||||
|
||||
ON::End() ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::ExportObject( const IGdbIterator& iIter, const int& nLayer)
|
||||
{
|
||||
// recupero il livello dell'oggetto
|
||||
int nLev = GDB_LV_USER ;
|
||||
iIter.GetCalcLevel( nLev) ;
|
||||
// recupero il modo dell'oggetto
|
||||
int nMode = GDB_MD_STD ;
|
||||
iIter.GetCalcMode( nMode) ;
|
||||
// recupero lo stato dell'oggetto
|
||||
int nStat = GDB_ST_ON ;
|
||||
iIter.GetCalcStatus( nStat) ;
|
||||
int nType = iIter.GetGdbType() ;
|
||||
// se il filtro lo abilita
|
||||
if ( TestFilter( nLev, nMode, nStat, nType == GDB_TY_GROUP)) {
|
||||
switch ( nType) {
|
||||
case GDB_TY_GEO :
|
||||
{
|
||||
// recupero il riferimento globale dell'oggetto
|
||||
Frame3d frFrame ;
|
||||
if ( ! iIter.GetGlobFrame( frFrame))
|
||||
return false ;
|
||||
//recupero il colore dell'oggetto
|
||||
Color cCol ;
|
||||
iIter.GetCalcMaterial( cCol) ;
|
||||
// recupero eventuale nome
|
||||
string sName ;
|
||||
if ( ! iIter.GetName( sName))
|
||||
sName = ToString( iIter.GetId()) ;
|
||||
// emetto l'oggetto
|
||||
switch ( iIter.GetGeoType()) {
|
||||
case GEO_PNT3D: {
|
||||
if ( ! ExportPnt( sName, iIter, frFrame, cCol, nLayer))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
case SRF_BEZIER: {
|
||||
if ( ! ExportSrfBz( sName, iIter, frFrame, cCol, nLayer))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
case SRF_FLATRGN :
|
||||
case SRF_TRIMESH :
|
||||
if ( ! ExportSTM( sName, iIter, frFrame, cCol, nLayer))
|
||||
return false ;
|
||||
break ;
|
||||
case CRV_ARC : {
|
||||
if ( ! ExportCrvArc( sName, iIter, frFrame, cCol, nLayer))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
case CRV_BEZIER : {
|
||||
if ( ! ExportCrvBezier( sName, iIter, frFrame, cCol, nLayer))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
case CRV_COMPO : {
|
||||
if ( ! ExportCrvCompo( sName, iIter, frFrame, cCol, nLayer))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
case CRV_LINE : {
|
||||
if ( ! ExportCrvLine( sName, iIter, frFrame, cCol, nLayer))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
case GDB_TY_GROUP: {
|
||||
int nLayer = iIter.GetId() ;
|
||||
if ( nLayer == 0) {
|
||||
m_model.RemoveModelComponent( ON_ModelComponent::Type::Layer, m_model.LayerFromIndex( 0).ModelComponentId()) ;
|
||||
return ScanGroup( iIter, nLayer) ;
|
||||
}
|
||||
// creo il layer e setto le proprietà
|
||||
ON_Layer* layer = new ON_Layer() ;
|
||||
std::string sLayName ;
|
||||
iIter.GetName( sLayName) ;
|
||||
if ( sLayName == "" ) {
|
||||
sLayName = "Layer " + ToString( nLayer) ;
|
||||
}
|
||||
layer->SetName( ConvertString( sLayName).c_str()) ;
|
||||
layer->SetIndex( nLayer) ;
|
||||
ON_Color onCol( 0, 0, 0) ; // black
|
||||
layer->SetColor( onCol) ;
|
||||
layer->SetVisible( true) ;
|
||||
layer->SetLocked( false) ;
|
||||
int nParent = iIter.GetParentId() ;
|
||||
if ( nParent != 0) {
|
||||
// setto il parent
|
||||
const ON_Layer* onParLay = ON_Layer::Cast( m_model.LayerFromIndex( m_mLayer[nParent]).ModelComponent()) ;
|
||||
layer->SetParentLayerId( onParLay->Id()) ;
|
||||
}
|
||||
// copio le info
|
||||
STRVECTOR vStrInfo, vStrInfo_split ;
|
||||
iIter.GetAllInfo( vStrInfo) ;
|
||||
for ( string sInfo : vStrInfo) {
|
||||
Tokenize( sInfo, "=", vStrInfo_split) ;
|
||||
layer->SetUserString( ConvertString( vStrInfo_split[0]).c_str(), ConvertString( vStrInfo_split[1]).c_str()) ;
|
||||
}
|
||||
|
||||
// aggiungo il layer
|
||||
ON_ModelComponentReference mcr = m_model.AddManagedModelComponent( layer) ;
|
||||
int nIndex = mcr.ModelComponentIndex() ;
|
||||
m_mLayer.insert( pair< int, int>( nLayer, nIndex)) ;
|
||||
|
||||
// esploro il gruppo
|
||||
return ScanGroup( iIter, nIndex) ;
|
||||
}
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::AddObjectToModel( const IGdbIterator& iIter, ON_Object* onObject, const int& nLayer, const std::string& sName, const Color& cCol,
|
||||
ON_3dmObjectAttributes* pOnAttr)
|
||||
{
|
||||
if ( pOnAttr == nullptr)
|
||||
pOnAttr = new ON_3dmObjectAttributes() ;
|
||||
pOnAttr->m_layer_index = nLayer ;
|
||||
pOnAttr->m_name = ConvertString( sName).c_str() ;
|
||||
pOnAttr->SetColorSource( ON::color_from_object) ;
|
||||
//N.B. RHINO ha i valori di Alpha invertiti rispetto ai nostri, oltre che su una scala diversa! per loro 0 = opaco e 255 = trasparente
|
||||
// per noi invece 0 = trasparente, 100 = opaco
|
||||
ON_Color onCol( cCol.GetIntRed(), cCol.GetIntGreen(), cCol.GetIntBlue(), abs( int( cCol.GetIntAlpha() * 2.55) - 255)) ;
|
||||
pOnAttr->m_color = onCol ;
|
||||
// se è una mesh aggiungo il materiale
|
||||
if ( const ON_Mesh* onMesh = ON_Mesh::Cast( onObject)) {
|
||||
// aggiungo il materiale al modello se necessario
|
||||
std::string sCol = ToString(cCol.GetIntRed()) + "," + ToString( cCol.GetIntGreen()) + "," + ToString( cCol.GetIntBlue()) ;
|
||||
if ( m_mMaterial.find( sCol) == m_mMaterial.end()) {
|
||||
ON_Material* onMat = new ON_Material ;
|
||||
ON_Color onCAmb( 126, 126, 126) ; // gray126
|
||||
onMat->m_reflection_glossiness = 0.0 ;
|
||||
onMat->SetEmission( onCol) ;
|
||||
onMat->SetDiffuse( onCol) ;
|
||||
onMat->SetAmbient( onCAmb) ;
|
||||
onMat->SetReflectivity( 0) ;
|
||||
ON_ModelComponentReference mcr = m_model.AddManagedModelComponent( onMat) ;
|
||||
int nIndex = mcr.ModelComponentIndex() ;
|
||||
m_mMaterial.insert( pair< std::string, int>( sCol, nIndex)) ;
|
||||
pOnAttr->SetMaterialSource( ON::object_material_source::material_from_object) ;
|
||||
pOnAttr->m_material_index = nIndex ;
|
||||
}
|
||||
// sennò richiamo un materiale già definito
|
||||
else {
|
||||
pOnAttr->SetMaterialSource( ON::object_material_source::material_from_object) ;
|
||||
pOnAttr->m_material_index = m_mMaterial[sCol] ;
|
||||
}
|
||||
}
|
||||
// copio le info
|
||||
STRVECTOR vStrInfo, vStrInfo_split ;
|
||||
iIter.GetAllInfo(vStrInfo) ;
|
||||
for ( string sInfo : vStrInfo) {
|
||||
Tokenize( sInfo, "=", vStrInfo_split) ;
|
||||
pOnAttr->SetUserString( ConvertString( vStrInfo_split[0]).c_str(), ConvertString( vStrInfo_split[1]).c_str()) ;
|
||||
}
|
||||
// aggiungo al modello
|
||||
ON_ModelComponentReference mcr = m_model.AddManagedModelGeometryComponent( onObject, pOnAttr) ;
|
||||
return ! mcr.IsEmpty() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::AddInfoToObject( const IGdbIterator& iIter, ON_Object* onObject)
|
||||
{
|
||||
// copio le info
|
||||
STRVECTOR vStrInfo, vStrInfo_split ;
|
||||
iIter.GetAllInfo( vStrInfo) ;
|
||||
for ( string sInfo : vStrInfo) {
|
||||
Tokenize( sInfo, "=", vStrInfo_split) ;
|
||||
onObject->SetUserString( ConvertString( vStrInfo_split[0]).c_str(), ConvertString( vStrInfo_split[1]).c_str()) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
|
||||
{
|
||||
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
|
||||
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
|
||||
( nLev == GDB_LV_SYSTEM && ( nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
||||
( nLev == GDB_LV_TEMP && ( nFilter & EEXFLT_LEVTEMP) == 0))
|
||||
return false ;
|
||||
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
|
||||
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||
return false ;
|
||||
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
|
||||
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
|
||||
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::CalcGroupFilter( void)
|
||||
{
|
||||
m_nGroupFilter = 0 ;
|
||||
// Status
|
||||
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
|
||||
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
|
||||
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||
else
|
||||
m_nGroupFilter += EEXFLT_STAON ;
|
||||
// Mode
|
||||
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
|
||||
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
|
||||
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||
else
|
||||
m_nGroupFilter += EEXFLT_MODESTD ;
|
||||
// Level
|
||||
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
|
||||
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
|
||||
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||
else
|
||||
m_nGroupFilter += EEXFLT_LEVUSER ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::ExportPnt(const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
||||
{
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return false ;
|
||||
// verifico oggetto
|
||||
PtrOwner<IGeoPoint3d> pGeoPnt( GetGeoPoint3d( pGeoObj->Clone())) ;
|
||||
if ( IsNull( pGeoPnt))
|
||||
return false ;
|
||||
// lo porto nel riferimento globale
|
||||
pGeoPnt->ToGlob( frFrame) ;
|
||||
Point3d pt = pGeoPnt->GetPoint() ;
|
||||
ON_Point* onPt = new ON_Point( ConvertPoint( pt)) ;
|
||||
// aggiungo l'oggetto al modello
|
||||
return AddObjectToModel( iIter, onPt, nLayer, sName, cCol) ; ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::ExportSrfBz( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
||||
{
|
||||
|
||||
//MANCA DA IMPLEMENTARE IL TRIM DELLE SUPERFICI!!/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return false ;
|
||||
// verifico oggetto
|
||||
PtrOwner<ISurfBezier> pSrfBz( GetSurfBezier( pGeoObj->Clone())) ;
|
||||
if ( IsNull( pSrfBz))
|
||||
return false ;
|
||||
// lo porto nel riferimento globale
|
||||
pSrfBz->ToGlob( frFrame) ;
|
||||
bool bOk = true ;
|
||||
int nDegU, nDegV, nSpanU, nSpanV ;
|
||||
bool bRat = false ;
|
||||
bool bTrimmed = false ;
|
||||
pSrfBz->GetInfo( nDegU, nDegV, nSpanU, nSpanV, bRat, bTrimmed) ;
|
||||
int nCPU = nDegU * nSpanU + 1 ;
|
||||
int nCPV = nDegV * nSpanV + 1 ;
|
||||
ON_NurbsSurface* onNurbsSurf = new ON_NurbsSurface( 3, bRat, nDegU + 1, nDegV + 1, nCPU, nCPV) ;
|
||||
for ( int u = 0 ; u < nCPU ; ++u) {
|
||||
for ( int v = 0 ; v < nCPV ; ++v) {
|
||||
Point3d ptCV = pSrfBz->GetControlPoint( u, v, &bOk) ;
|
||||
if ( ! bRat) {
|
||||
onNurbsSurf->SetCV( u, v, ConvertPoint( ptCV)) ;
|
||||
}
|
||||
else {
|
||||
double dW = pSrfBz->GetControlWeight( u, v, &bOk) ;
|
||||
onNurbsSurf->SetCV( u, v, ConvertPoint( ptCV * dW)) ;
|
||||
onNurbsSurf->SetWeight( u, v, dW) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// imposto il vettore dei nodi in U
|
||||
int nKnotCountU = nDegU + nCPU - 1 ;
|
||||
double dKnot = 0 ;
|
||||
// per costruzione nKnotCount é un multiplo di nDegU
|
||||
for ( int u = 0 ; u < int ( nKnotCountU / nDegU) ; ++u) {
|
||||
for ( int p = 0 ; p < nDegU ; ++p)
|
||||
onNurbsSurf->SetKnot( 0, u * nDegU + p, dKnot) ;
|
||||
++dKnot ;
|
||||
}
|
||||
|
||||
// imposto il vettore dei nodi in V
|
||||
int nKnotCountV = nDegV + nCPV - 1 ;
|
||||
dKnot = 0 ;
|
||||
// per costruzione nKnotCount é un multiplo di nDegU
|
||||
for ( int v = 0 ; v < int ( nKnotCountV / nDegV) ; ++v) {
|
||||
for ( int p = 0 ; p < nDegV ; ++p)
|
||||
onNurbsSurf->SetKnot( 0, v * nDegV + p, dKnot) ;
|
||||
++dKnot ;
|
||||
}
|
||||
// aggiungo l'oggetto al modello
|
||||
return AddObjectToModel( iIter, onNurbsSurf, nLayer, sName, cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::ExportSTM( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
||||
{
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return false ;
|
||||
// verifico oggetto
|
||||
PtrOwner<ISurfTriMesh> pSrfTm ;
|
||||
if ( pGeoObj->GetType() == SRF_TRIMESH)
|
||||
pSrfTm.Set( GetSurfTriMesh( pGeoObj->Clone())) ;
|
||||
else {
|
||||
const ISurfFlatRegion* pSrfFr = GetSurfFlatRegion( pGeoObj) ;
|
||||
const ISurfTriMesh* pSrfTm_ = pSrfFr->GetAuxSurf() ;
|
||||
if ( pSrfTm_ == nullptr){
|
||||
return false ;
|
||||
}
|
||||
pSrfTm.Set( pSrfTm_->Clone()) ;
|
||||
}
|
||||
|
||||
if ( IsNull( pSrfTm))
|
||||
return false ;
|
||||
|
||||
// lo porto nel frame globale
|
||||
pSrfTm->ToGlob( frFrame) ;
|
||||
|
||||
int nVertices = pSrfTm->GetVertexCount() ;
|
||||
int nTriangles = pSrfTm->GetTriangleCount() ;
|
||||
ON_Mesh* onMesh = new ON_Mesh ;
|
||||
for ( int v = 0 ; v < nVertices ; ++v) {
|
||||
Point3d pt ; pSrfTm->GetVertex( v, pt) ;
|
||||
onMesh->SetVertex( v, ConvertPoint( pt)) ;
|
||||
}
|
||||
for ( int t = 0 ; t < nTriangles ; ++t) {
|
||||
int nIdVert[3] ; pSrfTm->GetTriangle( t, nIdVert) ;
|
||||
onMesh->SetTriangle( t, nIdVert[0], nIdVert[1], nIdVert[2]) ;
|
||||
}
|
||||
// aggiungo l'oggetto al modello
|
||||
return AddObjectToModel( iIter, onMesh, nLayer, sName, cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ON_ArcCurve*
|
||||
Export3dm::ConvertCrvArc( const ICurveArc* pCrvArc)
|
||||
{
|
||||
double dRad = pCrvArc->GetRadius() ;
|
||||
Point3d ptCen ;
|
||||
pCrvArc->GetCenterPoint( ptCen) ;
|
||||
PtrOwner<ON_ArcCurve> onArcCrv( new ON_ArcCurve()) ;
|
||||
if ( ! pCrvArc->IsACircle()) {
|
||||
Vector3d vtZ = pCrvArc->GetNormVersor() ;
|
||||
Vector3d vtX, vtY ;
|
||||
vtX = pCrvArc->GetStartVersor() ;
|
||||
vtY = vtZ ^ vtX ;
|
||||
double dAngDeg = pCrvArc->GetAngCenter() ;
|
||||
ON_Plane onPlane( ConvertPoint( ptCen), ConvertVector( vtX), ConvertVector( vtY)) ;
|
||||
onArcCrv.Set( new ON_ArcCurve( ON_Arc( onPlane, dRad, dAngDeg * DEGTORAD))) ;
|
||||
}
|
||||
else
|
||||
onArcCrv.Set( new ON_ArcCurve ( ON_Circle( ConvertPoint( ptCen), dRad))) ;
|
||||
return Release( onArcCrv) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::ExportCrvArc( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
||||
{
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return false ;
|
||||
// verifico oggetto
|
||||
PtrOwner<ICurveArc> pCrvArc( GetCurveArc( pGeoObj->Clone())) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
return false ;
|
||||
// lo porto nel fram globale
|
||||
pCrvArc->ToGlob( frFrame) ;
|
||||
ON_ArcCurve* onArcCrv = ConvertCrvArc( pCrvArc) ;
|
||||
if ( onArcCrv == nullptr)
|
||||
return false ;
|
||||
// aggiungo l'oggetto al modello
|
||||
return AddObjectToModel( iIter, onArcCrv, nLayer, sName, cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ON_NurbsCurve*
|
||||
Export3dm::ConvertCrvBezier( const ICurveBezier* pCrvBz)
|
||||
{
|
||||
// creo l'oggetto da esportare
|
||||
int nDeg = pCrvBz->GetDegree() ;
|
||||
int nCV = nDeg + 1 ;
|
||||
PtrOwner<ON_NurbsCurve> onNurbsCrv( new ON_NurbsCurve( 3, // dim
|
||||
pCrvBz->IsRational(), // bRat
|
||||
nDeg + 1, // order = deg + 1
|
||||
nCV)) ; // numero di CP
|
||||
// imposto i punti di controllo con gli eventuali pesi
|
||||
if ( ! pCrvBz->IsRational()) {
|
||||
bool bOk = true ;
|
||||
for ( int i = 0 ; i < nCV ; ++i) {
|
||||
ON_3dPoint onPt = ConvertPoint( pCrvBz->GetControlPoint( i, &bOk)) ;
|
||||
onNurbsCrv->SetCV( i, onPt) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bool bOk = true ;
|
||||
for ( int i = 0 ; i < nCV ; ++i) {
|
||||
ON_3dPoint onPt = ConvertPoint( pCrvBz->GetControlPoint( i, &bOk)) ;
|
||||
double dWeight = pCrvBz->GetControlWeight( i, &bOk) ;
|
||||
onNurbsCrv->SetCV( i, onPt * dWeight) ;
|
||||
onNurbsCrv->SetWeight( i, dWeight) ;
|
||||
}
|
||||
}
|
||||
// imposto il vettore dei nodi
|
||||
int nKnotCount = nDeg + nCV - 1 ;
|
||||
double dKnot = 0 ;
|
||||
for ( int u = 0 ; u < int ( nKnotCount / nDeg) ; ++u) {
|
||||
for ( int p = 0 ; p < nDeg ; ++p)
|
||||
onNurbsCrv->SetKnot( u * nDeg + p, dKnot) ;
|
||||
++dKnot ;
|
||||
}
|
||||
|
||||
return Release( onNurbsCrv) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::ExportCrvBezier( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
||||
{
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return false ;
|
||||
// verifico oggetto
|
||||
PtrOwner<ICurveBezier> pCrvBz( GetCurveBezier( pGeoObj->Clone())) ;
|
||||
if ( IsNull( pCrvBz))
|
||||
return false ;
|
||||
// lo porto nel riferimento globale
|
||||
pCrvBz->ToGlob( frFrame) ;
|
||||
ON_NurbsCurve* onNurbsCrv = ConvertCrvBezier( pCrvBz) ;
|
||||
if ( onNurbsCrv == nullptr)
|
||||
return false ;
|
||||
// aggiungo l'oggetto al modello
|
||||
return AddObjectToModel( iIter, onNurbsCrv, nLayer, sName, cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::ExportCrvCompo( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
||||
{
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return false ;
|
||||
// verifico oggetto
|
||||
PtrOwner<ICurveComposite> pCrvCompo( GetCurveComposite( pGeoObj->Clone())) ;
|
||||
if ( IsNull( pCrvCompo))
|
||||
return false ;
|
||||
// lo porto nel riferimento globale
|
||||
pCrvCompo->ToGlob( frFrame) ;
|
||||
ON_PolyCurve* onPolyCrv = new ON_PolyCurve ;
|
||||
for ( const ICurve* pCrv = pCrvCompo->GetFirstCurve() ; pCrv != nullptr ; pCrv = pCrvCompo->GetNextCurve()) {
|
||||
GeoObjType type = pCrv->GetType() ;
|
||||
switch ( type) {
|
||||
case CRV_LINE : {
|
||||
PtrOwner<ICurveLine> pCrvL( GetCurveLine( pCrv->Clone())) ;
|
||||
if ( IsNull( pCrvL)) {
|
||||
delete onPolyCrv ;
|
||||
return false ;
|
||||
}
|
||||
ON_LineCurve* onLine = ConvertCrvLine( pCrvL) ;
|
||||
if ( onLine == nullptr) {
|
||||
delete onPolyCrv ;
|
||||
return false ;
|
||||
}
|
||||
onPolyCrv->Append( onLine) ;
|
||||
break ;
|
||||
}
|
||||
case CRV_ARC : {
|
||||
PtrOwner<ICurveArc> pCrvArc( GetCurveArc( pCrv->Clone())) ;
|
||||
if ( IsNull( pCrvArc)) {
|
||||
delete onPolyCrv ;
|
||||
return false ;
|
||||
}
|
||||
ON_ArcCurve* onArcCrv = ConvertCrvArc( pCrvArc) ;
|
||||
if ( onArcCrv == nullptr) {
|
||||
delete onPolyCrv ;
|
||||
return false ;
|
||||
}
|
||||
onPolyCrv->Append( onArcCrv) ;
|
||||
break ;
|
||||
}
|
||||
case CRV_BEZIER : {
|
||||
PtrOwner<ICurveBezier> pCrvBz( GetCurveBezier( pCrv->Clone())) ;
|
||||
if ( IsNull( pCrvBz)) {
|
||||
delete onPolyCrv ;
|
||||
return false ;
|
||||
}
|
||||
ON_NurbsCurve* onNurbsCrv = ConvertCrvBezier( pCrvBz) ;
|
||||
if ( onNurbsCrv == nullptr) {
|
||||
delete onPolyCrv ;
|
||||
return false ;
|
||||
}
|
||||
onPolyCrv->Append( onNurbsCrv) ;
|
||||
break ;
|
||||
}
|
||||
default : break ;
|
||||
}
|
||||
}
|
||||
// aggiungo l'oggetto al modello
|
||||
return AddObjectToModel( iIter, onPolyCrv, nLayer, sName, cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ON_LineCurve*
|
||||
Export3dm::ConvertCrvLine( const ICurveLine* pCrvL)
|
||||
{
|
||||
Point3d ptStart, ptEnd ;
|
||||
pCrvL->GetStartPoint( ptStart) ;
|
||||
pCrvL->GetEndPoint( ptEnd) ;
|
||||
PtrOwner<ON_LineCurve> onCrvLine( new ON_LineCurve( ON_Line( ConvertPoint( ptStart), ConvertPoint( ptEnd)))) ;
|
||||
return Release( onCrvLine) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::ExportCrvLine( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
||||
{
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return false ;
|
||||
// verifico oggetto
|
||||
PtrOwner<ICurveLine> pCrvL( GetCurveLine( pGeoObj->Clone())) ;
|
||||
if ( IsNull( pCrvL))
|
||||
return false ;
|
||||
// lo porto nel frame globale
|
||||
pCrvL->ToGlob( frFrame) ;
|
||||
ON_LineCurve* onCrvLine = ConvertCrvLine( pCrvL) ;
|
||||
// aggiungo l'oggetto al modello
|
||||
return AddObjectToModel( iIter, onCrvLine, nLayer, sName, cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3dm::ScanGroup( const IGdbIterator& iIter, const int& nLayer)
|
||||
{
|
||||
// creo un iteratore
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( iIter.GetGDB())) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
// scandisco il gruppo
|
||||
bool bOk = true ;
|
||||
for ( bool bNext = pIter->GoToFirstInGroup( iIter) ;
|
||||
bNext ;
|
||||
bNext = pIter->GoToNext()) {
|
||||
if ( ! ExportObject( *pIter, nLayer))
|
||||
bOk = false ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Export3dm.cpp Data : 21.09.23 Versione :
|
||||
// Contenuto : Dichiarazione della classe ExportStl.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 21.09.23 DB Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#define NOMINMAX
|
||||
|
||||
#include "/EgtDev/Include/EE3Export3dm.h"
|
||||
#include "/EgtDev/Include/EGnWriter.h"
|
||||
#include "/EgtDev/Include/EGkGeoObj.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkFrame3d.h"
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Extern/opennurbs/Include/opennurbs.h"
|
||||
#include <map>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Export3dm : public IExport3dm
|
||||
{
|
||||
public :
|
||||
virtual bool SetOptions( int nFilter) ;
|
||||
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
|
||||
|
||||
public :
|
||||
Export3dm(void) : m_nFilter(EEXFLT_DEFAULT) {
|
||||
CalcGroupFilter() ;
|
||||
}
|
||||
|
||||
private :
|
||||
bool ExportObject( const IGdbIterator& iIter, const int& nLayer) ;
|
||||
bool AddObjectToModel( const IGdbIterator& iIter, ON_Object* onObject, const int& nLayer, const std::string& sName, const Color& cCol,
|
||||
ON_3dmObjectAttributes* pOnAttr = nullptr) ;
|
||||
bool AddInfoToObject( const IGdbIterator& iIter, ON_Object* onObject) ;
|
||||
bool ScanGroup( const IGdbIterator& iIter, const int& nLayer) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup = false) ;
|
||||
std::wstring ConvertString( const std::string& sName) { return std::wstring( sName.begin(), sName.end()) ;} ;
|
||||
ON_3dPoint ConvertPoint( const Point3d& pt) { return ON_3dPoint( pt.x, pt.y, pt.z) ;} ;
|
||||
ON_3dVector ConvertVector( const Vector3d& vt) { return ON_3dVector( vt.x, vt.y, vt.z) ;} ;
|
||||
ON_NurbsCurve* ConvertCrvBezier( const ICurveBezier* pCrvBz) ;
|
||||
ON_ArcCurve* ConvertCrvArc( const ICurveArc* pCrvArc) ;
|
||||
ON_LineCurve* ConvertCrvLine( const ICurveLine* pCrvL) ;
|
||||
bool ExportPnt( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
||||
bool ExportSrfBz( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
||||
bool ExportSTM( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
||||
bool ExportCrvArc( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
||||
bool ExportCrvBezier( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
||||
bool ExportCrvCompo( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
||||
bool ExportCrvLine( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
||||
bool CalcGroupFilter( void) ;
|
||||
|
||||
private :
|
||||
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
|
||||
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
|
||||
Writer m_Writer ; // scrittore di file di testo
|
||||
ONX_Model m_model ; // modello opennurbs
|
||||
std::map<int,int> m_mLayer ; // mappa dei layer <indice layer nge, indice del componente layer nel modello 3dm>
|
||||
std::map<std::string,int> m_mMaterial ; // mappa dei materiali <stringa del colore ( R,G,B), indice del componente material nel modello 3dm>
|
||||
} ;
|
||||
+1306
File diff suppressed because it is too large
Load Diff
+62
@@ -0,0 +1,62 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Import3dm.h Data : 23.06.23 Versione : 2.5f1
|
||||
// Contenuto : Dichiarazione della classe Import3dm.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 23.06.23 DB Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EE3Import3dm.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkGeoObj.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Extern/opennurbs/Include/opennurbs.h"
|
||||
#include <utility>
|
||||
#include <map>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Import3dm : public IImport3dm
|
||||
{
|
||||
public :
|
||||
bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup,
|
||||
double dTextHeight = 2.0, double dExtLine = 5.0, double dArrLen = 5.0, double dTextDist = 2.0,
|
||||
bool bLenIsMM = true, int nDecDig = -2, std::string sFont = "ModernPropS.Nfe") override ;
|
||||
|
||||
private :
|
||||
Point3d ConvertPoint( const ON_Point& onPoint)
|
||||
{ return Point3d( onPoint.point.x, onPoint.point.y, onPoint.point.z) ; } ;
|
||||
Point3d ConvertPoint( const ON_3dPoint& on3dPoint)
|
||||
{ return Point3d( on3dPoint.x, on3dPoint.y, on3dPoint.z) ; } ;
|
||||
Point3d ConvertPoint( const ON_4dPoint& on4dPoint)
|
||||
{ return Point3d( on4dPoint.x, on4dPoint.y, on4dPoint.z) ; } ;
|
||||
Point3d ConvertPoint( const ON_3fPoint& on3fPoint)
|
||||
{ return Point3d( on3fPoint.x, on3fPoint.y, on3fPoint.z) ; } ;
|
||||
Vector3d ConvertVector( const ON_3dVector& onVector)
|
||||
{ return Vector3d( onVector.x, onVector.y, onVector.z) ; } ;
|
||||
Vector3d ConvertVector( const ON_2dVector& onVector)
|
||||
{ return Vector3d( onVector.x, onVector.y, 0) ; } ;
|
||||
ICurve* ConvertCurve( const ON_Curve* onCurve) ;
|
||||
ISurf* ConvertSurface( const ON_Surface* onSurf) ;
|
||||
ISurfTriMesh* ConvertExtrusion( const ON_Extrusion* onExtrusion) ;
|
||||
ISurfTriMesh* ConvertMesh( const ON_Mesh* onMesh) ;
|
||||
std::vector<PtrOwner<IGeoObj>> ConvertAnnotation( const ON_Annotation* onAnnot, const ON_DimStyle* onDimStyle, double dTextHeight, double dExtLine, double dArrLen, double dTextDist,
|
||||
bool bLenIsMM, int nDecDig, std::string sFont) ;
|
||||
ISURFPOVECTOR ConvertBrep( const ON_Brep* onBrep, const bool bForceTriMesh) ;
|
||||
ICurve* ConvertBrepLoop( const ON_BrepLoop* onBrepLoop) ;
|
||||
bool MakeUniform( ISurfFlatRegion** sfr, ON_NurbsSurface onNurbsSurface, double dScaleU, double dScaleV) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
int m_nIdGroup ;
|
||||
std::map< int, std::tuple<const ON_Layer*, ON_UUID, int, bool>> m_mLayer ; // mappa dei layer con id nel GDB e l'uuid nel modello 3dm, un int per l'indice del layer nel model e un bool che indica la presenza di sottolayer
|
||||
std::map< std::string, int> m_mError_count ;
|
||||
} ;
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : file di origine che include solo le inclusioni standard
|
||||
// EgtExchange.pch sarà l'intestazione precompilata
|
||||
// stdafx.obj conterrà le informazioni sui tipi precompilati
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: fare riferimento alle intestazioni aggiuntive necessarie in STDAFX.H
|
||||
// e non in questo file
|
||||
@@ -0,0 +1,37 @@
|
||||
// stdafx.h : file di inclusione per file di inclusione di sistema standard
|
||||
// o file di inclusione specifici del progetto utilizzati di frequente, ma
|
||||
// modificati raramente
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EgtTargetVer.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <tchar.h>
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
|
||||
// in Debug riconoscimento memory leakage
|
||||
#if defined( _DEBUG)
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
// in Debug controllo iteratori
|
||||
#if defined( _DEBUG)
|
||||
#define _SECURE_SCL 1
|
||||
#else
|
||||
#define _SECURE_SCL 0
|
||||
#endif
|
||||
|
||||
#include "/EgtDev/Include/EgtLibVer.h"
|
||||
|
||||
#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTEXTDIR "/opennurbs/Lib/opennurbs_public" EGTLIBVER ".lib")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user