Message 1 of 5
Lenght of profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am attempting to retrieve the length of a profile, but when I try to do this with a small profile, such as UNP 160 with a length of 100mm. However, the code retrieves 160mm instead of the correct 100mm. Any ideas on how to disregard the 160mm and obtain the accurate 100mm value?
Sub Main()
Dim asmDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDoc As Inventor.Document
Dim caminhoArquivo As String = "C:\Users\Leonardo Souza\Desktop\Inventor-iLogic\zTest.txt"
Dim arquivo As System.IO.StreamWriter
arquivo = My.Computer.FileSystem.OpenTextFileWriter(caminhoArquivo, False)
For Each oDoc In asmDoc.AllReferencedDocuments
' Se for arquivo de Montagem Ignora
If oDoc.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then
Continue For
End If
If TypeOf oDoc.ComponentDefinition Is SheetMetalComponentDefinition Then
Continue For
End If
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oSolid As SurfaceBody
Dim oLength As Double
If oDef.SurfaceBodies.Count > 0 Then
oSolid = oDef.SurfaceBodies.Item(1)
oLength = Round(MaxOfMany(oSolid.OrientedMinimumRangeBox.DirectionOne.Length, _
oSolid.OrientedMinimumRangeBox.DirectionTwo.Length, _
oSolid.OrientedMinimumRangeBox.DirectionThree.Length) * 10, 1)
t = oDef.Parameters.Item("G_L")
arquivo.WriteLine(oDoc.DisplayName & " / " & oLength & " / " & t.Value * 10)
End If
Next
arquivo.Close()
End Sub