Translate

quarta-feira, 19 de Março de 2014

VB.net Circle (Zwcad and Autocad)

Como fazer um circulo (5,5,0).

ZWCad+
1:  Imports ZwSoft.ZwCAD.ApplicationServices  
2:  Imports ZwSoft.ZwCAD.Runtime  
3:  Imports ZwSoft.ZwCAD.DatabaseServices  
4:  Imports ZwSoft.ZwCAD.Geometry  
5:    
6:  Public Class Class1  
7:    <CommandMethod("Circulo")> _  
8:    Public Sub circulo()  
9:      Dim Doc As Document = Application.DocumentManager.MdiActiveDocument  
10:      Dim CurDb As Database = Doc.Database  
11:    
12:      Using Trans As Transaction = CurDb.TransactionManager.StartTransaction()  
13:    
14:        Dim BlkTbl As BlockTable = Trans.GetObject(CurDb.BlockTableId, OpenMode.ForRead)  
15:        Dim BlkTblRec As BlockTableRecord = Trans.GetObject(BlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)  
16:    
17:        Dim Circ As Circle = New Circle()  
18:        Circ.SetDatabaseDefaults()  
19:        Circ.Center = New Point3d(5, 5, 0)  
20:        Circ.Radius = 4.25  
21:        BlkTblRec.AppendEntity(Circ)  
22:        Trans.AddNewlyCreatedDBObject(Circ, True)  
23:    
24:        Trans.Commit()  
25:      End Using  
26:    End Sub  
27:  End Class  
Autocad
1:  Imports Autodesk.AutoCAD.Runtime  
2:  Imports Autodesk.AutoCAD.ApplicationServices  
3:  Imports Autodesk.AutoCAD.DatabaseServices  
4:  Imports Autodesk.AutoCAD.Geometry  
5:    
6:  Public Class Class1  
7:    <CommandMethod("Circulo")> _  
8:    Public Sub circulo()  
9:      Dim Doc As Document = Application.DocumentManager.MdiActiveDocument  
10:      Dim CurDb As Database = Doc.Database  
11:    
12:      Using Trans As Transaction = CurDb.TransactionManager.StartTransaction()  
13:    
14:        Dim BlkTbl As BlockTable = Trans.GetObject(CurDb.BlockTableId, OpenMode.ForRead)  
15:        Dim BlkTblRec As BlockTableRecord = Trans.GetObject(BlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)  
16:    
17:        Dim Circ As Circle = New Circle()  
18:        Circ.SetDatabaseDefaults()  
19:        Circ.Center = New Point3d(5, 5, 0)  
20:        Circ.Radius = 4.25  
21:        BlkTblRec.AppendEntity(Circ)  
22:        Trans.AddNewlyCreatedDBObject(Circ, True)  
23:    
24:        Trans.Commit()  
25:      End Using  
26:    End Sub  
27:  End Class  



Boa Programação.

domingo, 9 de Março de 2014

VB.net Polyline (Zwcad and Autocad)

Agora uma polilinha com 3 pontos (0,0); (5,5); (10,0).

ZWCad+


 Imports ZwSoft.ZwCAD.ApplicationServices  
 Imports ZwSoft.ZwCAD.Runtime  
 Imports ZwSoft.ZwCAD.DatabaseServices  
 Imports ZwSoft.ZwCAD.Geometry  
   
 Public Class Class1  
   <CommandMethod("Poly")> _  
   Public Sub proj1()  
   
     Dim Doc As Document = Application.DocumentManager.MdiActiveDocument  
     Dim Db As Database = Doc.Database  
   
     Using Trans As Transaction = Db.TransactionManager.StartTransaction()  
   
       Dim BlkTbl As BlockTable = Trans.GetObject(Db.BlockTableId, OpenMode.ForRead)  
       Dim BlkTblRec As BlockTableRecord = Trans.GetObject(BlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)  
   
       Dim Poly As Polyline = New Polyline()  
       Poly.SetDatabaseDefaults()  
       Poly.AddVertexAt(0, New Point2d(0, 0), 0, 0, 0)  
       Poly.AddVertexAt(1, New Point2d(5, 5), 0, 0, 0)  
       Poly.AddVertexAt(2, New Point2d(10, 0), 0, 0, 0)  
   
       BlkTblRec.AppendEntity(Poly)  
       Trans.AddNewlyCreatedDBObject(Poly, True)  
   
       Trans.Commit()  
     End Using  
   End Sub  
 End Class  

Autocad


 Imports Autodesk.AutoCAD.Runtime  
 Imports Autodesk.AutoCAD.ApplicationServices  
 Imports Autodesk.AutoCAD.DatabaseServices  
 Imports Autodesk.AutoCAD.Geometry  
   
 Public Class Class1  
   <CommandMethod("Poly")> _  
   Public Sub proj1()  
   
     Dim Doc As Document = Application.DocumentManager.MdiActiveDocument  
     Dim Db As Database = Doc.Database  
   
     Using Trans As Transaction = Db.TransactionManager.StartTransaction()  
   
       Dim BlkTbl As BlockTable = Trans.GetObject(Db.BlockTableId, OpenMode.ForRead)  
       Dim BlkTblRec As BlockTableRecord = Trans.GetObject(BlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)  
   
       Dim Poly As Polyline = New Polyline()  
       Poly.SetDatabaseDefaults()  
       Poly.AddVertexAt(0, New Point2d(0, 0), 0, 0, 0)  
       Poly.AddVertexAt(1, New Point2d(5, 5), 0, 0, 0)  
       Poly.AddVertexAt(2, New Point2d(10, 0), 0, 0, 0)  
   
       BlkTblRec.AppendEntity(Poly)  
       Trans.AddNewlyCreatedDBObject(Poly, True)  
   
       Trans.Commit()  
     End Using  
   End Sub  
 End Class  





sexta-feira, 7 de Março de 2014

Pré-desempregado

É assim.

Acabou o meu contrato na LCW Consult SA.

Sendo assim estou pronto para abraçar outra oportunidade. Também estou pronto para trabalhar como freelancer.
Se necessitarem de algum apoio de desenho, formação ou programação, podem entrar em contacto para: franciscocsilva@netcabo.pt ou para o seguinte numero de telemóvel: 919774612.

Obrigado