Você está na página 1de 4

Sub Zera_Z()

Dim bAtualiza As Boolean


bAtualiza = False
sSelecao = Format(Now(), "hh:mm:ss")

Set ssetObj = ThisDrawing.SelectionSets.Add(sSelecao)


ssetObj.SelectOnScreen

For i = 0 To ssetObj.Count - 1
On Error Resume Next
If ssetObj.Item(i).ObjectName = "AcDbBlockReference" Then
varAttributes = ssetObj.Item(i).GetAttributes
iPx = ssetObj.Item(i).InsertionPoint
If iPx(2) <> 0 Then
iPx(2) = 0
iPx.Update
ssetObj.Item(i).InsertionPoint = iPx
End If

For k = 0 To UBound(varAttributes)
iPx = varAttributes(k).InsertionPoint
iPx(2) = 0
varAttributes(k).InsertionPoint = iPx
varAttributes(k).Update

Next
If UBound(varAttributes) = -1 Then
iPx = ssetObj.Item(i).InsertionPoint
iPx(2) = 0
iPx.Update
ssetObj.Item(i).InsertionPoint = iPx
ssetObj.Item(i).Update

End If
':varAttributes(k).InsertionPoint(0) : 526982,715526846 : Double :
Module1.Example_Selec
End If
If ssetObj.Item(i).ObjectName = "AcDbLine" Then
iPx = ssetObj.Item(i).StartPoint
If iPx(2) <> 0 Then
iPx(2) = 0
iPx.Update
ssetObj.Item(i).StartPoint = iPx
ssetObj.Item(i).Refresh
bAtualiza = True
'iPx(2).Update
End If
iPx2 = ssetObj.Item(i).EndPoint
If iPx2(2) <> 0 Then
iPx2(2) = 0
iPx2.Update
ssetObj.Item(i).EndPoint = iPx2
ssetObj.Item(i).Refresh
bAtualiza = True
End If
'
End If
If ssetObj.Item(i).ObjectName = "AcDbPolyline" Then
If ssetObj.Item(i).Elevation <> 0 Then
ssetObj.Item(i).Elevation = 0
bAtualiza = True
End If
End If

If ssetObj.Item(i).ObjectName = "AcDbAlignedDimension" Then


iPx = ssetObj.Item(i).TextPosition
If iPx(2) <> 0 Then
iPx(2) = 0
iPx.Update
ssetObj.Item(i).TextPosition = iPx
ssetObj.Item(i).Refresh
bAtualiza = True
End If

End If

If ssetObj.Item(i).ObjectName = "AcDbHatch" Then


If ssetObj.Item(i).Elevation <> 0 Then
ssetObj.Item(i).Elevation = 0
bAtualiza = True
End If

End If
'"AcDbMText"

If ssetObj.Item(i).ObjectName = "AcDbMText" Then


iPx = ssetObj.Item(i).InsertionPoint
If iPx(2) <> 0 Then
iPx(2) = 0
iPx.Update
ssetObj.Item(i).InsertionPoint = iPx
ssetObj.Item(i).Update
bAtualiza = True
End If

End If

'"AcDbText"
If ssetObj.Item(i).ObjectName = "AcDbText" Then
If ssetObj.Item(i).Elevation <> 0 Then
iPx = ssetObj.Item(i).InsertionPoint
iPx(2) = 0
iPx.Update
ssetObj.Item(i).InsertionPoint = iPx
bAtualiza = True

End If

End If

'"AcDbLeader"
If ssetObj.Item(i).ObjectName = "AcDbLeader" Then
coordenadas = ssetObj.Item(i).Coordinates
For k = 2 To UBound(coordenadas) Step 3
coordenadas(k) = 0
Next
coordenadas.Update
ssetObj.Item(i).Coordinates = coordenadas

End If

'"AcDbCircle"
If ssetObj.Item(i).ObjectName = "AcDbCircle" Then
iCenter = ssetObj.Item(i).Center
iCenter(2) = 0
iCenter.Update
ssetObj.Item(i).Center = iCenter

End If

'"AcDb2LineAngularDimension"
If ssetObj.Item(i).ObjectName = "AcDb2LineAngularDimension" Then
If ssetObj.Item(i).Elevation <> 0 Then
iPx = ssetObj.Item(i).InsertionPoint
iPx(2) = 0
iPx.Update
ssetObj.Item(i).InsertionPoint = iPx
bAtualiza = True

End If

End If
If ssetObj.Item(i).ObjectName = "AcDbArc" Then
iPx = ssetObj.Item(i).StartPoint
If iPx(2) <> 0 Then
iPx(2) = 0
iPx.Update
ssetObj.Item(i).StartPoint = iPx
bAtualiza = True
'iPx(2).Update
End If
iPx2 = ssetObj.Item(i).EndPoint
If iPx2(2) <> 0 Then
iPx2(2) = 0
iPx2.Update
ssetObj.Item(i).EndPoint = iPx2
bAtualiza = True
End If
iCenter = ssetObj.Item(i).Center
iCenter(2) = 0
iCenter.Update
ssetObj.Item(i).Center = iCenter
End If

If bAtualiza = True Then


ssetObj.Item(i).Update
ssetObj.Item(i).Refresh
bAtualiza = False
End If
Next
Set ssetObj = Nothing

End Sub

Você também pode gostar