OmagOFFICE 2.2a4 :
- drag diretto del pezzo da parcheggio a lastra - archi lavorati all'esterno con possibilità di inclinazione - possibilità di allungare e accorciare gli estremi dei tagli di una quantità a piacere - possibilità di bloccare la rotazione dei pezzi - possibilità di nesting automatico.
This commit is contained in:
@@ -342,6 +342,9 @@ Public Class SideEntityControlVM
|
||||
LoopId = DxfImportWindowMap.refDxfImportSceneHostV.SelectedLayer
|
||||
End If
|
||||
|
||||
' Determino se loop esterno o interno
|
||||
Dim sLoopName As String = ""
|
||||
Dim bOutLoop As Boolean = ( EgtGetName( LoopId, sLoopName) AndAlso sLoopName = NAME_OUTLOOP)
|
||||
' Calcolo dimensione ingombro Loop
|
||||
Dim ptMin, ptMax As Point3d
|
||||
EgtGetBBoxGlob(LoopId, GDB_BB.STANDARD, ptMin, ptMax)
|
||||
@@ -358,21 +361,28 @@ Public Class SideEntityControlVM
|
||||
Dim CurrLine As Integer = EgtGetFirstInGroup(LoopId)
|
||||
' Creo indice per numerare le entità in ImportPage
|
||||
Dim nEntityIndex As Integer = 1
|
||||
' Ciclo che verifica se possibile inclinare la linea corrente fino alla penultima
|
||||
Dim nOtherIndex As Integer = 1
|
||||
' Ciclo che verifica se possibile inclinare la curva corrente
|
||||
While CurrLine <> GDB_ID.NULL
|
||||
Dim NextLine As Integer = EgtGetNext(CurrLine)
|
||||
If NextLine = GDB_ID.NULL Then NextLine = EgtGetFirstInGroup( LoopId)
|
||||
If m_Mode = ModeOpt.SIDEANGLE Then
|
||||
If VerifyIsSideAnglePossible(PrevLine, CurrLine, NextLine) Then
|
||||
If VerifyIsSideAnglePossible(PrevLine, CurrLine, NextLine, bOutLoop) Then
|
||||
' Aggiungo il lato alla lista di quelli inclinabili e ne azzero l'inclinazione
|
||||
AddSideAngle(CurrLine, TextLayer, dBBoxRad, nEntityIndex)
|
||||
nEntityIndex += 1
|
||||
Else
|
||||
EgtSetName( CurrLine, "B" & nOtherIndex.ToString())
|
||||
nOtherIndex += 1
|
||||
End If
|
||||
Else
|
||||
If VerifyIsSideDripPossible(PrevLine, CurrLine, NextLine) Then
|
||||
' Aggiungo il lato alla lista di quelli su cui è possibile mettere il gocciolatoio
|
||||
AddDripSide(CurrLine, TextLayer, dBBoxRad, nEntityIndex)
|
||||
nEntityIndex += 1
|
||||
Else
|
||||
EgtSetName( CurrLine, "B" & nOtherIndex.ToString())
|
||||
nOtherIndex += 1
|
||||
End If
|
||||
End If
|
||||
PrevLine = CurrLine
|
||||
@@ -488,25 +498,23 @@ Public Class SideEntityControlVM
|
||||
EgtGetBBox(nText, GDB_BB.STANDARD, ptMinBBox, ptMaxBBox)
|
||||
Dim ptMidBBox As Point3d
|
||||
ptMidBBox = Point3d.Media(ptMinBBox, ptMaxBBox)
|
||||
' estremi della CurrLine
|
||||
Dim ptLineStart As Point3d
|
||||
EgtStartPoint(CurrLine, nText, ptLineStart)
|
||||
Dim ptLineEnd As Point3d
|
||||
EgtEndPoint(CurrLine, nText, ptLineEnd)
|
||||
' versore della CurrLine
|
||||
Dim vtCurrLine As Vector3d = ptLineEnd - ptLineStart
|
||||
vtCurrLine.Normalize()
|
||||
' Punto medio della curva
|
||||
Dim ptMid As Point3d
|
||||
EgtMidPoint( CurrLine, nText, ptMid)
|
||||
' Versore sul punto medio della curva
|
||||
Dim vtMid As Vector3d
|
||||
EgtMidVector( CurrLine, nText, vtMid)
|
||||
' versore perpendicolare alla CurrLine che punta verso il testo
|
||||
Dim vtOrtoLine As New Vector3d(vtCurrLine)
|
||||
Dim vtOrto As New Vector3d(vtMid)
|
||||
If bTextExt Then
|
||||
vtOrtoLine.Rotate(Vector3d.Z_AX(), -90)
|
||||
vtOrto.Rotate(Vector3d.Z_AX(), -90)
|
||||
Else
|
||||
vtOrtoLine.Rotate(Vector3d.Z_AX(), 90)
|
||||
vtOrto.Rotate(Vector3d.Z_AX(), 90)
|
||||
End If
|
||||
' eventuale rotazione del testo
|
||||
Dim dRotAng As Double = 0
|
||||
If bRot Then
|
||||
dRotAng = Math.Atan2(vtCurrLine.y, vtCurrLine.x) * 180 / Math.PI
|
||||
dRotAng = Math.Atan2(vtMid.y, vtMid.x) * 180 / Math.PI
|
||||
Dim dSpecRotAng = dRotAng
|
||||
If dSpecRotAng > 91 Then
|
||||
dSpecRotAng -= 180
|
||||
@@ -522,28 +530,28 @@ Public Class SideEntityControlVM
|
||||
vtptExtptMC.Rotate(Vector3d.Z_AX(), dRotAng)
|
||||
Else
|
||||
If bTextExt Then
|
||||
If vtCurrLine.x > 0 Then
|
||||
If vtCurrLine.y > 0 Then
|
||||
If vtMid.x > 0 Then
|
||||
If vtMid.y > 0 Then
|
||||
vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0)
|
||||
Else
|
||||
vtptExtptMC = ptMidBBox - ptMaxBBox
|
||||
End If
|
||||
Else
|
||||
If vtCurrLine.y > 0 Then
|
||||
If vtMid.y > 0 Then
|
||||
vtptExtptMC = ptMidBBox - ptMinBBox
|
||||
Else
|
||||
vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0)
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If vtCurrLine.x > 0 Then
|
||||
If vtCurrLine.y > 0 Then
|
||||
If vtMid.x > 0 Then
|
||||
If vtMid.y > 0 Then
|
||||
vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0)
|
||||
Else
|
||||
vtptExtptMC = ptMidBBox - ptMinBBox
|
||||
End If
|
||||
Else
|
||||
If vtCurrLine.y > 0 Then
|
||||
If vtMid.y > 0 Then
|
||||
vtptExtptMC = ptMidBBox - ptMaxBBox
|
||||
Else
|
||||
vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0)
|
||||
@@ -552,7 +560,7 @@ Public Class SideEntityControlVM
|
||||
End If
|
||||
End If
|
||||
' Calcolo il centro del testo
|
||||
Dim ptTextMC As Point3d = Point3d.Media(ptLineStart, ptLineEnd) + vtOrtoLine * (dDistance + (vtOrtoLine * vtptExtptMC))
|
||||
Dim ptTextMC As Point3d = ptMid + vtOrto * (dDistance + (vtOrto * vtptExtptMC))
|
||||
EgtMove(nText, (ptTextMC - Point3d.ORIG))
|
||||
Return nText
|
||||
End Function
|
||||
@@ -791,59 +799,78 @@ Public Class SideEntityControlVM
|
||||
End Sub
|
||||
|
||||
' Funzione che verifica se la linea corrente è inclinabile in base al tipo della precedente e successiva
|
||||
Shared Function VerifyIsSideAnglePossible(LastLine As Integer, CurrLine As Integer, NextLine As Integer) As Boolean
|
||||
' Verifico se CurrLine è una linea
|
||||
If EgtGetType(CurrLine) <> GDB_TY.CRV_LINE Then
|
||||
Return False
|
||||
End If
|
||||
Shared Function VerifyIsSideAnglePossible(LastLine As Integer, CurrLine As Integer, NextLine As Integer, bOutLoop As Boolean) As Boolean
|
||||
' Analisi del tipo
|
||||
Select EgtGetType(CurrLine)
|
||||
Case GDB_TY.CRV_LINE
|
||||
' Le linee vanno bene di per sè
|
||||
Case GDB_TY.CRV_ARC
|
||||
' Gli archi devono essere lavorati sul lato esterno
|
||||
Dim dAngCen As Double : EgtArcAngCenter( CurrLine, dAngCen)
|
||||
If ( bOutLoop And dAngCen < 0) Or ( Not bOutLoop And dAngCen > 0) Then Return False
|
||||
Case GDB_TY.CRV_COMPO
|
||||
' Gli archi componenti devono essere lavorati sul lato esterno
|
||||
Dim nCopyId As Integer = EgtCopy( CurrLine, CurrLine, GDB_POS.AFTER)
|
||||
If nCopyId = GDB_ID.NULL Then Return False
|
||||
Dim bOk As Boolean = True
|
||||
Dim nCount As Integer = 0
|
||||
Dim nNewId As Integer = EgtExplodeCurveCompo( nCopyId, nCount)
|
||||
For nI As Integer = 0 To nCount - 1
|
||||
Dim nEntId As Integer = nNewId + nI
|
||||
If EgtGetType( nEntId) = GDB_TY.CRV_ARC Then
|
||||
Dim dAngCen As Double : EgtArcAngCenter( nEntId, dAngCen)
|
||||
If ( bOutLoop And dAngCen < 0) Or ( Not bOutLoop And dAngCen > 0) Then bOk = False
|
||||
End If
|
||||
EgtErase( nEntId)
|
||||
Next
|
||||
If Not bOk Then Return False
|
||||
Case Else
|
||||
Return False
|
||||
End Select
|
||||
|
||||
' Se curva chiusa va bene solo se loop esterno
|
||||
if EgtCurveIsClosed( CurrLine) Then Return bOutLoop
|
||||
|
||||
' Delta angolare limite per tangenza
|
||||
Const DELTA_ANG_TG As Double = 5.0
|
||||
|
||||
' Verifico se curva precedente mi permette di inclinare
|
||||
Dim bLastOk As Boolean = False
|
||||
If EgtGetType(LastLine) = GDB_TY.CRV_LINE Then
|
||||
bLastOk = True
|
||||
ElseIf EgtGetType(LastLine) = GDB_TY.CRV_ARC Then
|
||||
' Ricavo direzione finale linea precedente
|
||||
Dim vtLastEnd As Vector3d
|
||||
EgtEndVector(LastLine, vtLastEnd)
|
||||
' Ricavo direzione iniziale linea corrente
|
||||
Dim vtCurrStart As Vector3d
|
||||
EgtStartVector(CurrLine, vtCurrStart)
|
||||
' Confronto direzioni per vedere se sono tangenti
|
||||
Dim dAngDeg As Double = GetAngle( vtLastEnd, vtCurrStart)
|
||||
' verifico se l'angolo è significativo
|
||||
bLastOk = ( dAngDeg > DELTA_ANG_TG)
|
||||
Else
|
||||
EgtOutLog("Error in Compo Outloop: found an entity that is not a line or a arc")
|
||||
End If
|
||||
Select EgtGetType(LastLine)
|
||||
Case GDB_TY.CRV_LINE, GDB_TY.CRV_ARC, GDB_TY.CRV_COMPO
|
||||
' Ricavo direzione finale linea precedente
|
||||
Dim vtLastEnd As Vector3d
|
||||
EgtEndVector(LastLine, vtLastEnd)
|
||||
' Ricavo direzione iniziale linea corrente
|
||||
Dim vtCurrStart As Vector3d
|
||||
EgtStartVector(CurrLine, vtCurrStart)
|
||||
' Confronto direzioni per vedere se sono tangenti
|
||||
Dim dAngDeg As Double = GetAngle( vtLastEnd, vtCurrStart)
|
||||
' verifico se l'angolo è significativo
|
||||
bLastOk = ( dAngDeg > DELTA_ANG_TG)
|
||||
Case Else
|
||||
EgtOutLog("Error in Compo Outloop: found an entity that is not a line or a arc")
|
||||
End Select
|
||||
|
||||
' Verifico se curva successiva mi permette di inclinare
|
||||
Dim bNextOk As Boolean = False
|
||||
If EgtGetType(NextLine) = GDB_TY.CRV_LINE Then
|
||||
bNextOk = True
|
||||
ElseIf EgtGetType(NextLine) = GDB_TY.CRV_ARC Then
|
||||
' Ricavo direzione finale linea corrente
|
||||
Dim vtCurrEnd As Vector3d
|
||||
EgtEndVector(CurrLine, vtCurrEnd)
|
||||
' Ricavo direzione iniziale linea successiva
|
||||
Dim vtNextStart As Vector3d
|
||||
EgtStartVector(NextLine, vtNextStart)
|
||||
' Confronto direzioni per vedere se sono tangenti
|
||||
Dim dAngDeg As Double = GetAngle( vtCurrEnd, vtNextStart)
|
||||
' verifico se l'angolo è significativo
|
||||
bNextOk = ( dAngDeg > DELTA_ANG_TG)
|
||||
Else
|
||||
EgtOutLog("Error in Compo Outloop: found an entity that is not a line or a arc")
|
||||
End If
|
||||
Select EgtGetType(NextLine)
|
||||
Case GDB_TY.CRV_LINE, GDB_TY.CRV_ARC, GDB_TY.CRV_COMPO
|
||||
' Ricavo direzione finale linea corrente
|
||||
Dim vtCurrEnd As Vector3d
|
||||
EgtEndVector(CurrLine, vtCurrEnd)
|
||||
' Ricavo direzione iniziale linea successiva
|
||||
Dim vtNextStart As Vector3d
|
||||
EgtStartVector(NextLine, vtNextStart)
|
||||
' Confronto direzioni per vedere se sono tangenti
|
||||
Dim dAngDeg As Double = GetAngle( vtCurrEnd, vtNextStart)
|
||||
' verifico se l'angolo è significativo
|
||||
bNextOk = ( dAngDeg > DELTA_ANG_TG)
|
||||
Case Else
|
||||
EgtOutLog("Error in Compo Outloop: found an entity that is not a line or a arc")
|
||||
End Select
|
||||
|
||||
' Se entrambe me lo permettono restituisco vero
|
||||
If bLastOk And bNextOk Then
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
|
||||
Return ( bLastOk And bNextOk)
|
||||
End Function
|
||||
|
||||
Shared Function AdjustAsTrfParSides( PartId As Integer) As Boolean
|
||||
@@ -947,7 +974,7 @@ Public Class SideEntityControlVM
|
||||
While EntId <> GDB_ID.NULL
|
||||
Dim NextId As Integer = EgtGetNext( EntId)
|
||||
If NextId = GDB_ID.NULL Then NextId = EgtGetFirstInGroup( LoopId)
|
||||
If VerifyIsSideAnglePossible( PrevId, EntId, NextId) Then
|
||||
If VerifyIsSideAnglePossible( PrevId, EntId, NextId, bOutLoop) Then
|
||||
Dim colEnt As Color3d
|
||||
If EgtGetColor( EntId, colEnt) Then
|
||||
Dim dAng As Double
|
||||
|
||||
Reference in New Issue
Block a user