Merge branch 'release/AlzatineFrontalini'
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Imports EgtUILib
|
||||
Imports System.Collections.ObjectModel
|
||||
Public Class SingleDrillUC
|
||||
' Riferimenti a pagine
|
||||
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
||||
@@ -37,6 +38,8 @@ Public Class SingleDrillUC
|
||||
|
||||
Private m_dDiameter As Double = 0
|
||||
|
||||
Private m_sCurrDrill As String = String.Empty
|
||||
|
||||
' Costanti
|
||||
Private Const MAX_TAB_DEPTH As Double = 10.0
|
||||
Private Const MIN_CUT_LEN As Double = 10.0
|
||||
@@ -67,8 +70,11 @@ Public Class SingleDrillUC
|
||||
End Sub
|
||||
|
||||
Private Sub SingleDrill_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
m_sCurrDrill = m_CurrentMachine.sCurrDrill
|
||||
GetDrillFromDrilling(m_sCurrDrill)
|
||||
|
||||
' recupero informazioni del foretto usato
|
||||
EgtTdbSetCurrTool(m_CurrentMachine.sCurrDrill)
|
||||
EgtTdbSetCurrTool(m_sCurrDrill)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.DIAM, m_dDiameter)
|
||||
|
||||
' Attivo la pagina
|
||||
@@ -215,7 +221,7 @@ Public Class SingleDrillUC
|
||||
If Not m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2) Then Return
|
||||
|
||||
' Ricavo dati Foretto corrente
|
||||
Dim sDrill As String = m_MainWindow.m_CurrentMachine.sCurrDrill
|
||||
Dim sDrill As String = m_sCurrDrill
|
||||
' Se punto da laser
|
||||
If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
|
||||
' Imposto come testa corrente il laser (senza utensile ovviamente)
|
||||
@@ -245,9 +251,9 @@ Public Class SingleDrillUC
|
||||
m_ptTipP1.ToLoc(New Frame3d(m_ptTabOri))
|
||||
m_bPointP1Ok = True
|
||||
' Ricavo dati lama corrente
|
||||
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrDrill
|
||||
Dim sDrill As String = m_sCurrDrill
|
||||
' Imposto la lama corrente
|
||||
If Not EgtSetCalcTool(sSaw, "H1", 1) Then Return
|
||||
If Not EgtSetCalcTool(sDrill, "H1", 1) Then Return
|
||||
End If
|
||||
|
||||
' Disegno il taglio
|
||||
@@ -261,6 +267,42 @@ Public Class SingleDrillUC
|
||||
Point1Btn.IsChecked = True
|
||||
End Sub
|
||||
|
||||
Private Function GetDrillFromDrilling(ByRef sCurrDrill As String)
|
||||
If String.IsNullOrEmpty(sCurrDrill) Or String.IsNullOrWhiteSpace(sCurrDrill) Then
|
||||
' creo l'elenco degli utensili di foratura
|
||||
Dim sToolName As String = String.Empty
|
||||
Dim nType As Integer = MCH_TY.NONE
|
||||
Dim DrillToolList As New ObservableCollection(Of String)
|
||||
DrillToolList.Clear()
|
||||
If EgtTdbGetFirstTool(MCH_TF.DRILLBIT, sToolName, nType) Then
|
||||
DrillToolList.Add(sToolName)
|
||||
While EgtTdbGetNextTool(MCH_TF.DRILLBIT, sToolName, nType)
|
||||
DrillToolList.Add(sToolName)
|
||||
End While
|
||||
End If
|
||||
' recupero l'utensile associato alla lavorazione
|
||||
Dim sCurrDrilling As String = m_MainWindow.m_CurrentMachine.sCurrDrilling
|
||||
Dim ToolString As String = String.Empty
|
||||
EgtMdbSetCurrMachining(sCurrDrilling)
|
||||
' Recupero nome utensile tramite TUUID
|
||||
Dim sTuuid As String = String.Empty
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTuuid)
|
||||
EgtTdbGetToolFromUUID(sTuuid, ToolString)
|
||||
Dim bToolExist As Boolean = False
|
||||
For Each CurrTool As IEnumerable In DrillToolList
|
||||
If CurrTool.ToString() = ToolString Then
|
||||
bToolExist = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If bToolExist Then
|
||||
sCurrDrill = ToolString
|
||||
Else
|
||||
sCurrDrill = String.Empty
|
||||
End If
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Sub XcoordTxBx_EgtClosed(sender As Object, e As EventArgs) Handles XcoordTxBx.EgtClosed
|
||||
' Recupero il valore della coordinata (in 0 Tab)
|
||||
Dim dXcoord As Double = 0
|
||||
@@ -354,10 +396,11 @@ Public Class SingleDrillUC
|
||||
' Spessore grezzo
|
||||
Dim dRawHeight As Double = m_ptRawMax.z - m_ptRawMin.z
|
||||
' Recupero spessore lama corrente
|
||||
Dim sDrill As String = m_MainWindow.m_CurrentMachine.sCurrDrill
|
||||
Dim sDrill As String = m_sCurrDrill
|
||||
GetDrillFromDrilling(sDrill)
|
||||
EgtTdbSetCurrTool(sDrill)
|
||||
Dim dThick As Double = 0
|
||||
EgtTdbGetCurrToolParam(MCH_TP.THICK, dThick)
|
||||
Dim dDiam As Double = 0
|
||||
EgtTdbGetCurrToolParam(MCH_TP.DIAM, dDiam)
|
||||
' Rimuovo eventuale vecchio pezzo per taglio diretto
|
||||
EraseDirectCutPart()
|
||||
' Disattivo eventuali lavorazioni presenti
|
||||
|
||||
@@ -141,72 +141,41 @@ Public Class AlzFrontUC
|
||||
|
||||
' inserisco il lato nella lista
|
||||
While CurrLine <> GDB_ID.NULL
|
||||
|
||||
Dim NextId As Integer = EgtGetNext(CurrLine)
|
||||
If NextId = GDB_ID.NULL Then NextId = EgtGetFirstInGroup(LoopId)
|
||||
If VerifySideAnglePossible(PrevLine, CurrLine, NextId, bOutLoop) Then
|
||||
' Aggiungo il lato alla lista di quelli su cui è possibile mettere una alzatina o un frontalino
|
||||
Dim sNameCurrLine As String = String.Empty
|
||||
Dim nInfo As Integer = 0
|
||||
Dim dSideAng As Integer = 0
|
||||
EgtSetName(CurrLine, "A" & nEntityIndex.ToString)
|
||||
EgtGetName(CurrLine, sNameCurrLine)
|
||||
' inserisco la numerazione dei lati della figura
|
||||
AddTextToLine(sNameCurrLine, LabelId, CurrLine, 20, m_dBBoxRad, True)
|
||||
' recupero l'informazione
|
||||
EgtGetInfo(CurrLine, INFO_ALZFRONT, nInfo)
|
||||
If nInfo = 1 Then
|
||||
AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine, AlzFrontEntity.AlzFront.ALZATINA))
|
||||
ElseIf nInfo = 2 Then
|
||||
AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine, AlzFrontEntity.AlzFront.FRONTALINO))
|
||||
|
||||
If ApprovedSideToAlzFront(CurrLine) Then
|
||||
' Aggiungo il lato alla lista di quelli su cui è possibile mettere una alzatina o un frontalino
|
||||
Dim sNameCurrLine As String = String.Empty
|
||||
Dim nInfo As Integer = 0
|
||||
Dim dSideAng As Integer = 0
|
||||
EgtSetName(CurrLine, "A" & nEntityIndex.ToString)
|
||||
EgtGetName(CurrLine, sNameCurrLine)
|
||||
' inserisco la numerazione dei lati della figura
|
||||
AddTextToLine(sNameCurrLine, LabelId, CurrLine, 20, m_dBBoxRad, True)
|
||||
' recupero l'informazione
|
||||
EgtGetInfo(CurrLine, INFO_ALZFRONT, nInfo)
|
||||
If nInfo = 1 Then
|
||||
AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine, AlzFrontEntity.AlzFront.ALZATINA))
|
||||
ElseIf nInfo = 2 Then
|
||||
AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine, AlzFrontEntity.AlzFront.FRONTALINO))
|
||||
Else
|
||||
AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine))
|
||||
End If
|
||||
' inserisco riferimento univoco al lato (solo se non esiste)
|
||||
Dim sInfoRef As String = String.Empty
|
||||
EgtGetInfo(CurrLine, "RefAF", sInfoRef)
|
||||
If String.IsNullOrEmpty(sInfoRef) Then
|
||||
Dim sRefGUID As String = System.Guid.NewGuid().ToString()
|
||||
EgtSetInfo(CurrLine, "RefAF", sRefGUID)
|
||||
End If
|
||||
nEntityIndex += 1
|
||||
Else
|
||||
AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine))
|
||||
EgtSetName(CurrLine, "B" & nOtherIndex.ToString)
|
||||
nOtherIndex = nOtherIndex + 1
|
||||
End If
|
||||
' inserisco riferimento univoco al lato (solo se non esiste)
|
||||
Dim sInfoRef As String = String.Empty
|
||||
EgtGetInfo(CurrLine, "RefAF", sInfoRef)
|
||||
If String.IsNullOrEmpty(sInfoRef) Then
|
||||
Dim sRefGUID As String = System.Guid.NewGuid().ToString()
|
||||
EgtSetInfo(CurrLine, "RefAF", sRefGUID)
|
||||
End If
|
||||
nEntityIndex += 1
|
||||
Else
|
||||
EgtSetName(CurrLine, "B" & nOtherIndex.ToString)
|
||||
nOtherIndex = nOtherIndex + 1
|
||||
End If
|
||||
|
||||
' ' escludo tutte le forme che non sono delle linee
|
||||
' If EgtGetType(CurrLine) = GDB_TY.CRV_LINE Then
|
||||
' ' Aggiungo il lato alla lista di quelli su cui è possibile mettere una alzatina o un frontalino
|
||||
' Dim sNameCurrLine As String = String.Empty
|
||||
' Dim nInfo As Integer = 0
|
||||
' Dim dSideAng As Integer = 0
|
||||
' EgtSetName(CurrLine, "A" & nEntityIndex.ToString)
|
||||
' EgtGetName(CurrLine, sNameCurrLine)
|
||||
' ' inserisco la numerazione dei lati della figura
|
||||
' AddTextToLine(sNameCurrLine, LabelId, CurrLine, 20, m_dBBoxRad, True)
|
||||
' ' recupero l'informazione
|
||||
' EgtGetInfo(CurrLine, INFO_ALZFRONT, nInfo)
|
||||
' If nInfo = 1 Then
|
||||
' AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine, AlzFrontEntity.AlzFront.ALZATINA))
|
||||
' ElseIf nInfo = 2 Then
|
||||
' AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine, AlzFrontEntity.AlzFront.FRONTALINO))
|
||||
' Else
|
||||
' AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine))
|
||||
' End If
|
||||
' ' inserisco riferimento univoco al lato (solo se non esiste)
|
||||
' Dim sInfoRef As String = String.Empty
|
||||
' EgtGetInfo(CurrLine, "RefAF", sInfoRef)
|
||||
' If String.IsNullOrEmpty(sInfoRef) Then
|
||||
' Dim sRefGUID As String = System.Guid.NewGuid().ToString()
|
||||
' EgtSetInfo(CurrLine, "RefAF", sRefGUID)
|
||||
' End If
|
||||
' nEntityIndex += 1
|
||||
'Else
|
||||
' EgtSetName(CurrLine, "B" & nOtherIndex.ToString)
|
||||
' nOtherIndex = nOtherIndex + 1
|
||||
'End If
|
||||
|
||||
PrevLine = CurrLine
|
||||
CurrLine = EgtGetNext(CurrLine)
|
||||
End While
|
||||
@@ -310,6 +279,44 @@ Public Class AlzFrontUC
|
||||
bInternalSelection = False
|
||||
End Sub
|
||||
|
||||
' restituisce vero se il lato possiede delle info legate al sideangle
|
||||
Private Function VerifyIsThereSideAngle(nCurrLine As Integer) As Boolean
|
||||
Dim sInfoSideAngle As String = String.Empty
|
||||
EgtGetInfo(nCurrLine, INFO_SIDE_ANGLE, sInfoSideAngle)
|
||||
If Not String.IsNullOrWhiteSpace(sInfoSideAngle) Or Not String.IsNullOrEmpty(sInfoSideAngle) Then
|
||||
' verifico che il dato salvato sia un double
|
||||
Try
|
||||
Dim dSideAngle As Double = 0
|
||||
StringToDouble(sInfoSideAngle, dSideAngle)
|
||||
If dSideAngle <> 0 Then
|
||||
Return True
|
||||
End If
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' restituisce vero se il lato possiede delle info legate alle alette
|
||||
Private Function VerifyIsThereAlzFront(nCurrLine As Integer) As Boolean
|
||||
Dim sInfoAlzFront As String = String.Empty
|
||||
EgtGetInfo(nCurrLine, INFO_ALZFRONT, sInfoAlzFront)
|
||||
If Not String.IsNullOrWhiteSpace(sInfoAlzFront) Or Not String.IsNullOrEmpty(sInfoAlzFront) Then
|
||||
If sInfoAlzFront.Trim <> "0" Then
|
||||
Return True
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' approvo la costruzione dell'aletta sul lato indicato
|
||||
Private Function ApprovedSideToAlzFront(nCurrLine As Integer) As Boolean
|
||||
If VerifyIsThereSideAngle(nCurrLine) And Not VerifyIsThereAlzFront(nCurrLine) Then
|
||||
' se esiste SideAngle e un'aletta allora NON approvo
|
||||
Return False
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' Permette di aggiugere accanto alla linea passata
|
||||
Friend Function AddTextToLine(sText As String, TextLayer As Integer, CurrLine As Integer, dDistance As Double,
|
||||
|
||||
@@ -62,5 +62,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.3.11.5")>
|
||||
<Assembly: AssemblyFileVersion("2.3.11.5")>
|
||||
<Assembly: AssemblyVersion("2.3.12.1")>
|
||||
<Assembly: AssemblyFileVersion("2.3.12.1")>
|
||||
|
||||
@@ -614,6 +614,14 @@ Friend Module VeinMatching
|
||||
' Sistemo il colore
|
||||
Dim colAqua As New Color3d(0, 255, 255, 25)
|
||||
EgtSetColor(nRegId, colAqua)
|
||||
|
||||
' ripeto per il solido
|
||||
Dim nSolidId As Integer = GetVeinPartSolidId(nId)
|
||||
EgtRemoveTextureData(nSolidId)
|
||||
Dim colSolid As Color3d
|
||||
EgtGetColor(EgtGetParent(nRegId), colSolid)
|
||||
EgtSetColor(nSolidId, colSolid)
|
||||
|
||||
' Se richiesto, eseguo deselezione
|
||||
If bDeselect Then EgtDeselectObj(nId)
|
||||
End If
|
||||
@@ -698,6 +706,21 @@ Friend Module VeinMatching
|
||||
LinkReferencesOnAlette()
|
||||
|
||||
EgtSetCurrentContext(m_nVeinCtx)
|
||||
|
||||
' costruisco tutti i piani cucina
|
||||
Dim nId As Integer = EgtGetFirstPart()
|
||||
While nId <> GDB_ID.NULL
|
||||
Dim sInfoName As String = String.Empty
|
||||
EgtGetInfo(nId, "CMP", sInfoName)
|
||||
' verifico che il pezzo sia una piano cucina
|
||||
If sInfoName.Contains("PCucina") Then
|
||||
If Not CreateKitchenTop(nId, ThicknessRaw) Then Return False
|
||||
End If
|
||||
' altrimenti passo al pezzo successivo
|
||||
nId = EgtGetNextPart(nId)
|
||||
End While
|
||||
|
||||
' costruisco alzatine e frontalini
|
||||
Dim Item As Aletta
|
||||
For Each Item In m_ListAlzFront
|
||||
' verifico che il disegno 3D non sia già stato fatto
|
||||
@@ -706,16 +729,207 @@ Friend Module VeinMatching
|
||||
If nInfo3D <> 1 Then
|
||||
EgtSetInfo(Item.SideId, "Info3D", 1)
|
||||
' creo il solido
|
||||
If Not CreateSolid(Item, ThicknessRaw) Then Return False
|
||||
If Not CreateAlettaSolid(Item, ThicknessRaw) Then Return False
|
||||
' posiziono il solido
|
||||
If Not MoveSolid(Item, ThicknessRaw) Then Return False
|
||||
If Not MoveAlettaSolid(Item, ThicknessRaw) Then Return False
|
||||
End If
|
||||
Next
|
||||
Draw()
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function CreateSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean
|
||||
Friend Function CreateKitchenTop(ByRef nId As Integer, ByRef ThicknessRaw As Double) As Boolean
|
||||
|
||||
' creo o svuoto layer per facce del solido
|
||||
Dim nSolidGrp As Integer = EgtGetFirstNameInGroup(nId, NAME_VM_SOLID)
|
||||
If nSolidGrp <> GDB_ID.NULL Then
|
||||
EgtEmptyGroup(nSolidGrp)
|
||||
Else
|
||||
nSolidGrp = EgtCreateGroup(nId)
|
||||
EgtSetName(nSolidGrp, NAME_VM_SOLID)
|
||||
End If
|
||||
|
||||
' recupero faccia top
|
||||
Dim nRegGrp As Integer = EgtGetFirstNameInGroup(nId, NAME_REGION)
|
||||
Dim nTopFr As Integer = EgtGetFirstInGroup(nRegGrp)
|
||||
While nTopFr <> GDB_ID.NULL
|
||||
If EgtGetType(nTopFr) = GDB_TY.SRF_FRGN Then Exit While
|
||||
nTopFr = EgtGetNext(nTopFr)
|
||||
End While
|
||||
If nTopFr = GDB_ID.NULL Then Return False
|
||||
EgtSetStatus(nTopFr, 0)
|
||||
|
||||
' setto colore per il solido
|
||||
Dim cCol As New Color3d
|
||||
EgtGetColor(nTopFr, cCol)
|
||||
EgtSetColor(nSolidGrp, cCol)
|
||||
|
||||
' creo il solido
|
||||
Dim bSameLoopsNbr As Boolean
|
||||
Dim nSolidId As Integer
|
||||
If Not CreateKitchenBaseSolid(nTopFr, nSolidGrp, ThicknessRaw, nSolidId, bSameLoopsNbr) Then Return False
|
||||
|
||||
' aggiungo componenti interni
|
||||
If Not AddInternalComponents(nSolidId, nTopFr, bSameLoopsNbr, ThicknessRaw) Then Return False
|
||||
|
||||
' setto eventuale texture
|
||||
Dim sTextName As String = String.Empty
|
||||
EgtGetTextureName(nTopFr, sTextName)
|
||||
If sTextName <> String.Empty Then
|
||||
Dim frText As New Frame3d
|
||||
EgtGetTextureFrame(nTopFr, nRegGrp, frText)
|
||||
EgtSetTextureName(nSolidId, sTextName)
|
||||
EgtSetTextureFrame(nSolidId, frText)
|
||||
End If
|
||||
|
||||
' elimino curve ausiliarie
|
||||
Dim nIdx As Integer = EgtGetFirstInGroup(nSolidGrp)
|
||||
While nIdx <> GDB_ID.NULL
|
||||
Dim newId As Integer = EgtGetNext(nIdx)
|
||||
If EgtGetType(nIdx) <> GDB_TY.SRF_MESH Then
|
||||
EgtErase(nIdx)
|
||||
End If
|
||||
nIdx = newId
|
||||
End While
|
||||
|
||||
Dim nOutloopGrpOrig As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP & ".orig")
|
||||
If nOutloopGrpOrig <> GDB_ID.NULL Then
|
||||
EgtSetStatus(nOutloopGrpOrig, 1)
|
||||
Dim nOutloopGrp As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP)
|
||||
EgtSetStatus(nOutloopGrp, 0)
|
||||
End If
|
||||
|
||||
Return True
|
||||
|
||||
End Function
|
||||
|
||||
Friend Function CreateKitchenBaseSolid(ByRef nTopFr As Integer, ByRef nSolidGrp As Integer, ByRef ThicknessRaw As Double,
|
||||
ByRef nSolidStm As Integer, ByRef bSameLoopsNbr As Boolean) As Boolean
|
||||
|
||||
' creo la faccia bottom
|
||||
Dim nBottomFr As Integer
|
||||
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nTopFr))
|
||||
If Not EgtCalcFlatPartDownRegion(nPartId, ThicknessRaw) Then Return False
|
||||
Dim nDwnRegGrp As Integer = EgtGetFirstNameInGroup(nPartId, "DwnReg")
|
||||
If nDwnRegGrp <> GDB_ID.NULL Then
|
||||
EgtSetStatus(nDwnRegGrp, 0)
|
||||
nBottomFr = EgtGetFirstInGroup(nDwnRegGrp)
|
||||
If nBottomFr = GDB_ID.NULL Then Return False
|
||||
Else
|
||||
nBottomFr = EgtCopy(nTopFr, nSolidGrp)
|
||||
End If
|
||||
Dim vtMove As Vector3d = -ThicknessRaw * Vector3d.Z_AX()
|
||||
EgtMove(nBottomFr, vtMove)
|
||||
EgtSetStatus(nBottomFr, 0)
|
||||
|
||||
' superficie laterale
|
||||
Dim nTopCrvCount, nBottomCrvCount As Integer
|
||||
Dim nTopCrv, nBottomCrv As Integer
|
||||
nTopCrv = EgtExtractSurfFrChunkLoops(nTopFr, 0, nSolidGrp, nTopCrvCount)
|
||||
nBottomCrv = EgtExtractSurfFrChunkLoops(nBottomFr, 0, nSolidGrp, nBottomCrvCount)
|
||||
' modifico il punto iniziale della curva bottom per ottenere una buona superficie rigata
|
||||
Dim ptStartTop As Point3d
|
||||
EgtStartPoint(nTopCrv, ptStartTop)
|
||||
EgtChangeClosedCurveStartPoint(nBottomCrv, ptStartTop - vtMove)
|
||||
Dim nLateralStm As Integer = EgtCreateSurfTmRuled(nSolidGrp, nBottomCrv, nTopCrv, 0, EPS_STM)
|
||||
|
||||
' superfici trimesh per faccia top e bottom
|
||||
Dim nTopStm, nBottomStm As Integer
|
||||
bSameLoopsNbr = (nTopCrvCount = nBottomCrvCount)
|
||||
If bSameLoopsNbr Then
|
||||
If Not GetSrfTmFromFlatRegion(nTopFr, nSolidGrp, nTopStm) Then Return False
|
||||
If Not GetSrfTmFromFlatRegion(nBottomFr, nSolidGrp, nBottomStm) Then Return False
|
||||
Else
|
||||
' creo le facce top e bottom dimenticando eventuali aperture
|
||||
nTopStm = EgtCreateSurfTmByFlatContour(nSolidGrp, nTopCrv, EPS_STM)
|
||||
nBottomStm = EgtCreateSurfTmByFlatContour(nSolidGrp, nBottomCrv, EPS_STM)
|
||||
End If
|
||||
EgtInvertSurface(nBottomStm)
|
||||
|
||||
nSolidStm = EgtCreateSurfTmBySewing(nSolidGrp, 3, {nTopStm, nBottomStm, nLateralStm}, True)
|
||||
Return nSolidStm <> GDB_ID.NULL
|
||||
|
||||
End Function
|
||||
|
||||
Friend Function AddInternalComponents(ByRef nSolidStm As Integer, ByRef nTopFr As Integer, ByRef bSameLoopsNbr As Boolean,
|
||||
ByRef ThicknessRaw As Double) As Boolean
|
||||
|
||||
Dim nSolidGrp = EgtGetParent(nSolidStm)
|
||||
|
||||
' aperture interne
|
||||
Dim nTopCrvCount As Integer
|
||||
Dim nTopCrv As Integer = EgtExtractSurfFrChunkLoops(nTopFr, 0, nSolidGrp, nTopCrvCount)
|
||||
If bSameLoopsNbr Then
|
||||
Dim FacesStm(nTopCrvCount - 1) As Integer
|
||||
FacesStm(0) = nSolidStm
|
||||
' creo le superfici laterali definite dalle aperture
|
||||
For i As Integer = 1 To nTopCrvCount - 1
|
||||
FacesStm(i) = EgtCreateSurfTmByExtrusion(nSolidGrp, 1, {nTopCrv + i}, -ThicknessRaw * Vector3d.Z_AX(), EPS_STM)
|
||||
EgtInvertSurface(FacesStm(i))
|
||||
Next
|
||||
nSolidStm = EgtCreateSurfTmBySewing(nSolidGrp, nTopCrvCount, FacesStm, True)
|
||||
Else
|
||||
' creo le aperture per sottrazione di solidi
|
||||
For i As Integer = 1 To nTopCrvCount - 1
|
||||
Dim nComponentSrf As Integer = EgtCreateSurfTmByRegionExtrusion(nSolidGrp, 1, {nTopCrv + i}, -(ThicknessRaw + 10) * Vector3d.Z_AX(), EPS_STM)
|
||||
EgtSurfTmSubtract(nSolidStm, nComponentSrf)
|
||||
EgtErase(nComponentSrf)
|
||||
Next
|
||||
End If
|
||||
|
||||
' ribassi
|
||||
Dim nId As Integer = EgtGetFirstGroupInGroup(EgtGetParent(nSolidGrp))
|
||||
While nId <> GDB_ID.NULL
|
||||
Dim sName As String = ""
|
||||
EgtGetName(nId, sName)
|
||||
If sName <> "Pocket" Then
|
||||
nId = EgtGetNextGroup(nId)
|
||||
Continue While
|
||||
End If
|
||||
' cerco curva composita che definisce il ribasso
|
||||
Dim nCrvCompoId As Integer = EgtGetFirstInGroup(nId)
|
||||
While nCrvCompoId <> GDB_ID.NULL
|
||||
If EgtGetType(nCrvCompoId) = GDB_TY.CRV_COMPO Then Exit While
|
||||
nCrvCompoId = EgtGetNext(nCrvCompoId)
|
||||
End While
|
||||
|
||||
Dim dThick As Double
|
||||
EgtCurveThickness(nCrvCompoId, dThick)
|
||||
Dim vtExtr As Vector3d
|
||||
EgtCurveExtrusion(nCrvCompoId, vtExtr)
|
||||
Dim nRecessSrf As Integer = EgtCreateSurfTmByRegionExtrusion(nId, 1, {nCrvCompoId}, (dThick + 100) * vtExtr, EPS_STM)
|
||||
EgtSurfTmSubtract(nSolidStm, nRecessSrf)
|
||||
EgtErase(nRecessSrf)
|
||||
|
||||
' Passo al pezzo successivo
|
||||
nId = EgtGetNextGroup(nId)
|
||||
End While
|
||||
|
||||
Return True
|
||||
End Function
|
||||
Friend Function GetSrfTmFromFlatRegion(ByRef nFlatRegion As Integer, ByRef nSolidGrp As Integer, ByRef nSrfTmId As Integer) As Boolean
|
||||
|
||||
If nFlatRegion = GDB_ID.NULL Then Return False
|
||||
' curve che delimitano la superficie
|
||||
Dim nCrvCount As Integer
|
||||
Dim nCrv As Integer = EgtExtractSurfFrChunkLoops(nFlatRegion, 0, nSolidGrp, nCrvCount)
|
||||
If nCrv = GDB_ID.NULL Then Return False
|
||||
' creo array con gli indici delle curve
|
||||
Dim CrvList(nCrvCount - 1) As Integer
|
||||
For i As Integer = 0 To nCrvCount - 1
|
||||
CrvList(i) = nCrv + i
|
||||
Next
|
||||
nSrfTmId = EgtCreateSurfTmByRegion(nSolidGrp, CrvList, EPS_STM)
|
||||
' cancello le curve create
|
||||
For i As Integer = 0 To nCrvCount - 1
|
||||
EgtErase(CrvList(i))
|
||||
Next
|
||||
|
||||
Return nSrfTmId <> GDB_ID.NULL
|
||||
|
||||
End Function
|
||||
|
||||
Friend Function CreateAlettaSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean
|
||||
|
||||
' angoli per i tagli
|
||||
Dim dAngL, dAngR, dAng As Double
|
||||
@@ -775,7 +989,7 @@ Friend Module VeinMatching
|
||||
|
||||
Dim nFrontSrf, nBackSrf, nBottomSrf, nRightSrf, nLeftSrf As Integer
|
||||
' Front Face
|
||||
If Not CreateSolidFace(nSolidGrp, {pt1, pt2, pt3, pt4}, nFrontSrf) Then Return False
|
||||
If Not CreateSolidFace(nSolidGrp, {pt1, pt2, pt3, pt4}, nFrontSrf, False) Then Return False
|
||||
' Back Face
|
||||
If Not CreateSolidFace(nSolidGrp, {ptB1, ptB4, ptB3, ptB2}, nBackSrf) Then Return False
|
||||
' Bottom face
|
||||
@@ -786,21 +1000,26 @@ Friend Module VeinMatching
|
||||
If Not CreateSolidFace(nSolidGrp, {ptB2, ptB3, pt3, pt2}, nLeftSrf) Then Return False
|
||||
|
||||
' creo il solido
|
||||
Dim n As Integer = EgtCreateSurfTmBySewing(nSolidGrp, 6, {nTopSrf, nFrontSrf, nBackSrf, nBottomSrf, nRightSrf, nLeftSrf}, True)
|
||||
' setto eventuale la texture
|
||||
Dim nSolidSrf As Integer = EgtCreateSurfTmBySewing(nSolidGrp, 6, {nTopSrf, nFrontSrf, nBackSrf, nBottomSrf, nRightSrf, nLeftSrf}, True)
|
||||
|
||||
' setto eventuale texture
|
||||
Dim sTextName As String = String.Empty
|
||||
EgtGetTextureName(nTopSrfFR, sTextName)
|
||||
If sTextName <> String.Empty Then
|
||||
Dim frText As New Frame3d
|
||||
EgtGetTextureFrame(nTopSrfFR, nRegionGrp, frText)
|
||||
EgtSetTextureName(n, sTextName)
|
||||
EgtSetTextureFrame(n, frText)
|
||||
EgtSetTextureName(nSolidSrf, sTextName)
|
||||
EgtSetTextureFrame(nSolidSrf, frText)
|
||||
End If
|
||||
|
||||
Dim nOutloopGrp As Integer = EgtGetParent(Item.SideId)
|
||||
EgtSetStatus(nOutloopGrp, 0)
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function CreateSolidFace(ByRef nSrfGrp As Integer, ByRef Points As Point3d(), ByRef nSrfId As Integer) As Integer
|
||||
Friend Function CreateSolidFace(ByRef nSrfGrp As Integer, ByRef Points As Point3d(), ByRef nSrfId As Integer,
|
||||
Optional ByRef bDeleteCrv As Boolean = True) As Boolean
|
||||
|
||||
If Points.Count() <> 4 Then Return False
|
||||
|
||||
@@ -810,12 +1029,16 @@ Friend Module VeinMatching
|
||||
EgtCreateLine(nSrfGrp, Points(3), Points(0))}, True)
|
||||
|
||||
If nCrvId = GDB_ID.NULL Then Return False
|
||||
EgtSetStatus(nCrvId, GDB_ST.OFF)
|
||||
nSrfId = EgtCreateSurfTmByRegion(nSrfGrp, {nCrvId}, EPS_SMALL)
|
||||
If bDeleteCrv Then
|
||||
EgtErase(nCrvId)
|
||||
Else
|
||||
EgtSetStatus(nCrvId, GDB_ST.OFF)
|
||||
End If
|
||||
Return nSrfId <> GDB_ID.NULL
|
||||
End Function
|
||||
|
||||
Friend Function MoveSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean
|
||||
Friend Function MoveAlettaSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean
|
||||
|
||||
Dim nType As Integer
|
||||
If Not EgtGetInfo(Item.IdSideRef, "AF", nType) Then Return False
|
||||
|
||||
Reference in New Issue
Block a user