<?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>topic Re: Set the dimension position in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12014939#M153551</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7946284"&gt;@A.Acheson&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;this is the code i've been using, I still can't figure out how to know which side the occurrence is on (right,left,up or down), in both drawings i'm using the same code only one has more walls(occurrences) than the other one.&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim drawingDoc As DrawingDocument = ThisApplication.ActiveDocument
' Loop through each sheet in the drawing document
For Each sheet As Sheet In drawingDoc.Sheets
	' Loop through each view on the sheet
For Each view As DrawingView In Sheet.DrawingViews
    If View.name = "VIEW1" Then
        ' Check if the view is an assembly view
        ' Get the assembly document for the view
        Dim asmDoc As AssemblyDocument = View.ReferencedDocumentDescriptor.ReferencedDocument

        ' [Loop through each assembly component
        For Each comp As ComponentOccurrence In asmDoc.ComponentDefinition.Occurrences
            Dim Componente = comp.Name 
            Dim BuscarWalls As String = "Wall"
            If Componente.Contains(BuscarWalls) = True Then
				
                ' Add a dimension to the component if the component name contains "Wall"
               Dim ShGeneral = ThisDrawing.Sheets.ItemByName("General:1") 
               Dim genDims = ShGeneral.DrawingDimensions.GeneralDimensions
               Dim VIEW1 = ShGeneral.DrawingViews.ItemByName("VIEW1") 
			   Dim WPl_Wall_FlangeLeft = VIEW1.GetIntent(comp.Name,"WPl_Wall-FlangeLeft")
               Dim WPl_Wall_FlangeRight = VIEW1.GetIntent(comp.Name, "WPl_Wall-FlangeRight")

 
''[Find a way to set the dimension depending on where the coordinate is located
''[Declare variables for the dimension position
Dim oMatrix As Matrix = comp.Transformation
Dim x As Double = oMatrix.Cell(1, 4)
Dim y As Double = oMatrix.Cell(2, 4)
Dim z As Double = oMatrix.Cell(3, 4)

Dim dimX As Double
Dim dimY As Double 
 If x &amp;lt; 0 And y &amp;lt; 0 And z &amp;lt; 0 Then 
    dimX = 1.10
	dimY = -0.02
	
Else If x &amp;gt; 0 And y &amp;lt; 0 And z &amp;lt; 0 Then  
   dimX = -0.03
	dimY = 1
	
Else If x &amp;gt; 0 And z &amp;gt; 0 And y &amp;lt; 0 Then 
	dimX = 0.07
	dimY = 1.02
	
Else If z &amp;gt; 0 And x &amp;lt; 0 And y &amp;lt; 0  Then
	dimX = 1.03 
	dimY = 0

End If

                Dim linDim1 = genDims.AddLinear("Width_" &amp;amp; Componente, VIEW1.SheetPoint(dimX, dimY), WPl_Wall_FlangeLeft, WPl_Wall_FlangeRight)
          
            End If
        Next
    End If
    Next
   Next
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 491px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1224184i0A13084EC3F2015B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 681px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1224185iFB04E54E02E177E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jun 2023 15:39:24 GMT</pubDate>
    <dc:creator>kv5053545</dc:creator>
    <dc:date>2023-06-06T15:39:24Z</dc:date>
    <item>
      <title>Set the dimension position</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12012782#M153518</link>
      <description>&lt;P&gt;I have a drawing that has several occurrences within it and I would like to dimension it but when my set is bigger the dimensions get messed up, I don't know if it is possible to differentiate the sides of my set for example the top, bottom, right and left side, to define the position of the dimensions depending on where it is located.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 19:52:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12012782#M153518</guid>
      <dc:creator>kv5053545</dc:creator>
      <dc:date>2023-06-05T19:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Set the dimension position</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12014758#M153547</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14002492"&gt;@kv5053545&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you share an image of how the dimensions are changing when model size changes? Are you using code to add the dimensions if so please attach the code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 14:30:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12014758#M153547</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-06-06T14:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Set the dimension position</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12014939#M153551</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7946284"&gt;@A.Acheson&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;this is the code i've been using, I still can't figure out how to know which side the occurrence is on (right,left,up or down), in both drawings i'm using the same code only one has more walls(occurrences) than the other one.&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim drawingDoc As DrawingDocument = ThisApplication.ActiveDocument
' Loop through each sheet in the drawing document
For Each sheet As Sheet In drawingDoc.Sheets
	' Loop through each view on the sheet
For Each view As DrawingView In Sheet.DrawingViews
    If View.name = "VIEW1" Then
        ' Check if the view is an assembly view
        ' Get the assembly document for the view
        Dim asmDoc As AssemblyDocument = View.ReferencedDocumentDescriptor.ReferencedDocument

        ' [Loop through each assembly component
        For Each comp As ComponentOccurrence In asmDoc.ComponentDefinition.Occurrences
            Dim Componente = comp.Name 
            Dim BuscarWalls As String = "Wall"
            If Componente.Contains(BuscarWalls) = True Then
				
                ' Add a dimension to the component if the component name contains "Wall"
               Dim ShGeneral = ThisDrawing.Sheets.ItemByName("General:1") 
               Dim genDims = ShGeneral.DrawingDimensions.GeneralDimensions
               Dim VIEW1 = ShGeneral.DrawingViews.ItemByName("VIEW1") 
			   Dim WPl_Wall_FlangeLeft = VIEW1.GetIntent(comp.Name,"WPl_Wall-FlangeLeft")
               Dim WPl_Wall_FlangeRight = VIEW1.GetIntent(comp.Name, "WPl_Wall-FlangeRight")

 
''[Find a way to set the dimension depending on where the coordinate is located
''[Declare variables for the dimension position
Dim oMatrix As Matrix = comp.Transformation
Dim x As Double = oMatrix.Cell(1, 4)
Dim y As Double = oMatrix.Cell(2, 4)
Dim z As Double = oMatrix.Cell(3, 4)

Dim dimX As Double
Dim dimY As Double 
 If x &amp;lt; 0 And y &amp;lt; 0 And z &amp;lt; 0 Then 
    dimX = 1.10
	dimY = -0.02
	
Else If x &amp;gt; 0 And y &amp;lt; 0 And z &amp;lt; 0 Then  
   dimX = -0.03
	dimY = 1
	
Else If x &amp;gt; 0 And z &amp;gt; 0 And y &amp;lt; 0 Then 
	dimX = 0.07
	dimY = 1.02
	
Else If z &amp;gt; 0 And x &amp;lt; 0 And y &amp;lt; 0  Then
	dimX = 1.03 
	dimY = 0

End If

                Dim linDim1 = genDims.AddLinear("Width_" &amp;amp; Componente, VIEW1.SheetPoint(dimX, dimY), WPl_Wall_FlangeLeft, WPl_Wall_FlangeRight)
          
            End If
        Next
    End If
    Next
   Next
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 491px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1224184i0A13084EC3F2015B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 681px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1224185iFB04E54E02E177E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 15:39:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12014939#M153551</guid>
      <dc:creator>kv5053545</dc:creator>
      <dc:date>2023-06-06T15:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Set the dimension position</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12015124#M153553</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14002492"&gt;@kv5053545&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try center the text firstly and see how that works out.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;dim1&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;LinearGeneralDimension&lt;/SPAN&gt; = '............
&lt;SPAN&gt;dim1&lt;/SPAN&gt;.&lt;SPAN&gt;CenterText&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 16:56:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12015124#M153553</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-06-06T16:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Set the dimension position</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12015285#M153556</link>
      <description>If the text is centered they are still placed on top of the other dimensions, I don't know why the coordinates change and with them the dimensions instead of being on the right are shifted to the left and the lower dimensions are shifted to the top.</description>
      <pubDate>Tue, 06 Jun 2023 18:05:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/set-the-dimension-position/m-p/12015285#M153556</guid>
      <dc:creator>kv5053545</dc:creator>
      <dc:date>2023-06-06T18:05:00Z</dc:date>
    </item>
  </channel>
</rss>

