<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Thema "Betreff: Aktuellen Versatz unterschiedlicher Bauteile einer Baugruppe in Inventor auslesen" in Inventor - Deutsches Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-deutsches-forum/aktuellen-versatz-unterschiedlicher-bauteile-einer-baugruppe-in/m-p/10302073#M7801</link>
    <description>&lt;P&gt;Vielen Dank&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 May 2021 08:38:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-05-10T08:38:18Z</dc:date>
    <item>
      <title>Aktuellen Versatz unterschiedlicher Bauteile einer Baugruppe in Inventor auslesen</title>
      <link>https://forums.autodesk.com/t5/inventor-deutsches-forum/aktuellen-versatz-unterschiedlicher-bauteile-einer-baugruppe-in/m-p/10297074#M7799</link>
      <description>&lt;P&gt;Hallo,&lt;/P&gt;&lt;P&gt;Ich bin noch recht neu hier und auch bei Inventor und vor allem in VBA.&lt;/P&gt;&lt;P&gt;Ich suche einen Code, der mir den Aktuellen Versatz (Translation und Rotation) in Excel ausgeben kann.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sub Export_xyz_excel()&lt;/P&gt;&lt;P&gt;Dim oAsmDoc As AssemblyDocument&lt;BR /&gt;Set oAsmDoc = ThisApplication.ActiveDocument&lt;BR /&gt;&lt;BR /&gt;Dim sDocName As String&lt;BR /&gt;Dim i As Long&lt;BR /&gt;Dim iRow As Long&lt;BR /&gt;&lt;BR /&gt;Dim XL As Object&lt;BR /&gt;Dim xlWB As Object&lt;BR /&gt;Dim xlWS As Object&lt;BR /&gt;&lt;BR /&gt;If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; kAssemblyDocumentObject And ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; kPartDocumentObject Then&lt;BR /&gt;MsgBox "Only Part or Assymbly document ", vbCritical&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;Set XL = CreateObject("Excel.Application")&lt;BR /&gt;Set xlWB = XL.Workbooks.Add&lt;BR /&gt;Set xlWS = xlWB.ActiveSheet&lt;BR /&gt;XL.Visible = True&lt;BR /&gt;&lt;BR /&gt;iRow = 1&lt;BR /&gt;xlWS.Cells(iRow, 1).value = "Name"&lt;BR /&gt;xlWS.Cells(iRow, 2).value = "Type"&lt;BR /&gt;xlWS.Cells(iRow, 3).value = "Child"&lt;BR /&gt;xlWS.Cells(iRow, 4).value = "Length"&lt;BR /&gt;xlWS.Cells(iRow, 5).value = "Width"&lt;BR /&gt;xlWS.Cells(iRow, 6).value = "WidthOfLift"&lt;BR /&gt;xlWS.Cells(iRow, 7).value = "LiftRelPosX"&lt;BR /&gt;xlWS.Cells(iRow, 8).value = "Height"&lt;BR /&gt;xlWS.Cells(iRow, 9).value = "PosX"&lt;BR /&gt;xlWS.Cells(iRow, 10).value = "PosY"&lt;BR /&gt;xlWS.Cells(iRow, 11).value = "PosZ"&lt;BR /&gt;xlWS.Cells(iRow, 12).value = "RotX "&lt;BR /&gt;xlWS.Cells(iRow, 13).value = "RotY "&lt;BR /&gt;xlWS.Cells(iRow, 14).value = "RotZ "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;xlWS.Rows("1:1").Select&lt;BR /&gt;XL.Selection.Font.Bold = True&lt;/P&gt;&lt;P&gt;With XL.Selection.Font&lt;BR /&gt;.name = " Arial"&lt;BR /&gt;.Size = 11&lt;BR /&gt;.Bold = False&lt;BR /&gt;End With&lt;BR /&gt;&lt;BR /&gt;On Error Resume Next&lt;BR /&gt;&lt;BR /&gt;For i = 1 To ThisApplication.ActiveDocument.ComponentDefinition.Occurrences.Count&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Dim oOcc As ComponentOccurrence&lt;BR /&gt;Set oOcc = ThisApplication.ActiveDocument.ComponentDefinition.Occurrences(i)&lt;BR /&gt;&lt;BR /&gt;Dim oOL As Vector&lt;BR /&gt;Dim oT As Matrix&lt;BR /&gt;&lt;BR /&gt;Set oT = oOcc.Transformation&lt;BR /&gt;Set oOL = oT.Translation&lt;BR /&gt;&lt;BR /&gt;Dim oMatrix1 As Matrix&lt;BR /&gt;Set oMatrix1 = oOcc.Transformation&lt;BR /&gt;&lt;BR /&gt;Dim oOrigin1 As Point&lt;BR /&gt;Dim oX1 As Vector&lt;BR /&gt;Dim oY1 As Vector&lt;BR /&gt;Dim oZ1 As Vector&lt;BR /&gt;&lt;BR /&gt;Call oMatrix1.GetCoordinateSystem(oOrigin1, oX1, oY1, oZ1)&lt;BR /&gt;&lt;BR /&gt;Dim oMatrix2 As Matrix&lt;BR /&gt;Set oMatrix2 = ThisApplication.TransientGeometry.CreateMatrix&lt;BR /&gt;&lt;BR /&gt;Dim oOrigin2 As Point&lt;BR /&gt;Dim oX2 As Vector&lt;BR /&gt;Dim oY2 As Vector&lt;BR /&gt;Dim oZ2 As Vector&lt;BR /&gt;&lt;BR /&gt;Call oMatrix2.GetCoordinateSystem(oOrigin2, oX2, oY2, oZ2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim paraLänge As Object&lt;BR /&gt;Dim paraAbstand As Object&lt;BR /&gt;Dim paraQuer As Object&lt;BR /&gt;Dim paraFuss As Object&lt;BR /&gt;Dim paraHöhe As Object&lt;BR /&gt;Dim oParameter As Object&lt;BR /&gt;Dim paraType As Object&lt;BR /&gt;Dim k As Long&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Set paraLänge = oAsmDoc.ComponentDefinition.Occurrences.Item(i).Definition.Parameters.Item("Segmentlänge")&lt;BR /&gt;Set paraQuer = oAsmDoc.ComponentDefinition.Occurrences.Item(i).Definition.Parameters.Item("Anzahl_Querstreben")&lt;BR /&gt;Set paraFuss = oAsmDoc.ComponentDefinition.Occurrences.Item(i).Definition.Parameters.Item("Anzahl_Standfüße")&lt;BR /&gt;Set paraHöhe = oAsmDoc.ComponentDefinition.Occurrences.Item(i).Definition.Parameters.Item("Eingabe_Höhe")&lt;BR /&gt;Set paraAbstand = oAsmDoc.ComponentDefinition.Occurrences.Item(i).Definition.Parameters.Item("Abstand_Kettenmitte")&lt;/P&gt;&lt;P&gt;iRow = iRow + 1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Debug.Print&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 1).value = oOcc.name&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 3).value = 0&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 4).value = paraLänge.value&lt;BR /&gt;xlWS.Cells(iRow, 4).value = Round(xlWS.Cells(iRow, 4).value / 100, 3)&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 5).value = paraAbstand.value&lt;BR /&gt;xlWS.Cells(iRow, 5).value = Round(xlWS.Cells(iRow, 5).value / 100, 3)&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 6).value = 0&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 7).value = 0&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 8).value = paraHöhe.value&lt;BR /&gt;xlWS.Cells(iRow, 8).value = Round(xlWS.Cells(iRow, 8).value / 100, 3)&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 9).value = oOL.x&lt;BR /&gt;xlWS.Cells(iRow, 9).value = Round(xlWS.Cells(iRow, 9).value / 100 * -1, 3)&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 10).value = paraHöhe.value&lt;BR /&gt;xlWS.Cells(iRow, 10).value = Round(xlWS.Cells(iRow, 10).value / 100, 3)&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 11).value = oOL.y&lt;BR /&gt;xlWS.Cells(iRow, 11).value = Round(xlWS.Cells(iRow, 11).value / 100, 3)&lt;BR /&gt;&lt;BR /&gt;xlWS.Cells(iRow, 13).value = Round((oY1.AngleTo(oY2) * 180) / 3.14159265 - 90, 0)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Next&lt;BR /&gt;&lt;BR /&gt;XL.Cells.Select&lt;BR /&gt;XL.Cells.EntireColumn.AutoFit&lt;BR /&gt;xlWS.Range("A1").Select&lt;BR /&gt;&lt;BR /&gt;sDocName = ThisApplication.ActiveDocument.FullFileName&lt;BR /&gt;If sDocName = "" Then&lt;BR /&gt;sDocName = "c:\temp\x"&lt;BR /&gt;Else&lt;BR /&gt;sDocName = Mid(sDocName, 1, Len(sDocName) - 4)&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;If Dir(sDocName &amp;amp; ".xls") &amp;lt;&amp;gt; "" Then&lt;BR /&gt;i = 1&lt;BR /&gt;Do While Dir(sDocName &amp;amp; "_" &amp;amp; i &amp;amp; ".xls") &amp;lt;&amp;gt; ""&lt;BR /&gt;i = i + 1&lt;BR /&gt;Loop&lt;BR /&gt;sDocName = sDocName &amp;amp; "_" &amp;amp; i&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;xlWB.SaveAs FileName:=sDocName&lt;BR /&gt;&lt;BR /&gt;Set xlWS = Nothing&lt;BR /&gt;Set xlWB = Nothing&lt;BR /&gt;Set XL = Nothing&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Das habe ich mir mal so zusammenkopiert. Es funktioniert auch Teilweise aber noch nicht komplett. Hier wird sozusagen der Winkel zwischen zwei Vektoren bestimmt. Hätte da jemand eine "schönere" Idee also ich weiß, dass Inventor mit Matrixen arbeitet aber leider weiß ich nicht wie ich mir diese ausgeben lassen kann.&lt;/P&gt;&lt;P&gt;Vielen Dank und freundliche Grüße&amp;nbsp;&lt;/P&gt;&lt;P&gt;Valentin&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 08:14:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-deutsches-forum/aktuellen-versatz-unterschiedlicher-bauteile-einer-baugruppe-in/m-p/10297074#M7799</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-07T08:14:01Z</dc:date>
    </item>
    <item>
      <title>Betreff: Aktuellen Versatz unterschiedlicher Bauteile einer Baugruppe in Inventor auslesen</title>
      <link>https://forums.autodesk.com/t5/inventor-deutsches-forum/aktuellen-versatz-unterschiedlicher-bauteile-einer-baugruppe-in/m-p/10302022#M7800</link>
      <description>&lt;P&gt;Hallo&amp;nbsp;@Anonymous,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ich habe leider versäumt hier zu antworten, aber du hast meinen Beitrag ja schon entdeckt.&lt;/P&gt;
&lt;P&gt;Hier der Link zu dem Beitrag:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-deutsch/zugriff-auf-aktuellen-versatz-mit-ilogoc/m-p/10301955#M21749" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/inventor-deutsch/zugriff-auf-aktuellen-versatz-mit-ilogoc/m-p/10301955#M21749&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hier auch nochmal der Code um diesen Beitrag hier auch zu beantworten:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Private Sub all_angle_of_comp() 'Alle Winkel in Grad
    dPi = Atn(1) * 4
    Dim oOcc As ComponentOccurrence
    Set oOcc = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Komponente auswählen..")
    Set oRotMat = oOcc.Transformation
    Dim v1 As String, v2 As String, v3 As String, w1 As String, w2 As String, w3 As String
    dPi = Atn(1) * 4
    
    v1 = "X-Versatz = " &amp;amp; Round(oRotMat.Cell(1, 4) * 10, 3)
    v2 = "Y-Versatz = " &amp;amp; Round(oRotMat.Cell(2, 4) * 10, 3)
    v3 = "Z-Versatz = " &amp;amp; Round(oRotMat.Cell(3, 4) * 10, 3)
    w1 = "X-Winkel = " &amp;amp; Round(ArcTan2(oRotMat.Cell(2, 3), oRotMat.Cell(3, 3)) * 180 / dPi, 3)
    w2 = "Y-Winkel = " &amp;amp; Round(-ArcSin(oRotMat.Cell(1, 3)) * 180 / dPi, 3)
    w3 = "Z-Winkel = " &amp;amp; Round(ArcTan2(oRotMat.Cell(1, 2), oRotMat.Cell(1, 1)) * 180 / dPi, 3)
    
    MsgBox oOcc.Name &amp;amp; vbCr &amp;amp; vbCr &amp;amp; v1 &amp;amp; vbCr &amp;amp; v2 &amp;amp; vbCr &amp;amp; v3 &amp;amp; vbCr &amp;amp; vbCr &amp;amp; w1 &amp;amp; vbCr &amp;amp; w2 &amp;amp; vbCr &amp;amp; w3, , "KrA"
End Sub

Private Function ArcSin(x As Double) As Double
    dPi = Atn(1) * 4
    If Abs(x) = 1 Then
        ArcSin = (Sgn(x) * dPi / 2)
    Else
        ArcSin = (Atn(x / Sqr(1 - x ^ 2)))
    End If
End Function

Private Function ArcCos(x As Double) As Double
    dPi = Atn(1) * 4
    If Abs(x) = 1 Then
        ArcCos = (dPi / 2 - (Sgn(x) * dPi / 2))
    Else
        ArcCos = (dPi / 2 - Atn(x / Sqr(1 - x ^ 2)))
    End If
End Function

Public Function ArcTan2(y As Double, x As Double) As Double
    If x &amp;gt; 0 Then
        ArcTan2 = Atn(y / x)
    ElseIf x &amp;lt; 0 Then
        ArcTan2 = Sgn(y) * (Pi - Atn(Abs(y / x)))
    ElseIf y = 0 Then
        ArcTan2 = 0
    Else
        ArcTan2 = Sgn(y) * Pi / 2
    End If
End Function&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Viele Grüße,&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 08:09:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-deutsches-forum/aktuellen-versatz-unterschiedlicher-bauteile-einer-baugruppe-in/m-p/10302022#M7800</guid>
      <dc:creator>fullevent</dc:creator>
      <dc:date>2021-05-10T08:09:15Z</dc:date>
    </item>
    <item>
      <title>Betreff: Aktuellen Versatz unterschiedlicher Bauteile einer Baugruppe in Inventor auslesen</title>
      <link>https://forums.autodesk.com/t5/inventor-deutsches-forum/aktuellen-versatz-unterschiedlicher-bauteile-einer-baugruppe-in/m-p/10302073#M7801</link>
      <description>&lt;P&gt;Vielen Dank&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 08:38:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-deutsches-forum/aktuellen-versatz-unterschiedlicher-bauteile-einer-baugruppe-in/m-p/10302073#M7801</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-10T08:38:18Z</dc:date>
    </item>
  </channel>
</rss>

