Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b87b53d43 |
Binary file not shown.
+7
-7
@@ -23,19 +23,19 @@
|
|||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<ProjectGuid>{d1a76918-1e81-4851-9b6f-2b1db0efb2a4}</ProjectGuid>
|
<ProjectGuid>{d1a76918-1e81-4851-9b6f-2b1db0efb2a4}</ProjectGuid>
|
||||||
<RootNamespace>EgtExch3dm</RootNamespace>
|
<RootNamespace>EgtExch3dm</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<OpenMPSupport>false</OpenMPSupport>
|
<OpenMPSupport>false</OpenMPSupport>
|
||||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -133,7 +133,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
|
|||||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||||
<OpenMPSupport>false</OpenMPSupport>
|
<OpenMPSupport>false</OpenMPSupport>
|
||||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
@@ -165,7 +165,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -192,7 +192,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
|||||||
+72
-136
@@ -15,20 +15,30 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Export3dm.h"
|
#include "Export3dm.h"
|
||||||
#include "DllMain.h"
|
#include "DllMain.h"
|
||||||
#include "/EgtDev/Include/EGkGeoPoint3d.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/EGkCurveLine.h"
|
||||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
#include "/EgtDev/Include/EGkGeoObjType.h"
|
||||||
#include "/EgtDev/Include/EGkSurfBezier.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/Include/EGkExtText.h"
|
#include "/EgtDev/Include/EGkExtText.h"
|
||||||
#include "/EgtDev/Include/EGkExtDimension.h"
|
#include "/EgtDev/Include/EGkExtDimension.h"
|
||||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
#include "/EgtDev/Extern/opennurbs/Include/opennurbs.h"
|
||||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
|
||||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
//N.B.:
|
//N.B.:
|
||||||
@@ -287,16 +297,11 @@ Export3dm::AddObjectToModel( const IGdbIterator& iIter, ON_Object* onObject, con
|
|||||||
if ( pOnAttr == nullptr)
|
if ( pOnAttr == nullptr)
|
||||||
pOnAttr = new ON_3dmObjectAttributes() ;
|
pOnAttr = new ON_3dmObjectAttributes() ;
|
||||||
pOnAttr->m_layer_index = nLayer ;
|
pOnAttr->m_layer_index = nLayer ;
|
||||||
int nType = iIter.GetGeoType() ;
|
pOnAttr->m_name = ConvertString( sName).c_str() ;
|
||||||
string sCompleteName = sName ;
|
|
||||||
if ( nType == EXT_DIMENSION) {
|
|
||||||
sCompleteName = "dim_" + sCompleteName ;
|
|
||||||
}
|
|
||||||
pOnAttr->m_name = ConvertString( sCompleteName).c_str() ;
|
|
||||||
pOnAttr->SetColorSource( ON::color_from_object) ;
|
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
|
//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
|
// per noi invece 0 = trasparente, 100 = opaco
|
||||||
ON_Color onCol( cCol.GetIntRed(), cCol.GetIntGreen(), cCol.GetIntBlue(), Clamp( 255 - lround( cCol.GetIntAlpha() * 2.55), 0, 255)) ;
|
ON_Color onCol( cCol.GetIntRed(), cCol.GetIntGreen(), cCol.GetIntBlue(), abs( int( cCol.GetIntAlpha() * 2.55) - 255)) ;
|
||||||
pOnAttr->m_color = onCol ;
|
pOnAttr->m_color = onCol ;
|
||||||
// se è una mesh aggiungo il materiale
|
// se è una mesh aggiungo il materiale
|
||||||
if ( const ON_Mesh* onMesh = ON_Mesh::Cast( onObject)) {
|
if ( const ON_Mesh* onMesh = ON_Mesh::Cast( onObject)) {
|
||||||
@@ -310,7 +315,6 @@ Export3dm::AddObjectToModel( const IGdbIterator& iIter, ON_Object* onObject, con
|
|||||||
onMat->SetDiffuse( onCol) ;
|
onMat->SetDiffuse( onCol) ;
|
||||||
onMat->SetAmbient( onCAmb) ;
|
onMat->SetAmbient( onCAmb) ;
|
||||||
onMat->SetReflectivity( 0) ;
|
onMat->SetReflectivity( 0) ;
|
||||||
onMat->SetTransparency( Clamp( 255 - lround( cCol.GetIntAlpha() * 2.55), 0, 255)) ;
|
|
||||||
ON_ModelComponentReference mcr = m_model.AddManagedModelComponent( onMat) ;
|
ON_ModelComponentReference mcr = m_model.AddManagedModelComponent( onMat) ;
|
||||||
int nIndex = mcr.ModelComponentIndex() ;
|
int nIndex = mcr.ModelComponentIndex() ;
|
||||||
m_mMaterial.insert( pair< std::string, int>( sCol, nIndex)) ;
|
m_mMaterial.insert( pair< std::string, int>( sCol, nIndex)) ;
|
||||||
@@ -507,29 +511,16 @@ Export3dm::ExportSTM( const string& sName, const IGdbIterator& iIter, const Fram
|
|||||||
// lo porto nel frame globale
|
// lo porto nel frame globale
|
||||||
pSrfTm->ToGlob( frFrame) ;
|
pSrfTm->ToGlob( frFrame) ;
|
||||||
|
|
||||||
int nVertices = pSrfTm->GetVertexSize() ;
|
int nVertices = pSrfTm->GetVertexCount() ;
|
||||||
int nTriangles = pSrfTm->GetTriangleSize() ;
|
int nTriangles = pSrfTm->GetTriangleCount() ;
|
||||||
ON_Mesh* onMesh = new ON_Mesh ;
|
ON_Mesh* onMesh = new ON_Mesh ;
|
||||||
|
|
||||||
bool bOk = true ;
|
|
||||||
for ( int v = 0 ; v < nVertices ; ++v) {
|
for ( int v = 0 ; v < nVertices ; ++v) {
|
||||||
Point3d pt ; pSrfTm->GetVertex( v, pt) ;
|
Point3d pt ; pSrfTm->GetVertex( v, pt) ;
|
||||||
bOk = onMesh->SetVertex( v, ConvertPoint( pt)) ;
|
onMesh->SetVertex( v, ConvertPoint( pt)) ;
|
||||||
if ( ! bOk) {
|
|
||||||
LOG_ERROR( GetEE3Logger(), "Export3dm SurfTm: Error adding vertex")
|
|
||||||
bOk = true ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bOk = true ;
|
|
||||||
for ( int t = 0 ; t < nTriangles ; ++t) {
|
for ( int t = 0 ; t < nTriangles ; ++t) {
|
||||||
int nIdVert[3] ;
|
int nIdVert[3] ; pSrfTm->GetTriangle( t, nIdVert) ;
|
||||||
if ( ! pSrfTm->GetTriangle( t, nIdVert))
|
onMesh->SetTriangle( t, nIdVert[0], nIdVert[1], nIdVert[2]) ;
|
||||||
continue ;
|
|
||||||
bOk = onMesh->SetTriangle( t, nIdVert[0], nIdVert[1], nIdVert[2]) ;
|
|
||||||
if ( ! bOk) {
|
|
||||||
LOG_ERROR( GetEE3Logger(), "Export3dm SurfTm: Error adding triangle")
|
|
||||||
bOk = true ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ON_MeshVertexFaceMap onMeshVertMap ;
|
ON_MeshVertexFaceMap onMeshVertMap ;
|
||||||
onMeshVertMap.SetFromMesh( onMesh, false) ;
|
onMeshVertMap.SetFromMesh( onMesh, false) ;
|
||||||
@@ -751,44 +742,23 @@ Export3dm::ExportCrvLine( const string& sName, const IGdbIterator& iIter, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ON_Text*
|
std::vector<ON_PolyCurve*>
|
||||||
Export3dm::ConvertText( const IExtText* pText, const Frame3d& frDim)
|
Export3dm::ConvertText( const IExtText* pText)
|
||||||
{
|
{
|
||||||
string sText = pText->GetText() ;
|
// tolleranza lineare standard
|
||||||
wstring wText = wstring(sText.begin(), sText.end());
|
const double LIN_TOL_STD = 0.1 ;
|
||||||
const wchar_t* wcText = wText.c_str();
|
// deviazione angolare standard (in gradi)
|
||||||
ON_Text* ontText = new ON_Text() ;
|
const double ANG_TOL_STD_DEG = 15 ;
|
||||||
double dHeight = pText->GetHeight() ;
|
POLYLINELIST lPl ;
|
||||||
// controllo se esiste già un dim style con quell'altezza sennò lo creo
|
pText->ApproxWithLines( LIN_TOL_STD, ANG_TOL_STD_DEG, lPl) ;
|
||||||
ON_DimStyle onDimStyle = ON_DimStyle::SystemDimstyleFromIndex( -1) ; // default
|
vector<ON_PolyCurve*> vOnPolyCrv ;
|
||||||
const ON_DimStyle* onDimStyleNew = nullptr ;
|
for ( PolyLine pl : lPl) {
|
||||||
ONX_ModelComponentIterator component_iterator_ds( m_model, ON_ModelComponent::Type::DimStyle) ;
|
PtrOwner<ICurveComposite> pCC( CreateCurveComposite()) ;
|
||||||
bool bFound = false ;
|
pCC->FromPolyLine( pl) ;
|
||||||
for ( const ON_ModelComponent* mc = component_iterator_ds.FirstComponent() ; mc != nullptr ; mc = component_iterator_ds.NextComponent()) {
|
ON_PolyCurve* onPolyCrv = ConvertCrvCompo( pCC) ;
|
||||||
const ON_DimStyle* onDim = ON_DimStyle::Cast( mc) ;
|
vOnPolyCrv.push_back( onPolyCrv) ;
|
||||||
double dTextHeight = onDim->TextHeight() ;
|
|
||||||
if ( abs( dHeight - dTextHeight) < 0.1 ) {
|
|
||||||
onDimStyle = *onDim ;
|
|
||||||
bFound = true ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( ! bFound) {
|
return vOnPolyCrv ;
|
||||||
ON_DimStyle onDimStyleOver = onDimStyle.CreateOverrideCandidate() ;
|
|
||||||
onDimStyleOver.SetFieldOverride( ON_DimStyle::field::TextHeight, true) ;
|
|
||||||
onDimStyleOver.SetTextHeight( dHeight) ;
|
|
||||||
ON_ModelComponentReference mcr = m_model.AddModelComponent( onDimStyleOver, true) ;
|
|
||||||
onDimStyleNew = ON_DimStyle::FromModelComponentRef( mcr, nullptr) ;
|
|
||||||
}
|
|
||||||
// il punto di riferimento di rhino è in alto a sinistra, mentre il nostro è in basso a sinistra
|
|
||||||
Point3d pt ; pText->GetOverStartPoint( pt) ;
|
|
||||||
ON_Plane onPlane( ConvertPoint( pt), ConvertVector(frDim.VersX()), ConvertVector(frDim.VersY())) ;
|
|
||||||
BBox3d bbox3d ; pText->GetBBox( GLOB_FRM, bbox3d, 0) ;
|
|
||||||
if ( onDimStyleNew != nullptr)
|
|
||||||
ontText->Create( wcText, onDimStyleNew, onPlane, true, bbox3d.GetDimX() * 10, 0.) ;
|
|
||||||
else
|
|
||||||
ontText->Create( wcText, &onDimStyle, onPlane, true, bbox3d.GetDimX() * 10, 0.) ;
|
|
||||||
return ontText ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -805,76 +775,35 @@ Export3dm::ExportText( const string& sName, const IGdbIterator& iIter, const Fra
|
|||||||
return false ;
|
return false ;
|
||||||
// lo porto nel frame globale
|
// lo porto nel frame globale
|
||||||
pText->ToGlob( frFrame) ;
|
pText->ToGlob( frFrame) ;
|
||||||
|
vector<ON_PolyCurve*> vOnPolyCrv = ConvertText( pText) ;
|
||||||
ON_Text* onText = ConvertText( pText, frFrame) ;
|
// aggiungo l'oggetto al modello
|
||||||
|
bool bOk = true ;
|
||||||
return AddObjectToModel( iIter, onText, nLayer, sName, cCol) ;
|
for ( ON_PolyCurve* onPolyCrv : vOnPolyCrv) {
|
||||||
|
bOk = bOk && AddObjectToModel( iIter, onPolyCrv, nLayer, sName, cCol) ;
|
||||||
|
if ( ! bOk)
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ON_Dimension*
|
std::vector<ON_PolyCurve*>
|
||||||
Export3dm::ConvertExtDimension( const IExtDimension* pExtDim, const Frame3d& frDim)
|
Export3dm::ConvertExtDimension( const IExtDimension* pExtDim)
|
||||||
{
|
{
|
||||||
const ON_DimStyle onDimStyle = ON_DimStyle::DimStyleOrDefault( nullptr) ;
|
// tolleranza lineare standard
|
||||||
ON_UUID onIdDim = onDimStyle.Id() ;
|
const double LIN_TOL_STD = 0.1 ;
|
||||||
// versione con le classi di Rhino
|
// deviazione angolare standard (in gradi)
|
||||||
string sSubType = pExtDim->GetSubType() ;
|
const double ANG_TOL_STD_DEG = 15 ;
|
||||||
if ( sSubType == "Linear") {
|
POLYLINELIST lPl ;
|
||||||
ON_Plane onPlane(ConvertPoint( frDim.Orig()), ConvertVector( frDim.VersX()), ConvertVector( frDim.VersY())) ;
|
pExtDim->ApproxWithLines( LIN_TOL_STD, ANG_TOL_STD_DEG, lPl) ;
|
||||||
ON_DimLinear* onDimLinear( new ON_DimLinear()) ;
|
vector<ON_PolyCurve*> vOnPolyCrv ;
|
||||||
ON_3dPoint onPt1 = ConvertPoint( pExtDim->GetStart()) ;
|
for ( PolyLine pl : lPl) {
|
||||||
ON_3dPoint onPt2 = ConvertPoint( pExtDim->GetEnd()) ;
|
PtrOwner<ICurveComposite> pCC( CreateCurveComposite()) ;
|
||||||
ON_3dPoint onPtDim = ConvertPoint( pExtDim->GetPosition()) ;
|
pCC->FromPolyLine( pl) ;
|
||||||
Vector3d vtDir = pExtDim->GetDirVersor() ;
|
ON_PolyCurve* onPolyCrv = ConvertCrvCompo( pCC) ;
|
||||||
|
vOnPolyCrv.push_back( onPolyCrv) ;
|
||||||
// aligned
|
|
||||||
if ( ! AreSameVectorApprox( vtDir, X_AX) && ! AreSameVectorApprox( vtDir, Y_AX))
|
|
||||||
ON_DimLinear::CreateAligned( onPt1, onPt2, onPtDim, ConvertVector( frDim.VersZ()), onIdDim, onDimLinear) ;
|
|
||||||
//horizontal o vertical
|
|
||||||
else {
|
|
||||||
ON_3dPoint onPtDim2 = onPtDim + ConvertVector( vtDir) ;
|
|
||||||
ON_DimLinear::CreateRotated( onPt1, onPt2, ON_Line( onPtDim, onPtDim2), ConvertVector( frDim.VersZ()), onIdDim, onDimLinear) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return onDimLinear ;
|
|
||||||
}
|
}
|
||||||
else if ( sSubType == "Radial" || sSubType == "Diametral") {
|
return vOnPolyCrv ;
|
||||||
ON_Plane onPlane(ConvertPoint( frDim.Orig()), ConvertVector( frDim.VersX()), ConvertVector( frDim.VersY())) ;
|
|
||||||
ON_DimRadial* onDimRadial( new ON_DimRadial()) ;
|
|
||||||
ON_3dPoint onPtV = ConvertPoint( pExtDim->GetStart()) ;
|
|
||||||
ON_3dPoint onPtPos = ConvertPoint( pExtDim->GetEnd()) ;
|
|
||||||
//ON_3dPoint onPtDim = ConvertPoint( pExtDim->GetPosition()) ;
|
|
||||||
Vector3d vtDir = pExtDim->GetDirVersor() ;
|
|
||||||
ON_3dPoint onPtDim = onPtPos + ConvertVector( vtDir) * ( onPtPos - onPtV).Length() / 10. ; // allontano la misura dall'arco di un decimo del raggio
|
|
||||||
double dRot = 0 ;
|
|
||||||
if ( ! AreSameVectorApprox( vtDir, X_AX))
|
|
||||||
X_AX.GetAngleXY(vtDir, dRot) ;
|
|
||||||
if ( sSubType == "Radial")
|
|
||||||
onDimRadial->Create( ON::AnnotationType::Radius, onIdDim, onPlane, onPtV, onPtPos, onPtDim) ;
|
|
||||||
else if ( sSubType == "Diametral")
|
|
||||||
onDimRadial->Create( ON::AnnotationType::Diameter, onIdDim, onPlane, onPtV, onPtPos, onPtDim) ;
|
|
||||||
return onDimRadial ;
|
|
||||||
}
|
|
||||||
else if ( sSubType == "Angular") {
|
|
||||||
ON_Plane onPlane(ConvertPoint( frDim.Orig()), ConvertVector( frDim.VersX()), ConvertVector( frDim.VersY())) ;
|
|
||||||
ON_DimAngular* onDimAngular( new ON_DimAngular()) ;
|
|
||||||
ON_3dPoint onPtV = ConvertPoint( pExtDim->GetStart()) ;
|
|
||||||
ON_3dPoint onPt1 = ConvertPoint( pExtDim->GetOverStart()) ;
|
|
||||||
ON_3dPoint onPt2 = ConvertPoint( pExtDim->GetOverEnd()) ;
|
|
||||||
ON_3dPoint onPtDim = ConvertPoint( pExtDim->GetPosition()) ;
|
|
||||||
Vector3d vtDir = pExtDim->GetDirVersor() ;
|
|
||||||
double dRot = 0 ;
|
|
||||||
if ( ! AreSameVectorApprox( vtDir, X_AX))
|
|
||||||
X_AX.GetAngleXY(vtDir, dRot) ;
|
|
||||||
// per arco
|
|
||||||
//onDimAngular->Create( onIdDim, onPlane, ConvertVector( frDim.VersX()), onPtV, onPt1, onPt2, onPtDim) ;
|
|
||||||
|
|
||||||
// con linee prolungate fino al vertice
|
|
||||||
onDimAngular->Create( onIdDim, onPlane, ConvertVector( frDim.VersX()), onPtV, onPtV, onPt1, onPt2, onPtDim) ;
|
|
||||||
return onDimAngular ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -891,8 +820,15 @@ Export3dm::ExportDimension( const string& sName, const IGdbIterator& iIter, cons
|
|||||||
return false ;
|
return false ;
|
||||||
// lo porto nel frame globale
|
// lo porto nel frame globale
|
||||||
pExtDim->ToGlob( frFrame) ;
|
pExtDim->ToGlob( frFrame) ;
|
||||||
|
vector<ON_PolyCurve*> vOnPolyCrv = ConvertExtDimension( pExtDim) ;
|
||||||
return AddObjectToModel( iIter, ConvertExtDimension( pExtDim, frFrame), nLayer, sName, cCol) ;
|
// aggiungo l'oggetto al modello
|
||||||
|
bool bOk = true ;
|
||||||
|
for ( ON_PolyCurve* onPolyCrv : vOnPolyCrv) {
|
||||||
|
bOk = bOk && AddObjectToModel( iIter, onPolyCrv, nLayer, sName, cCol) ;
|
||||||
|
if ( ! bOk)
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|||||||
+4
-2
@@ -16,6 +16,7 @@
|
|||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
|
||||||
#include "/EgtDev/Include/EE3Export3dm.h"
|
#include "/EgtDev/Include/EE3Export3dm.h"
|
||||||
|
#include "/EgtDev/Include/EGnWriter.h"
|
||||||
#include "/EgtDev/Include/EGkGeoObj.h"
|
#include "/EgtDev/Include/EGkGeoObj.h"
|
||||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||||
#include "/EgtDev/Include/EGkFrame3d.h"
|
#include "/EgtDev/Include/EGkFrame3d.h"
|
||||||
@@ -57,8 +58,8 @@ class Export3dm : public IExport3dm
|
|||||||
ON_ArcCurve* ConvertCrvArc( const ICurveArc* pCrvArc) ;
|
ON_ArcCurve* ConvertCrvArc( const ICurveArc* pCrvArc) ;
|
||||||
ON_LineCurve* ConvertCrvLine( const ICurveLine* pCrvL) ;
|
ON_LineCurve* ConvertCrvLine( const ICurveLine* pCrvL) ;
|
||||||
ON_PolyCurve* ConvertCrvCompo( const ICurveComposite* pCC) ;
|
ON_PolyCurve* ConvertCrvCompo( const ICurveComposite* pCC) ;
|
||||||
ON_Text* ConvertText( const IExtText* pText, const Frame3d& frDim) ;
|
VONPOLYCRV ConvertText( const IExtText* pCrvL) ;
|
||||||
ON_Dimension* ConvertExtDimension( const IExtDimension* pExtDim, const Frame3d& frDim) ;
|
VONPOLYCRV ConvertExtDimension( const IExtDimension* pExtDim) ;
|
||||||
bool ExportPnt( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
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 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 ExportSTM( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
||||||
@@ -73,6 +74,7 @@ class Export3dm : public IExport3dm
|
|||||||
private :
|
private :
|
||||||
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
|
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
|
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
|
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<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>
|
std::map<std::string,int> m_mMaterial ; // mappa dei materiali <stringa del colore ( R,G,B), indice del componente material nel modello 3dm>
|
||||||
|
|||||||
+403
-644
File diff suppressed because it is too large
Load Diff
+6
-17
@@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define NOMINMAX
|
|
||||||
|
|
||||||
#include "/EgtDev/Include/EE3Import3dm.h"
|
#include "/EgtDev/Include/EE3Import3dm.h"
|
||||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||||
@@ -47,29 +45,20 @@ class Import3dm : public IImport3dm
|
|||||||
Vector3d ConvertVector( const ON_2dVector& onVector)
|
Vector3d ConvertVector( const ON_2dVector& onVector)
|
||||||
{ return Vector3d( onVector.x, onVector.y, 0) ; } ;
|
{ return Vector3d( onVector.x, onVector.y, 0) ; } ;
|
||||||
ICurve* ConvertCurve( const ON_Curve* onCurve) ;
|
ICurve* ConvertCurve( const ON_Curve* onCurve) ;
|
||||||
ISurf* ConvertSurface( const ON_Surface* onSurf, DBLVECTOR* vU = nullptr, DBLVECTOR* vV = nullptr) ;
|
ISurf* ConvertSurface( const ON_Surface* onSurf) ;
|
||||||
ISURFPOVECTOR ConvertExtrusion( const ON_Extrusion* onExtrusion) ;
|
ISurfTriMesh* ConvertExtrusion( const ON_Extrusion* onExtrusion) ;
|
||||||
ISurfTriMesh* ConvertMesh( const ON_Mesh* onMesh) ;
|
ISurfTriMesh* ConvertMesh( const ON_Mesh* onMesh) ;
|
||||||
std::vector<PtrOwner<IGeoObj>> ConvertAnnotation( const ON_Annotation* onAnnot, const ON_DimStyle* onDimStyle) ;
|
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) ;
|
ISURFPOVECTOR ConvertBrep( const ON_Brep* onBrep, const bool bForceTriMesh) ;
|
||||||
ICurve* ConvertBrepLoop( const ON_BrepLoop* onBrepLoop) ;
|
ICurve* ConvertBrepLoop( const ON_BrepLoop* onBrepLoop) ;
|
||||||
ICurveComposite* ApproxTrim( ICurve* pCrv) ;
|
ICurveComposite* ApproxTrim( ICurve* pCrv) ;
|
||||||
|
bool MakeUniform( ISurfFlatRegion** sfr, ON_NurbsSurface onNurbsSurface, double dScaleU, double dScaleV, bool& bRescaled, bool bRetry = false) ;
|
||||||
bool ConvertCurveParam( const ON_RevSurface* onRevSurf, ICurve** pCrv) ;
|
bool ConvertCurveParam( const ON_RevSurface* onRevSurf, ICurve** pCrv) ;
|
||||||
std::string ConvertONwStringToString( ON_wString ON_wString) ;
|
|
||||||
bool ConvertGeometry( const ON_Object* oGeometry, std::vector<PtrOwner<IGeoObj>>& vpGeoObj) ;
|
|
||||||
bool ConvertInstanceReference( const ON_InstanceRef* iref, const ON_Xform& xf, std::vector<PtrOwner<IGeoObj>>& vpGeoObj) ;
|
|
||||||
|
|
||||||
private :
|
private :
|
||||||
ONX_Model m_model ;
|
|
||||||
IGeomDB* m_pGDB ;
|
IGeomDB* m_pGDB ;
|
||||||
int m_nIdGroup ;
|
int m_nIdGroup ;
|
||||||
std::map< int, std::tuple<const ON_Layer*, ON_UUID, int, int, int>> m_mLayer ; // mappa dei layer con id nel GDB e l'uuid nel modello 3dm, un int per l'indice del layer nel model, un int che indica la profondità del layer ( Root = 0, Part = 1, layer = 2), un int che è l'indice del layer ausiliario se avevo un Part senza layer ( lo aggiungo io e finché non l'ho aggiunto questo int è settato a -1)
|
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 ;
|
std::map< std::string, int> m_mError_count ;
|
||||||
double m_dTextHeight ;
|
|
||||||
double m_dExtLine ;
|
|
||||||
double m_dArrLen ;
|
|
||||||
double m_dTextDist ;
|
|
||||||
bool m_bLenIsMM ;
|
|
||||||
int m_nDecDig ;
|
|
||||||
std::string m_sFont ;
|
|
||||||
} ;
|
} ;
|
||||||
Reference in New Issue
Block a user