Professional Documents
Culture Documents
Dim x1 As Double
Dim x2 As Double
Dim y1 As Double
Dim y2 As Double
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
nome_pasta = "C:\DXF\" ' Nome da pasta a criar. Aqui podem definir a pasta que
vocês quiserem. Depois digam alguma coisa se precisarem de ajuda para definir outra
pasta.
If oCompOcc.SubOccurrences.Count = 0 Then
End If
For i = 1 To modelo.Features.Count
furo.Suppressed = True
End If
End If
Next i
espessura_chapa_final = Round(chapa_planificada.Thickness.Value
* 10, 1)
Call chapa_planificada.Unfold
min_point_y = 10000
min_point_x = 10000
'Call oDoc.Update2
quantidade = perfil.SketchEntities.Count
For j = 1 To perfil.SketchEntities.Count
x_centro = entidade.RangeBox.MinPoint.X +
((entidade.RangeBox.MaxPoint.X - entidade.RangeBox.MinPoint.X) / 2)
y_centro = entidade.RangeBox.MinPoint.Y +
((entidade.RangeBox.MaxPoint.Y - entidade.RangeBox.MinPoint.Y) / 2)
raio_circulo = (entidade.RangeBox.MaxPoint.X -
entidade.RangeBox.MinPoint.X) / 2
x1 = x_centro - raio_circulo
x2 = x_centro + raio_circulo
y1 = y_centro + raio_circulo
y2 = y_centro - raio_circulo
Set Linha1 =
perfil_final.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(x1, y_centro),
oTG.CreatePoint2d(x2, y_centro))
Set Linha2 =
perfil_final.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(x_centro, y2),
oTG.CreatePoint2d(x_centro, y1))
End If
min_point_x = x1
End If
min_point_x = x2
End If
min_point_y = y1
End If
min_point_y = y2
End If
End If
Next j
Call perfil.Delete
Set ponto1 =
ThisApplication.TransientGeometry.CreatePoint2d(min_point_x, min_point_y - 1)
Set ponto2 =
ThisApplication.TransientGeometry.CreatePoint2d(min_point_x + 100, min_point_y - 2)
Set ponto3 =
ThisApplication.TransientGeometry.CreatePoint2d(min_point_x, min_point_y - 2)
Set ponto4 =
ThisApplication.TransientGeometry.CreatePoint2d(min_point_x + 100, min_point_y - 3)
Set ponto5 =
ThisApplication.TransientGeometry.CreatePoint2d(min_point_x, min_point_y - 3)
Set ponto6 =
ThisApplication.TransientGeometry.CreatePoint2d(min_point_x + 100, min_point_y - 4)
'MsgBox texto1
Set oPaths =
ThisApplication.TransientObjects.CreateObjectCollection
oPaths.Add texto
Set oExtrudeDef =
planificado.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile,
kJoinOperation)
Call oExtrudeDef.SetDistanceExtent(0.001,
kNegativeExtentDirection)
Set oExtrude =
planificado.Features.ExtrudeFeatures.Add(oExtrudeDef)
Set oPaths =
ThisApplication.TransientObjects.CreateObjectCollection
oPaths.Add texto1
Set oExtrudeDef =
planificado.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile,
kJoinOperation)
Call oExtrudeDef.SetDistanceExtent(0.001,
kNegativeExtentDirection)
Set oExtrude2 =
planificado.Features.ExtrudeFeatures.Add(oExtrudeDef)
Set oPaths =
ThisApplication.TransientObjects.CreateObjectCollection
oPaths.Add texto3
Set oExtrudeDef =
planificado.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile,
kJoinOperation)
Call oExtrudeDef.SetDistanceExtent(0.001,
kNegativeExtentDirection)
Set oExtrude3 =
planificado.Features.ExtrudeFeatures.Add(oExtrudeDef)
Call planificado.ExitEdit
For i = 1 To modelo.Features.Count
furo.Suppressed = False
End If
End If
Next i
For i = 1 To modelo.Features.Count
Set forma = modelo.Features.Item(i)
furo.Suppressed = True
End If
End If
Next i
Call Propriedade.Delete
End If
Next
Next
nome_ficheiro = documento.FullFileName
nome_dxf = documento.DisplayName
'Call planificado.Edit
Call planificado.ExitEdit
End If
'Call perfil_final.Delete
For i = 1 To modelo.Features.Count
furo.Suppressed = False
End If
End If
Next i
Call oExtrude.Delete
Call perfil_final.Delete
Call oExtrude2.Delete
Call oExtrude3.Delete
Call perfil_final_texto.Delete
odef.FlatPattern.ExitEdit
Call documento.Close
'**************************** Cálculos
*********************************
larg_chapa = odef.FlatPattern.Width * 10
comp_chapa = odef.FlatPattern.Length * 10
densidade_chapa =
documento.PropertySets.Item(3).Item("density").Value
larg_chapa = Round(larg_chapa, 1)
comp_chapa = Round(comp_chapa, 1)
a1 = "Largura_Chapa"
b1 = "Comprimento_Chapa"
c1 = "Peso_Bruto"
d1 = "Espessura"
e1 = "Codigo"
codigo = "100"
End If
If espessura_chapa = 1 Then
codigo = "200"
End If
codigo = "300"
End If
If espessura_chapa = 2 Then
codigo = "400"
End If
peso_chapa = Round(odef.MassProperties.Mass, 5)
peso_chapa = Round(peso_chapa, 3)
peso_chapa_peca = Str(peso_chapa) + " Kg"
e1 = "Peso_Peca"
End If
iLeafNodes = iLeafNodes + 1
Else
iSubAssemblies = iSubAssemblies + 1
End If
Next
End Sub
nome_pasta = "C:\DXF\"
If oSubCompOcc.SubOccurrences.Count = 0 Then
iLeafNodes = iLeafNodes + 1
Set modelo = oSubCompOcc.Definition
If modelo.Type = "150995200" Then
nome_ficheiro = documento.FullFileName
nome_dxf = documento.DisplayName
odef.FlatPattern.ExitEdit
Call documento.Close
End If
Else
sMsg = sMsg + oSubCompOcc.Name + vbCr
iSubAssemblies = iSubAssemblies + 1
End If
Next
End Sub
quant = "Quantidade"
tipo_material = oprop.Value
End If
part_number = oprop.Value
End If
Next
Next
'tipo_material = documento.MaterialAssets.Type
'MsgBox documento.MaterialAssets.Count
'MsgBox tipo_material
'MsgBox material.Name
Set Propriedades = documento.PropertySets.Item("Inventor User Defined Properties")
Set opropsets = documento.PropertySets
Call Propriedade.Delete
End If
Next
Next
lista_pecas.PartsOnlyViewEnabled = True
If FirstLevelOnly Then
lista_pecas.StructuredViewFirstLevelOnly = True
Else
lista_pecas.StructuredViewFirstLevelOnly = False
End If
lista_pecas.StructuredViewEnabled = True
For i = 1 To oBOMView.BOMRows.Count
quant_pecas = oRow.ItemQuantity
End If
End If
Next
Next
Next i
quantas = Str(quantidade)
Set Propriedade = Propriedades.Add(quantas, quant)
End Sub