<?xml version="1.0" encoding="windows-1250" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>CAD F&#243;rum : Inventor - vložení pole spojováku</title>
  <link>https://www.cadforum.cz/forum/</link>
  <description><![CDATA[Toto je XML obsahový kanál serveru; CAD F&#243;rum : CAD programov&#225;n&#237; : Inventor - vložení pole spojováku]]></description>
  <pubDate>Sat, 16 May 2026 18:35:34 +0000</pubDate>
  <lastBuildDate>Tue, 29 Sep 2015 10:44:33 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>https://www.cadforum.cz/forum/RSS_post_feed.asp?TID=21503</WebWizForums:feedURL>
  <image>
   <title><![CDATA[CAD F&#243;rum]]></title>
   <url>https://www.cadforum.cz/forum/forum_images/web_wiz_forums.png</url>
   <link>https://www.cadforum.cz/forum/</link>
  </image>
  <item>
   <title><![CDATA[Inventor - vložení pole spojováku : Nakonec jsem to musel vy&#345;e&#353;it...]]></title>
   <link>https://www.cadforum.cz/forum/forum_posts.asp?TID=21503&amp;PID=95160&amp;title=inventor-vlozeni-pole-spojovaku#95160</link>
   <description>
    <![CDATA[<strong>Autor:</strong> <a href="https://www.cadforum.cz/forum/member_profile.asp?PF=23776">spratek</a><br /><strong>Předmět:</strong> 21503<br /><strong>Zasláno:</strong> 29.zář.2015 v 10:44<br /><br /><p>Nakonec jsem to musel vyřešit pomocí funkce FindUsingPoint(). Jednak toto řešení funguje za všech situací a ještě jednoduše určím tloušťku spojovaného materiálu pro volbu délky šroubu. Sice se o něco prodlouží běh programu, ale pořád je to akceptovatelné.</p><p>Pro inspiraci kód přikládám.&nbsp;</p><p><table width="99%"><tr><td><pre class="BBcode"></p><p>Imports Inventor<br><br>Public Class MB_Spojovak<br>    Public Sub MB_Spojovak()<br><br>        Dim m_inventorApp As Inventor.Application = Nothing<br>        m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")<br><br>        Dim oAssyDoc As AssemblyDocument<br>        oAssyDoc = m_inventorApp.ActiveDocument<br><br><br>        Dim oAssyDef As AssemblyComponentDefinition<br>        oAssyDef = oAssyDoc.ComponentDefinition<br><br><br>        ' Have the user select a circular edge.<br>        Dim partEdge As Edge<br>        partEdge = m_inventorApp.CommandManager.Pick(SelectionFilterEnum.kPartEdgeCircularFilter, "Select a circular edge.")<br><br><br>        'když nic nevybereš exit<br>        If partEdge Is Nothing Then<br>            Exit Sub<br>        End If<br><br>        'Dim Occurrence As ComponentOccurrenceProxy<br>        Dim Occurrence As ComponentOccurrence<br>        Occurrence = partEdge.Parent.Parent<br><br>        Dim dira_1 As Inventor.Circle 'Circ1<br>        dira_1 = partEdge.Geometry    'Circ1<br>        Dim dira_1_stred As Point<br>        dira_1_stred = dira_1.Center<br><br><br>        'najde všechny středy děr v zadané vzdálenosti (v tomto případě 12 cm)<br>        Dim najdu_center As ObjectsEnumerator<br>        Dim filtr_new As Inventor.SelectionFilterEnum()<br>        filtr_new = New Inventor.SelectionFilterEnum(0) {Inventor.SelectionFilterEnum.kAllCircularEntities}<br>        najdu_center = oAssyDef.FindUsingPoint(dira_1.Center, filtr_new, 11.001, True)<br><br>        'pokud něco najde provede akci<br>        If najdu_center.Count &gt; 0 Then<br>            Dim bod_pole(1) As Point<br>            Dim aa As Byte = 0<br>            Dim diry As Object<br>            Dim distance As Double<br>            Dim stred As Point<br>            Dim osa(2) As Vector<br>            Dim boltOcc As ComponentOccurrence = Nothing<br>            'projde všechny nalezené díry<br>            For i = 1 To najdu_center.Count<br>                diry = najdu_center.Item(i)<br>                'zjistí vzdálenost mezi označenou dírou a nalezenou dírou<br>                distance = dira_1_stred.DistanceTo(diry.geometry.center)<br><br>                'když je vzdálenost 110 mm pokračuje, vzdálenost zaokrouhluje na 5 desetinných míst<br>                If Math.Round(distance, 5) = 11.0 Then<br><br>                    stred = diry.geometry.center<br>                    'v nalezeném středu vytvoří dočasný bod<br>                    'bod_pole(aa) = m_inventorApp.TransientGeometry.CreatePoint(stred.X, stred.Y, stred.Z)<br>                    bod_pole(aa) = stred<br>                    'vytvoří vektor ve středu nalezené díry<br>                    osa(aa) = m_inventorApp.TransientGeometry.CreateVector(bod_pole(aa).X, bod_pole(aa).Y, bod_pole(aa).Z)<br><br><br>                    aa = 1<br>                ElseIf Math.Round(distance, 1) = 5.0 Then<br>&nbsp;                   boltOcc = oAssyDoc.ComponentDefinition.Occurrences.Add("X:\XXX\HV_M24-85_(47-51).ipt",<br>                                                                           m_inventorApp.TransientGeometry.CreateMatrix)<br>                    ' MsgBox("Distance " &amp; " = " &amp; distance &amp; vbCrLf &amp; "50 mm")<br><br>                ElseIf Math.Round(distance, 1) = 5.1 Then<br>&nbsp;                   boltOcc = oAssyDoc.ComponentDefinition.Occurrences.Add("X:\XXX\HV_M24-85_(47-51).ipt",<br>                                                                           m_inventorApp.TransientGeometry.CreateMatrix)<br>                    'MsgBox("Distance " &amp; " = " &amp; distance &amp; vbCrLf &amp; "51 mm")<br><br>                ElseIf Math.Round(distance, 1) = 6.0 Then<br>&nbsp;                   boltOcc = oAssyDoc.ComponentDefinition.Occurrences.Add("X:\XXX\HV_M24-100_(59-63).ipt",<br>                                                                           m_inventorApp.TransientGeometry.CreateMatrix)<br>                    'MsgBox("Distance " &amp; " = " &amp; distance &amp; vbCrLf &amp; "60 mm")<br><br>                ElseIf Math.Round(distance, 1) = 6.1 Then<br>&nbsp;                   boltOcc = oAssyDoc.ComponentDefinition.Occurrences.Add("X:\XXX\HV_M24-100_(59-63).ipt",<br>                                                                           m_inventorApp.TransientGeometry.CreateMatrix)<br>                    ' MsgBox("Distance " &amp; " = " &amp; distance &amp; vbCrLf &amp; "61mm")<br>                Else<br><br>                    MessageBox.Show("Tloušťka spojovaného materálu není v rozmezí 50-61mm." &amp; vbCrLf &amp; "Spoj budeš muset vytvořit sám.", "Nestandartní tl. spoj. mat.!")<br>                    Exit Sub<br><br>                End If<br><br>                If Not (bod_pole(0) Is Nothing Or bod_pole(1) Is Nothing) Then<br><br>                    Exit For<br><br>                End If<br><br><br>            Next i<br>            'vytvoří vektor ve středu označené díry<br>            osa(2) = m_inventorApp.TransientGeometry.CreateVector(dira_1_stred.X, dira_1_stred.Y, dira_1_stred.Z)<br><br><br>            Dim Osa_Unit(1) As UnitVector<br>            Dim WorkAx(1) As WorkAxis<br>            For ii = 0 To 1<br>                'rozdíl vektorů označené a nalezené díry<br>                osa(ii).SubtractVector(osa(2))<br>                Osa_Unit(ii) = osa(ii).AsUnitVector<br>                'WorkAx(i) = oAssyDef.WorkAxes.AddFixed(dira_1_stred, Osa_Unit(i))<br>            Next ii<br><br><br>            Dim filtr_hrana As Inventor.SelectionFilterEnum()<br>            filtr_hrana = New Inventor.SelectionFilterEnum(0) {Inventor.SelectionFilterEnum.kPartEdgeLinearFilter}<br><br>            'najde všechny lineární hrany kolem vybrané díry<br>            Dim hrana As ObjectsEnumerator<br>            hrana = oAssyDef.FindUsingPoint(dira_1_stred, filtr_hrana, 10, True)<br><br>            If hrana Is Nothing Then<br>                MsgBox("Nenašel jsem žádnou hranu, akce bude přerušena!")<br>                Exit Sub<br>            End If<br><br>            Dim oznac_x As Edge = Nothing<br>            Dim oznac_y As Edge = Nothing<br><br><br>            'vybere dve hrany v modelu které mají stejný směr jako díry raprezentované vektorem<br>            For hr = 1 To hrana.Count<br>                Try<br><br>                    If Osa_Unit(0).IsEqualTo(hrana.Item(hr).geometry.direction, 0.00001) And oznac_x Is Nothing Then<br>                        'oAssyDoc.SelectSet.Select(hrana.Item(hr))<br>                        'MsgBox("je rovn_x")<br>                        oznac_x = hrana.Item(hr)<br>                    ElseIf Osa_Unit(1).IsEqualTo(hrana.Item(hr).geometry.direction, 0.00001) And oznac_y Is Nothing Then<br>                        'oAssyDoc.SelectSet.Select(hrana.Item(hr))<br>                        ' MsgBox("je rovn_y")<br>                        oznac_y = hrana.Item(hr)<br>                    End If<br><br><br><br>                Catch Ex As Exception<br>                    ' MsgBox(Ex.ToString)<br>                End Try<br><br>                'když najde odpovídající dvě hrany ukončí For<br>                If oznac_x Is Nothing Or oznac_y Is Nothing Then<br>                Else<br><br>                    'MsgBox("koncim")<br>                    Exit For<br>                End If<br><br>            Next hr<br><br><br>&nbsp;         &nbsp;&nbsp;' Get the part document of the bolt. <br>            Dim boltDoc As PartDocument<br>            boltDoc = boltOcc.Definition.Document<br><br>            ' Query the attributes in the part for the attribute set named "InsertEdge".<br>            Dim attribSets As AttributeSetsEnumerator<br>            attribSets = boltDoc.AttributeManager.FindAttributeSets("HranaVlozeni")<br><br>            ' Assume success and get the parent from first item returned, <br>            ' which will be the edge. <br>            Dim boltEdge As Edge<br>            boltEdge = attribSets.Item(1).Parent.Parent<br><br>            ' Create a proxy for the edge. <br>            Dim boltEdgeProxy As EdgeProxy = Nothing<br>            boltOcc.CreateGeometryProxy(boltEdge, boltEdgeProxy)<br><br>            ' Create a constraint. <br>            oAssyDoc.ComponentDefinition.Constraints.AddInsertConstraint(partEdge, boltEdgeProxy, True, 0)<br><br>            'Create an object collection<br>            Dim objCol As ObjectCollection<br>            objCol = m_inventorApp.TransientObjects.CreateObjectCollection()<br><br>            'add the desired occurrence to be patterned<br>            objCol.Add(oAssyDef.Occurrences.ItemByName(boltOcc.Name))<br><br>            'set the number of patterns in the x direction<br>            Dim no_x_rect As Integer<br>            no_x_rect = 2<br><br>            'set the number of patterns in the y direction<br>            Dim no_y_rect As Integer<br>            no_y_rect = 2<br><br><br>            'vytvoří pole komponent<br>            oAssyDef.OccurrencePatterns.AddRectangularPattern(objCol, oznac_x, True, 11, no_x_rect, oznac_y, True, 11, no_y_rect)<br><br><br><br><br><br>        Else<br>            MsgBox("Nenašel jsem žádnou díru!" &amp; vbCrLf &amp; "Akce bude ukončena.")<br>            Exit Sub<br>        End If<br><br><br><br>    End Sub<br>End Class&nbsp;</p><p></pre></td></tr></table></p>]]>
   </description>
   <pubDate>Tue, 29 Sep 2015 10:44:33 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum/forum_posts.asp?TID=21503&amp;PID=95160&amp;title=inventor-vlozeni-pole-spojovaku#95160</guid>
  </item> 
  <item>
   <title><![CDATA[Inventor - vložení pole spojováku :  Na to &#382;&#225;dn&#225; p&#345;&#237;mo&#269;ar&#225; metoda...]]></title>
   <link>https://www.cadforum.cz/forum/forum_posts.asp?TID=21503&amp;PID=94635&amp;title=inventor-vlozeni-pole-spojovaku#94635</link>
   <description>
    <![CDATA[<strong>Autor:</strong> <a href="https://www.cadforum.cz/forum/member_profile.asp?PF=9996">Navara</a><br /><strong>Předmět:</strong> 21503<br /><strong>Zasláno:</strong> 24.srp.2015 v 16:16<br /><br />Na to žádná přímočará metoda není. Prvek díra o sobě neříká, že je zdrojem pro nějaké pole.]]>
   </description>
   <pubDate>Mon, 24 Aug 2015 16:16:22 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum/forum_posts.asp?TID=21503&amp;PID=94635&amp;title=inventor-vlozeni-pole-spojovaku#94635</guid>
  </item> 
  <item>
   <title><![CDATA[Inventor - vložení pole spojováku : D&#283;kuji za zaslan&#253; k&#243;d, mysl&#237;m,...]]></title>
   <link>https://www.cadforum.cz/forum/forum_posts.asp?TID=21503&amp;PID=94634&amp;title=inventor-vlozeni-pole-spojovaku#94634</link>
   <description>
    <![CDATA[<strong>Autor:</strong> <a href="https://www.cadforum.cz/forum/member_profile.asp?PF=23776">spratek</a><br /><strong>Předmět:</strong> 21503<br /><strong>Zasláno:</strong> 24.srp.2015 v 16:10<br /><br /><p>Děkuji za zaslaný kód, myslím, že přesně toto jsem potřeboval. Zjistil jsem u toho ale jenden malý problém.</p><p>Ten tkví v tom, že když vyberu hranu díry, která je na první pozici pole, které tvoří díry, funkce GetFirstEdge vrací hodnotu rectPattern=nothing. Mě by spíše vyhovovalo, aby tato hodnota vždy vracela vlastnoti pole, ze kerého bych potom nějak vypreparoval vlastnosti použitelné pro moje pole se šrouby.&nbsp;</p><p>Je možné GetFirstEdge upravit tak, aby hodnotu rectPattern vracela vždy?</p><p>Ještě jednou díky za případné postřehy.</p><p><br></p><p>&nbsp;</p><p><br></p>]]>
   </description>
   <pubDate>Mon, 24 Aug 2015 16:10:43 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum/forum_posts.asp?TID=21503&amp;PID=94634&amp;title=inventor-vlozeni-pole-spojovaku#94634</guid>
  </item> 
  <item>
   <title><![CDATA[Inventor - vložení pole spojováku :   J&#225; bych asi zkusil naj&#237;t odpov&#237;daj&#237;c&#237;...]]></title>
   <link>https://www.cadforum.cz/forum/forum_posts.asp?TID=21503&amp;PID=94614&amp;title=inventor-vlozeni-pole-spojovaku#94614</link>
   <description>
    <![CDATA[<strong>Autor:</strong> <a href="https://www.cadforum.cz/forum/member_profile.asp?PF=9996">Navara</a><br /><strong>Předmět:</strong> 21503<br /><strong>Zasláno:</strong> 21.srp.2015 v 13:57<br /><br />Já bych asi zkusil najít odpovídající hranu k té vybrané na prvním elementu pole. Jako bonus dostanu to pole a jeho parametry. Tohle je iLogic kód pro jeden z mnoha způsobů, jak to udělat.<div></div><div>&nbsp;</div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>Sub Main()<br>&nbsp;&nbsp;&nbsp; Dim oEdgeProxy As EdgeProxy = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeCircularFilter, "Select edge")</div><div>&nbsp;&nbsp;&nbsp; Dim rectPattern As RectangularPatternFeatureProxy = Nothing<br>&nbsp;&nbsp;&nbsp; Dim result As EdgeProxy = GetFirstEdge(oEdgeProxy, rectPattern)</div><div>&nbsp;&nbsp;&nbsp; ThisApplication.ActiveDocument.SelectSet.Clear()<br>&nbsp;&nbsp;&nbsp; ThisApplication.ActiveDocument.SelectSet.Select(result)<br>End Sub</div><div>Function GetFirstEdge(ByVal oEdgeProxy As EdgeProxy, ByRef rectPattern As RectangularPatternFeatureProxy) As EdgeProxy</div><div>&nbsp;&nbsp;&nbsp; Dim pattern As RectangularPatternFeatureProxy = Nothing</div><div>&nbsp;&nbsp;&nbsp; For Each oFaceProxy As FaceProxy In oEdgeProxy.Faces<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If oFaceProxy.CreatedByFeature.Type = ObjectTypeEnum.kRectangularPatternFeatureProxyObject Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pattern = oFaceProxy.CreatedByFeature<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit For<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp;&nbsp; Next<br>&nbsp;&nbsp;&nbsp; rectPattern = pattern</div><div>&nbsp;&nbsp;&nbsp; If pattern Is Nothing Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return oEdgeProxy<br>&nbsp;&nbsp;&nbsp; End If</div><div>&nbsp;&nbsp;&nbsp; Dim holeProxy As HoleFeatureProxy = pattern.ParentFeatures(1)</div><div>&nbsp;&nbsp;&nbsp; Dim edgeCircle As Circle = oEdgeProxy.Geometry<br>&nbsp;&nbsp;&nbsp; Dim edgePlane As Plane = ThisApplication.TransientGeometry.CreatePlane(edgeCircle.Center, edgeCircle.Normal.AsVector())</div><div>&nbsp;&nbsp;&nbsp; For Each holeFace As FaceProxy In holeProxy.Faces<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For Each holeEdge As EdgeProxy In holeFace.Edges<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If holeEdge.GeometryType &lt;&gt; CurveTypeEnum.kCircleCurve Then Continue For<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim holeCircle As Circle = holeEdge.Geometry</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Check radius<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Math.Abs(edgeCircle.Radius - holeCircle.Radius) &gt; 0.0001 Then Continue For</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Check distance<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim holePlane As Plane = ThisApplication.TransientGeometry.CreatePlane(holeCircle.Center, holeCircle.Normal.AsVector())</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim MinimumDistance As Double = ThisApplication.MeasureTools.GetMinimumDistance(edgePlane, holePlane)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If MinimumDistance &lt; 0.0001 Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return holeEdge<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br>&nbsp;&nbsp;&nbsp; Next</div><div>&nbsp;&nbsp;&nbsp; 'Default result<br>&nbsp;&nbsp;&nbsp; rectPattern = Nothing<br>&nbsp;&nbsp;&nbsp; Return oEdgeProxy<br>End Function</div><div></pre></td></tr></table></div>]]>
   </description>
   <pubDate>Fri, 21 Aug 2015 13:57:19 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum/forum_posts.asp?TID=21503&amp;PID=94614&amp;title=inventor-vlozeni-pole-spojovaku#94614</guid>
  </item> 
  <item>
   <title><![CDATA[Inventor - vložení pole spojováku : Dobr&#253; den, pokou&#353;&#237;m se pro Inventor...]]></title>
   <link>https://www.cadforum.cz/forum/forum_posts.asp?TID=21503&amp;PID=94582&amp;title=inventor-vlozeni-pole-spojovaku#94582</link>
   <description>
    <![CDATA[<strong>Autor:</strong> <a href="https://www.cadforum.cz/forum/member_profile.asp?PF=23776">spratek</a><br /><strong>Předmět:</strong> 21503<br /><strong>Zasláno:</strong> 19.srp.2015 v 13:19<br /><br /><p>Dobrý den,&nbsp;</p><p>pokouším se pro Inventor napsat utilitku ve vb.net, která by uměla do plechu se čtyřmi děrami &nbsp;pro šrouby s konstantní roztečí 110 mm, vložit čtyři šrouby (nejlépe jako pole) do těchto děr, pokud označím jen jednu hranu otvoru pro šroub viz. obr.</p><p>Hranu vybírám pomocí&nbsp;</p><p><font face="Courier New, Courier, mono">Dim partEdge As Edge<br>        partEdge = m_inventorApp.CommandManager.Pick(SelectionFilterEnum.kPartEdgeCircularFilter, "Select a circular edge.")</font></p><p>Vše funguje, akorát nevím jak udělat to, aby šrouby vždy zapadly do děr, to znamená, že ať vyberu jakoukoliv ze čtyř děr, šrouby si najdou zbývající tři a ne jako na obrázku, kdy je natvrdo dán směr vyplnění pole komponent.</p><p>Pole komponent vkládám následovně</p><p><font face="Courier New, Courier, mono">oAssyDef.OccurrencePatterns.AddRectangularPattern(objCol, oWorkAxesX, True, -11, no_x_rect, oWorkAxesY, True, -11, no_y_rect)</font></p><p>Celý kód je pod obrázkem.</p><p>R.M.</p><p><br></p><p><img src="uploads/23776/OBR1.jpg" height="444" width="600" border="0" />.</p><p><font face="Courier New, Courier, mono">Imports System<br>Imports System.Collections.Generic<br>Imports System.Linq<br>Imports System.Text<br>Imports Inventor<br>Imports System.Runtime.InteropServices<br><br><br>Public Class osy<br>    Public Sub Main()<br>&nbsp;      &nbsp;<br>        'vloží šroub a připojí ho k označené díře<br>        Dim m_inventorApp As Inventor.Application = Nothing<br>        m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")<br><br>        Dim asmDoc As AssemblyDocument<br>        asmDoc = m_inventorApp.ActiveDocument<br><br>        ' Have the user select a circular edge.<br>        Dim partEdge As Edge<br>        partEdge = m_inventorApp.CommandManager.Pick(SelectionFilterEnum.kPartEdgeCircularFilter, "Select a circular edge.")<br><br>        If partEdge Is Nothing Then<br>            Exit Sub<br>        End If<br><br>        ' Place the bolt into the assembly. <br>        Dim boltOcc As ComponentOccurrence<br>&nbsp;       boltOcc = asmDoc.ComponentDefinition.Occurrences.Add("e:\******\Atributy_HV_M20-105_(68-72).ipt",<br>                                                             m_inventorApp.TransientGeometry.CreateMatrix)<br>        ' Get the part document of the bolt. <br>        Dim boltDoc As PartDocument<br>        boltDoc = boltOcc.Definition.Document<br><br>        ' Query the attributes in the part for the attribute set named "InsertEdge".<br>        Dim attribSets As AttributeSetsEnumerator<br>        attribSets = boltDoc.AttributeManager.FindAttributeSets("InsertEdge")<br><br>        'attribSets = boltDoc.AttributeManager.FindAttributeSets("*")<br>        ' Assume success and get the parent from first item returned, <br>        ' which will be the edge. <br>        Dim boltEdge As Edge<br>        boltEdge = attribSets.Item(1).Parent.Parent<br><br>        ' Create a proxy for the edge. <br>        Dim boltEdgeProxy As EdgeProxy<br>        boltOcc.CreateGeometryProxy(boltEdge, boltEdgeProxy)<br><br>        ' Create a constraint. <br>        asmDoc.ComponentDefinition.Constraints.AddInsertConstraint(partEdge, boltEdgeProxy, True, 0)<br><br>        Dim oAssyDoc As AssemblyDocument<br>        oAssyDoc = m_inventorApp.ActiveDocument<br><br>        Dim oAssyDef As AssemblyComponentDefinition<br>        oAssyDef = oAssyDoc.ComponentDefinition<br><br>        If oAssyDef.Occurrences.Count &lt; 2 Then<br>            MsgBox("Assembly must have 2 components")<br>            Exit Sub<br>        End If<br><br>        'Dim Occurrence As ComponentOccurrenceProxy<br>        Dim Occurrence As ComponentOccurrence<br>        Occurrence = partEdge.Parent.Parent<br><br><br>        Dim XAxis As WorkAxis<br>        Dim YAxis As WorkAxis<br>        Dim Zaxis As WorkAxis<br><br><br>        ' With oAssyDef<br>        With Occurrence.Definition<br>            XAxis = .WorkAxes.Item(1)<br>            YAxis = .WorkAxes.Item(2)<br>            Zaxis = .WorkAxes.Item(3)<br>        End With<br><br>        Dim oWorkAxesX As WorkAxisProxy<br>        Occurrence.CreateGeometryProxy(XAxis, oWorkAxesX)<br>        Dim oWorkAxesY As WorkAxisProxy<br>        Occurrence.CreateGeometryProxy(YAxis, oWorkAxesY)<br><br>        'Create an object collection<br>        Dim objCol As ObjectCollection<br>        objCol = m_inventorApp.TransientObjects.CreateObjectCollection()<br><br>        'add the desired occurrence to be patterned<br>        objCol.Add(oAssyDef.Occurrences.ItemByName(boltOcc.Name))<br><br>        'set the number of patterns in the x direction<br>        Dim no_x_rect As Integer<br>        no_x_rect = 2<br><br>        'set the number of patterns in the y direction<br>        Dim no_y_rect As Integer<br>        no_y_rect = 2<br><br><br>        'Creating a Rectangular pattern<br>        oAssyDef.OccurrencePatterns.AddRectangularPattern(objCol, oWorkAxesX, True, -11, no_x_rect, oWorkAxesY, True, -11, no_y_rect)<br><br><br><br>    End Sub<br><br><br>End Class&nbsp;</font></p><span style="font-size:10px"><br /><br />Upravil spratek - 19.srp.2015 v 15:35</span>]]>
   </description>
   <pubDate>Wed, 19 Aug 2015 13:19:41 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum/forum_posts.asp?TID=21503&amp;PID=94582&amp;title=inventor-vlozeni-pole-spojovaku#94582</guid>
  </item> 
 </channel>
</rss>