EgtExch3dm :
- aggiunta la gestione della dimensione del testo durante l'export. - aggiornato l'input per una funzione di Swept che è stata modificata nel GeomKernel.
This commit is contained in:
+26
-3
@@ -755,13 +755,36 @@ Export3dm::ConvertText( const IExtText* pText, const Frame3d& frDim)
|
||||
wstring wText = wstring(sText.begin(), sText.end());
|
||||
const wchar_t* wcText = wText.c_str();
|
||||
ON_Text* ontText = new ON_Text() ;
|
||||
const ON_DimStyle onDimStyle = ON_DimStyle::DimStyleOrDefault( nullptr) ;
|
||||
double dHeight = pText->GetHeight() ;
|
||||
// controllo se esiste già un dim style con quell'altezza sennò lo creo
|
||||
ON_DimStyle onDimStyle = ON_DimStyle::SystemDimstyleFromIndex( -1) ; // default
|
||||
const ON_DimStyle* onDimStyleNew = nullptr ;
|
||||
ONX_ModelComponentIterator component_iterator_ds( m_model, ON_ModelComponent::Type::DimStyle) ;
|
||||
bool bFound = false ;
|
||||
for ( const ON_ModelComponent* mc = component_iterator_ds.FirstComponent() ; mc != nullptr ; mc = component_iterator_ds.NextComponent()) {
|
||||
const ON_DimStyle* onDim = ON_DimStyle::Cast( mc) ;
|
||||
double dTextHeight = onDim->TextHeight() ;
|
||||
if ( abs( dHeight - dTextHeight) < 0.1 ) {
|
||||
onDimStyle = *onDim ;
|
||||
bFound = true ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ( ! bFound) {
|
||||
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
|
||||
// per mettere il testo nella stessa posizione mi serve l'altezza che verrà usata in Rhino
|
||||
Point3d pt ; pText->GetOverStartPoint( pt) ;
|
||||
ON_Plane onPlane( ConvertPoint( pt), ConvertVector(frDim.VersX()), ConvertVector(frDim.VersY())) ;
|
||||
BBox3d bbox3d ; pText->GetBBox( GLOB_FRM, bbox3d, 0) ;
|
||||
ontText->Create( wcText, &onDimStyle, onPlane, true, bbox3d.GetDimX(), 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 ;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -632,7 +632,7 @@ Import3dm::ConvertSurface( const ON_Surface* onSurf)
|
||||
PtrOwner<ON_Curve> onpCrvSouth( onSumSurface->IsoCurve(0, onIntDomain1[0])) ;
|
||||
PtrOwner<ICurve> pCrvWest( ConvertCurve( onpCrvWest)) ;
|
||||
PtrOwner<ICurve> pCrvSouth( ConvertCurve( onpCrvSouth)) ;
|
||||
PtrOwner<ISurfTriMesh> pSurfTm ( GetSurfTriMeshSwept( pCrvSouth, pCrvWest, V_NULL, false)) ;
|
||||
PtrOwner<ISurfTriMesh> pSurfTm ( GetSurfTriMeshSwept( pCrvSouth, pCrvWest, false, false)) ;
|
||||
if ( ! IsNull( pSurfTm) && pSurfTm->IsValid())
|
||||
return Release( pSurfTm) ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user