Você está na página 1de 3

CREACION DE UN PUNTO.

Ejemplo: se quiere exportar un punto a AutoCAD.

Sub Example_AddPoint()
' This example creates a point in model space.
Dim pointObj As AcadPoint
Dim position(0 To 2) As Double
' Define the location of the point
position(0) = Cells(2, 1): position(1) = Cells(2, 2): position(2) = Cells(2, 3)
' Create the point
Set pointObj = AutoCAD.Application.ActiveDocument.ModelSpace.AddPoint(position)
End Sub

CREACION DE UN GRUPO DE PUNTOS.

Sub Example_AddPoint()
' This example creates a point in model space.
Dim pointObj As AcadPoint
Dim position(0 To 2) As Double
' Define the location of the point
i=2
Do While Cells(i, 2) <> ""
position(0) = Cells(i, 1)
position(1) = Cells(i, 2)
position(2) = Cells(i, 3)
' Create the point
Set pointObj = AutoCAD.Application.ActiveDocument.ModelSpace.AddPoint(position)
i=i+1
Loop

End Sub
CREACION DE UN PUNTO CON ATRIBUTOS.
Ejemplo: se quiere exportar un punto a AutoCAD, teniendo en cuenta el tipo de punto, escala y color del mismo.

Sub Ch4_CreatePoint()
Dim pointObj As AcadPoint
Dim location(0 To 2) As Double
' Define the location of the point
location(0) = Cells(2, 1)
location(1) = Cells(2, 2)
location(2) = Cells(2, 3)
' Create the point
Set pointObj = AutoCAD.Application.ActiveDocument.ModelSpace.AddPoint(location)
ActiveDocument.SetVariable "PDMODE", 3
ActiveDocument.SetVariable "PDSIZE", 2
pointObj.Color = 5

End Sub

CREACION DE UN GRUPO DE PUNTOS CON ATRIBUTOS.

Sub Example_AddPoint()
' This example creates a point in model space.
Dim pointObj As AcadPoint
Dim position(0 To 2) As Double
' Define the location of the point
i=2
Do While Cells(i, 2) <> ""
position(0) = Cells(i, 1)
position(1) = Cells(i, 2)
position(2) = Cells(i, 3)
' Create the point
Set pointObj = AutoCAD.Application.ActiveDocument.ModelSpace.AddPoint(position)
ActiveDocument.SetVariable "PDMODE", 3
ActiveDocument.SetVariable "PDSIZE", 2
pointObj.Color = 5
i=i+1
Loop

End Sub
CREACION DE UNA LINEA.
Ejemplo: se quiere exportar dos puntos a AutoCAD para formar una recta.

Sub Ejemplo_linea()
Dim lineObj As AcadLine
Dim pto1(0 To 2) As Double
Dim pto2(0 To 2) As Double
pto1(0) = Cells(3, 1): pto1(1) = Cells(3, 2): pto1(2) = Cells(3, 3)
pto2(0) = Cells(3, 4): pto2(1) = Cells(3, 5): pto2(2) = Cells(3, 6)
Set lineObj = AutoCAD.Application.ActiveDocument.ModelSpace.AddLine(pto1, pto2)
lineObj.Color = 5
lineObj.LineWeight = acLnWt020

End Sub

CREACION DE UN GRUPO DE LINEA.


Ejemplo: se quiere exportar dos puntos a AutoCAD para formar una recta.

Sub Ejemplo_linea()
Dim lineObj As AcadLine
Dim pto1(0 To 2) As Double
Dim pto2(0 To 2) As Double
i=3
Do While Cells(i, 1) <> ""

pto1(0) = Cells(i, 1)
pto1(1) = Cells(i, 2)
pto1(2) = Cells(i, 3)
pto2(0) = Cells(i, 4)
pto2(1) = Cells(i, 5)
pto2(2) = Cells(i, 6)

Set lineObj = AutoCAD.Application.ActiveDocument.ModelSpace.AddLine(pto1, pto2)


lineObj.Color = 1
lineObj.LineWeight = acLnWt020

i=i+1
Loop

End Sub

Você também pode gostar