HQuintas Posted June 23, 2018 at 08:15 AM Report #611090 Posted June 23, 2018 at 08:15 AM Boas, estou com pequeno problema ao desenhar numa picturebox um ficheiro em dxf. Faz a leitura tudo bem, mas não une as linhas e os arcos, como se pode ver na imagem. Porquê? Private Sub linha(x As Double, y As Double, x_end As Double, y_end As Double, mypen As Pen) Using g As Graphics = Graphics.FromImage(bm) ' Flip the Y-Axis g.ScaleTransform(zx, zy) ' Translate the drawing area accordingly g.TranslateTransform(fx, fy) Dim p1 As New Point(x, y) Dim p2 As New Point(x_end, y_end) ' Create a new pen. Dim sPen As New Pen(Brushes.Black) ' Set the pen's width. sPen.Width = 1.0F g.DrawLine(sPen, p1, p2) End Using 'bm.RotateFlip(RotateFlipType.RotateNoneFlipY) PictureBox1.Image = bm End Sub Private Sub arco(x As Double, y As Double, r As Double, angS As Single, angE As Single) Using g As Graphics = Graphics.FromImage(bm) ' Flip the Y-Axis g.ScaleTransform(zx, zy) ' Translate the drawing area accordingly g.TranslateTransform(fx, fy) ' Create a new pen. Dim sPen As New Pen(Brushes.Red) ' Set the pen's width. sPen.Width = 1.0F cor_perfil = sPen Dim p1 As Double = x - r Dim p2 As Double = y - r Dim p3p4 As Double = 2 * r Dim sweep As Single = angE - angS If angE < angS Then sweep = 360 - angS + angE End If If sweep < 0 Then sweep = -sweep ListBox1.Items.Add(sweep) Dim rect As New Rectangle(p1, p2, p3p4, p3p4) Try g.DrawArc(cor_perfil, rect, angS, sweep) Catch ex As Exception End Try End Using PictureBox1.Image = bm End Sub
zep Posted June 25, 2018 at 05:03 PM Report #611123 Posted June 25, 2018 at 05:03 PM (edited) Boas, desenhas em *.dxf e depois exportas para a picturebox, certo? Se sim podes enviar o ficheiro *.dxf? Edited June 25, 2018 at 05:04 PM by zep
HQuintas Posted June 26, 2018 at 06:23 AM Author Report #611127 Posted June 26, 2018 at 06:23 AM Boas, sim tenho os ficheiros em dxf e quero lê-los numa picturebox, para posteriormente os guardar como imagem. E tenho dois tipos de dxf, uns em que tem ARC e LINES e outro tipo em que estão guardados com VERTEX (estes ficam para uma segunda fase) Aqui está o ficheiro para esta 1ª fase: 204.dxf
zep Posted June 27, 2018 at 09:17 AM Report #611144 Posted June 27, 2018 at 09:17 AM Ok já recebi o ficheiro em dxf e o ficheiro está ok. Mas percebi mal, queres fazer uma imagem de acordo com o dxf e não importar o dxf? Penso que terás de mudar sPen.Width = 1.0F para 1px (não tenho a certeza), não sei se 0.5px vai resultar.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now