<?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: insert block into drawing sheet with custom part property in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443455#M15574</link>
    <description>&lt;P&gt;The code is very interesting and I appreciate the interest and how it proposes the solution, but I have tried to run the code and it does not execute any task, I try to relate the variables in a better way but it still does not perform any task.&lt;/P&gt;&lt;P&gt;I share the files with you so you can better understand what is happening.&lt;BR /&gt;thank you so much&lt;/P&gt;</description>
    <pubDate>Fri, 15 Dec 2023 13:09:37 GMT</pubDate>
    <dc:creator>Miguel.CarvajalS34Q6</dc:creator>
    <dc:date>2023-12-15T13:09:37Z</dc:date>
    <item>
      <title>insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12438978#M15570</link>
      <description>&lt;P&gt;I have a custom property that I can change from a list on a part form.&lt;BR /&gt;This variable must be recognized at the time of inserting the part into the drawing sheet, depending on this variable, which can be N7, N5, N4, N3, etc. A predefined block that already exists in the resources folder of the drawing module will be inserted.&lt;BR /&gt;The custom property has the same names as the blocks in the resources folder, so when you select the property in the part, in the drawing format it will recognize the block and insert it in a coordinate dependent on the size of the sheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;InventorVb&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentUpdate&lt;/SPAN&gt;()
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;BLOQUE&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Custom"&lt;/SPAN&gt;, &lt;SPAN&gt;"RUGOSIDAD"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt;
&lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSheet&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Sheet&lt;/SPAN&gt;
&lt;SPAN&gt;oSheet&lt;/SPAN&gt; = &lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveSheet&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSketchedSymbolDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SketchedSymbolDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;oSketchedSymbolDef&lt;/SPAN&gt; = &lt;SPAN&gt;oDrawDoc&lt;/SPAN&gt;.&lt;SPAN&gt;SketchedSymbolDefinitions&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"RUGOSIDAD"&lt;/SPAN&gt;)

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oTG&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TransientGeometry&lt;/SPAN&gt;
&lt;SPAN&gt;oTG&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientGeometry&lt;/SPAN&gt;


&lt;SPAN&gt;Select&lt;/SPAN&gt; &lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;BLOQUE&lt;/SPAN&gt;
    &lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;"FORMATO A4"&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSketchedSymbol&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SketchedSymbol&lt;/SPAN&gt;
&lt;SPAN&gt;oSketchedSymbol&lt;/SPAN&gt; = &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;SketchedSymbols&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt; _
	(&lt;SPAN&gt;oSketchedSymbolDef&lt;/SPAN&gt;, &lt;SPAN&gt;oTG&lt;/SPAN&gt;.&lt;SPAN&gt;CreatePoint2d&lt;/SPAN&gt;(11.3, 6.2), 0, 1, &lt;SPAN&gt;sPromptStrings&lt;/SPAN&gt;)

    &lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;"FORMATO A3"&lt;/SPAN&gt;
       &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSketchedSymbol&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SketchedSymbol&lt;/SPAN&gt;
&lt;SPAN&gt;oSketchedSymbol&lt;/SPAN&gt; = &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;SketchedSymbols&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt; _
	(&lt;SPAN&gt;oSketchedSymbolDef&lt;/SPAN&gt;, &lt;SPAN&gt;oTG&lt;/SPAN&gt;.&lt;SPAN&gt;CreatePoint2d&lt;/SPAN&gt;(15.5, 6.2), 0, 1, &lt;SPAN&gt;sPromptStrings&lt;/SPAN&gt;)
	
	 &lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;"FORMATO A2"&lt;/SPAN&gt;
       &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSketchedSymbol&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SketchedSymbol&lt;/SPAN&gt;
&lt;SPAN&gt;oSketchedSymbol&lt;/SPAN&gt; = &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;SketchedSymbols&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt; _
	(&lt;SPAN&gt;oSketchedSymbolDef&lt;/SPAN&gt;, &lt;SPAN&gt;oTG&lt;/SPAN&gt;.&lt;SPAN&gt;CreatePoint2d&lt;/SPAN&gt;(17.5, 6.2), 0, 1, &lt;SPAN&gt;sPromptStrings&lt;/SPAN&gt;)
	
	 &lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;"FORMATO A1"&lt;/SPAN&gt;
       &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSketchedSymbol&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SketchedSymbol&lt;/SPAN&gt;
&lt;SPAN&gt;oSketchedSymbol&lt;/SPAN&gt; = &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;SketchedSymbols&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt; _
	(&lt;SPAN&gt;oSketchedSymbolDef&lt;/SPAN&gt;, &lt;SPAN&gt;oTG&lt;/SPAN&gt;.&lt;SPAN&gt;CreatePoint2d&lt;/SPAN&gt;(20.5, 6.2), 0, 1, &lt;SPAN&gt;sPromptStrings&lt;/SPAN&gt;)
	
	 &lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;"FORMATO A0"&lt;/SPAN&gt;
       &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSketchedSymbol&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SketchedSymbol&lt;/SPAN&gt;
&lt;SPAN&gt;oSketchedSymbol&lt;/SPAN&gt; = &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;SketchedSymbols&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt; _
	(&lt;SPAN&gt;oSketchedSymbolDef&lt;/SPAN&gt;, &lt;SPAN&gt;oTG&lt;/SPAN&gt;.&lt;SPAN&gt;CreatePoint2d&lt;/SPAN&gt;(23.5, 6.2), 0, 1, &lt;SPAN&gt;sPromptStrings&lt;/SPAN&gt;)

    &lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;Else&lt;/SPAN&gt;
        
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Select&lt;/SPAN&gt;


&lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="formato a dibujo.jpg" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304374i66134BDDD36B72A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="formato a dibujo.jpg" alt="formato a dibujo.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;I generated this code, but I still can't get it to work&lt;/P&gt;&lt;P&gt;I don't know if what I want to achieve is possible, I can make a block be inserted automatically into the drawing, but I can't make the block selection exercise more dynamic.&lt;BR /&gt;can you help me, please&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 15:40:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12438978#M15570</guid>
      <dc:creator>Miguel.CarvajalS34Q6</dc:creator>
      <dc:date>2023-12-13T15:40:09Z</dc:date>
    </item>
    <item>
      <title>回复： insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12439048#M15571</link>
      <description>&lt;P&gt;This can be done, but it's a bit complicated and requires the use of UserInputEvents. When I have free time, I can help you complete this task&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 16:06:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12439048#M15571</guid>
      <dc:creator>yuzeaa</dc:creator>
      <dc:date>2023-12-13T16:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12439364#M15572</link>
      <description>&lt;P&gt;ok, thanks&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 18:05:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12439364#M15572</guid>
      <dc:creator>Miguel.CarvajalS34Q6</dc:creator>
      <dc:date>2023-12-13T18:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12441568#M15573</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I roughly wrote an initial version for you to test; feel free to make any adjustments if there are issues.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Class ThisRule
	Private WithEvents oApplicationEvents As ApplicationEvents
	Dim preSheetSize As String
	Dim isFirstView As Boolean = False
	Sub main
		If SharedVariable.Exists("DocumengChangeEvent") Then Return
		oApplicationEvents = ThisApplication.ApplicationEvents
		SharedVariable("DocumengChangeEvent") = "DocumengChangeEvent"
	End Sub
    Private Sub drawingChangeEvent( DocumentObject As _Document,
                                    BeforeOrAfter As EventTimingEnum,
                                    ReasonsForChange As CommandTypesEnum,
                                    Context As NameValueMap,
                                    ByRef HandlingCode As HandlingCodeEnum) _
									Handles oApplicationEvents.OnDocumentChange
        HandlingCode = HandlingCodeEnum.kEventNotHandled
		If BeforeOrAfter = EventTimingEnum.kBefore Then
			If Context(1) = "ChangeSheetProperties" Then
				preSheetSize = DocumentObject.ActiveSheet.Size
			Else If Context(1) = "EditDrawingBaseView" Then
			   If DocumentObject.ActiveSheet.DrawingViews.count = 0 Then
				   isFirstView = True
			   End If 
			End If
        End If
        If BeforeOrAfter = EventTimingEnum.kAfter Then
			If Context(1) = "ChangeSheetProperties" Then
				If DocumentObject.ActiveSheet.Size &amp;lt;&amp;gt; preSheetSize Then
					repositionsymbol(DocumentObject)
				End If
			Else If Context(1) = "EditDrawingBaseView" Then
				If isFirstView Then
					isFirstView = False
					Dim doc As DrawingDocument = DocumentObject
					Dim modeldoc As Document = doc.ActiveSheet.DrawingViews(1).ReferencedDocumentDescriptor.ReferencedDocument
					Try
					 Dim BLOQUE As String = modeldoc.PropertySets("Inventor User Defined Properties")("RUGOSIDAD").Value
					 addSketchsymbol(doc,BLOQUE)
					Catch
					 Exit Sub
					End Try
				End If
			 End If 
        End If
    End Sub
	
	Sub addSketchsymbol(oDrawDoc As DrawingDocument, blockname As String)
	   Dim oSheet As Sheet
       oSheet = oDrawDoc.ActiveSheet
	   Dim oSketchedSymbolDef As SketchedSymbolDefinition
       Try
	   oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item(blockname)
	   Catch
	   Exit Sub
	   End Try
	   Dim oTG As TransientGeometry
       oTG = ThisApplication.TransientGeometry
	   Dim sPromptStrings(0) As String
	   sPromptStrings(0) = "str"
	   oSketchedSymbol = oSheet.SketchedSymbols.Add(oSketchedSymbolDef, oTG.CreatePoint2d(17.5, 6.2), 0, 1, sPromptStrings)
	   oSketchedSymbol.Name = "FirstSketchSymbol"
	   repositionsymbol(oDrawDoc)
	End Sub
	
	Sub repositionsymbol(oDrawDoc As DrawingDocument)
	   Dim oSheet As Sheet
       oSheet = oDrawDoc.ActiveSheet
	   Dim SketchedSymbol As SketchedSymbol
	   Try
		   SketchedSymbol = oSheet.SketchedSymbols("FirstSketchSymbol")
	   Catch
		   Exit Sub
	   End Try
	   Dim oTG As TransientGeometry
       oTG = ThisApplication.TransientGeometry
	   Select Case oSheet.Size
	       Case DrawingSheetSizeEnum.kA0DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(23.5, 6.2)
		   Case DrawingSheetSizeEnum.kA1DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(20.5, 6.2)
		   Case DrawingSheetSizeEnum.kA2DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(17.5, 6.2)
		   Case DrawingSheetSizeEnum.kA3DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(15.5, 6.2)
		   Case DrawingSheetSizeEnum.kA4DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(11.3, 6.2)
	   End Select
	End Sub
End Class&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 14 Dec 2023 16:01:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12441568#M15573</guid>
      <dc:creator>yuzeaa</dc:creator>
      <dc:date>2023-12-14T16:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443455#M15574</link>
      <description>&lt;P&gt;The code is very interesting and I appreciate the interest and how it proposes the solution, but I have tried to run the code and it does not execute any task, I try to relate the variables in a better way but it still does not perform any task.&lt;/P&gt;&lt;P&gt;I share the files with you so you can better understand what is happening.&lt;BR /&gt;thank you so much&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 13:09:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443455#M15574</guid>
      <dc:creator>Miguel.CarvajalS34Q6</dc:creator>
      <dc:date>2023-12-15T13:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443515#M15575</link>
      <description>&lt;P&gt;I am using Inventor2020 and can't open your file. what is the property name of ipt,what is the promptstring of block.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 13:38:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443515#M15575</guid>
      <dc:creator>yuzeaa</dc:creator>
      <dc:date>2023-12-15T13:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443591#M15576</link>
      <description>&lt;P&gt;the custom property is called "RUGGESNESS" and the block on the drawing sheet is called "N7"&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 14:09:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443591#M15576</guid>
      <dc:creator>Miguel.CarvajalS34Q6</dc:creator>
      <dc:date>2023-12-15T14:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443619#M15577</link>
      <description>&lt;LI-CODE lang="visual-basic"&gt;Class ThisRule
	Private WithEvents oApplicationEvents As ApplicationEvents
	Dim preSheetSize As String
	Dim isFirstView As Boolean = False
	Sub main
		If SharedVariable.Exists("DocumengChangeEvent") Then Return
		oApplicationEvents = ThisApplication.ApplicationEvents
		SharedVariable("DocumengChangeEvent") = "DocumengChangeEvent"
	End Sub
    Private Sub drawingChangeEvent( DocumentObject As _Document,
                                    BeforeOrAfter As EventTimingEnum,
                                    ReasonsForChange As CommandTypesEnum,
                                    Context As NameValueMap,
                                    ByRef HandlingCode As HandlingCodeEnum) _
									Handles oApplicationEvents.OnDocumentChange
        HandlingCode = HandlingCodeEnum.kEventNotHandled
		If BeforeOrAfter = EventTimingEnum.kBefore Then
			If Context(1) = "ChangeSheetProperties" Then
				preSheetSize = DocumentObject.ActiveSheet.Size
			Else If Context(1) = "EditDrawingBaseView" Then
			   If DocumentObject.ActiveSheet.DrawingViews.count = 0 Then
				   isFirstView = True
			   End If 
			End If
        End If
        If BeforeOrAfter = EventTimingEnum.kAfter Then
			If Context(1) = "ChangeSheetProperties" Then
				If DocumentObject.ActiveSheet.Size &amp;lt;&amp;gt; preSheetSize Then
					repositionsymbol(DocumentObject)
				End If
			Else If Context(1) = "EditDrawingBaseView" Then
				If isFirstView Then
					isFirstView = False
					Dim doc As DrawingDocument = DocumentObject
					Dim modeldoc As Document = doc.ActiveSheet.DrawingViews(1).ReferencedDocumentDescriptor.ReferencedDocument
					Try
					 Dim BLOQUE As String = modeldoc.PropertySets("Inventor User Defined Properties")("RUGGESNESS").Value
					 addSketchsymbol(doc,BLOQUE)
					Catch
					 Exit Sub
					End Try
				End If
			 End If 
        End If
    End Sub
	
	Sub addSketchsymbol(oDrawDoc As DrawingDocument, blockname As String)
	   Dim oSheet As Sheet
       oSheet = oDrawDoc.ActiveSheet
	   Dim oSketchedSymbolDef As SketchedSymbolDefinition
       Try
	   oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item(blockname)
	   Catch
	   Exit Sub
	   End Try
	   Dim oTG As TransientGeometry
       oTG = ThisApplication.TransientGeometry
	   oSketchedSymbol = oSheet.SketchedSymbols.Add(oSketchedSymbolDef, oTG.CreatePoint2d(17.5, 6.2))
	   oSketchedSymbol.Name = "FirstSketchSymbol"
	   repositionsymbol(oDrawDoc)
	End Sub
	
	Sub repositionsymbol(oDrawDoc As DrawingDocument)
	   Dim oSheet As Sheet
       oSheet = oDrawDoc.ActiveSheet
	   Dim SketchedSymbol As SketchedSymbol
	   Try
		   SketchedSymbol = oSheet.SketchedSymbols("FirstSketchSymbol")
	   Catch
		   Exit Sub
	   End Try
	   Dim oTG As TransientGeometry
       oTG = ThisApplication.TransientGeometry
	   Select Case oSheet.Size
	       Case DrawingSheetSizeEnum.kA0DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(23.5, 6.2)
		   Case DrawingSheetSizeEnum.kA1DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(20.5, 6.2)
		   Case DrawingSheetSizeEnum.kA2DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(17.5, 6.2)
		   Case DrawingSheetSizeEnum.kA3DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(15.5, 6.2)
		   Case DrawingSheetSizeEnum.kA4DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(11.3, 6.2)
	   End Select
	End Sub
End Class&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 15 Dec 2023 14:19:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443619#M15577</guid>
      <dc:creator>yuzeaa</dc:creator>
      <dc:date>2023-12-15T14:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443692#M15578</link>
      <description>&lt;P&gt;I sent you some images of the intention I have with the code, maybe you will understand me better&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 14:47:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443692#M15578</guid>
      <dc:creator>Miguel.CarvajalS34Q6</dc:creator>
      <dc:date>2023-12-15T14:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443801#M15579</link>
      <description>&lt;P&gt;The information you provided in your previous post was incorrect.&amp;nbsp; Try it again with my last post&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20231215230050.png" style="width: 907px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1305247i382EC3D726B6DE98/image-size/large?v=v2&amp;amp;px=999" role="button" title="20231215230050.png" alt="20231215230050.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20231215230931.png" style="width: 892px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1305255iF711D6C77139201A/image-size/large?v=v2&amp;amp;px=999" role="button" title="20231215230931.png" alt="20231215230931.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 15:11:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443801#M15579</guid>
      <dc:creator>yuzeaa</dc:creator>
      <dc:date>2023-12-15T15:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443814#M15580</link>
      <description>&lt;P&gt;Sorry, I didn't see clearly that you were using parameters. I will correct it and post it later.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 15:16:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443814#M15580</guid>
      <dc:creator>yuzeaa</dc:creator>
      <dc:date>2023-12-15T15:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443835#M15581</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20231215232356.png" style="width: 748px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1305259i0789DA123ED8F44C/image-size/large?v=v2&amp;amp;px=999" role="button" title="20231215232356.png" alt="20231215232356.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Class ThisRule
	Private WithEvents oApplicationEvents As ApplicationEvents
	Dim preSheetSize As String
	Dim isFirstView As Boolean = False
	Sub main
		If SharedVariable.Exists("DocumengChangeEvent") Then Return
		oApplicationEvents = ThisApplication.ApplicationEvents
		SharedVariable("DocumengChangeEvent") = "DocumengChangeEvent"
	End Sub
    Private Sub drawingChangeEvent( DocumentObject As _Document,
                                    BeforeOrAfter As EventTimingEnum,
                                    ReasonsForChange As CommandTypesEnum,
                                    Context As NameValueMap,
                                    ByRef HandlingCode As HandlingCodeEnum) _
									Handles oApplicationEvents.OnDocumentChange
        HandlingCode = HandlingCodeEnum.kEventNotHandled
		If BeforeOrAfter = EventTimingEnum.kBefore Then
			If Context(1) = "ChangeSheetProperties" Then
				preSheetSize = DocumentObject.ActiveSheet.Size
			Else If Context(1) = "EditDrawingBaseView" Then
			   If DocumentObject.ActiveSheet.DrawingViews.count = 0 Then
				   isFirstView = True
			   End If 
			End If
        End If
        If BeforeOrAfter = EventTimingEnum.kAfter Then
			If Context(1) = "ChangeSheetProperties" Then
				If DocumentObject.ActiveSheet.Size &amp;lt;&amp;gt; preSheetSize Then
					repositionsymbol(DocumentObject)
				End If
			Else If Context(1) = "EditDrawingBaseView" Then
				If isFirstView Then
					isFirstView = False
					Dim doc As DrawingDocument = DocumentObject
					Dim modeldoc As Document = doc.ActiveSheet.DrawingViews(1).ReferencedDocumentDescriptor.ReferencedDocument
					Try
					 Dim BLOQUE As String = modeldoc.ComponentDefinition.Parameters("RUGOSIDAD").Value
					 addSketchsymbol(doc,BLOQUE)
					Catch
					 Exit Sub
					End Try
				End If
			 End If 
        End If
    End Sub
	
	Sub addSketchsymbol(oDrawDoc As DrawingDocument, blockname As String)
	   Dim oSheet As Sheet
       oSheet = oDrawDoc.ActiveSheet
	   Dim oSketchedSymbolDef As SketchedSymbolDefinition
       Try
	   oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item(blockname)
	   Catch
	   Exit Sub
	   End Try
	   Dim oTG As TransientGeometry
       oTG = ThisApplication.TransientGeometry
	   oSketchedSymbol = oSheet.SketchedSymbols.Add(oSketchedSymbolDef, oTG.CreatePoint2d(17.5, 6.2))
	   oSketchedSymbol.Name = "FirstSketchSymbol"
	   repositionsymbol(oDrawDoc)
	End Sub
	
	Sub repositionsymbol(oDrawDoc As DrawingDocument)
	   Dim oSheet As Sheet
       oSheet = oDrawDoc.ActiveSheet
	   Dim SketchedSymbol As SketchedSymbol
	   Try
		   SketchedSymbol = oSheet.SketchedSymbols("FirstSketchSymbol")
	   Catch
		   Exit Sub
	   End Try
	   Dim oTG As TransientGeometry
       oTG = ThisApplication.TransientGeometry
	   Select Case oSheet.Size
	       Case DrawingSheetSizeEnum.kA0DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(23.5, 6.2)
		   Case DrawingSheetSizeEnum.kA1DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(20.5, 6.2)
		   Case DrawingSheetSizeEnum.kA2DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(17.5, 6.2)
		   Case DrawingSheetSizeEnum.kA3DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(15.5, 6.2)
		   Case DrawingSheetSizeEnum.kA4DrawingSheetSize
			   SketchedSymbol.Position = oTG.CreatePoint2d(11.3, 6.2)
	   End Select
	End Sub
End Class&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 15 Dec 2023 15:26:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443835#M15581</guid>
      <dc:creator>yuzeaa</dc:creator>
      <dc:date>2023-12-15T15:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443974#M15582</link>
      <description>&lt;P&gt;I tried again and it still doesn't work, it can't insert blocks to the drawing sheet&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 16:18:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443974#M15582</guid>
      <dc:creator>Miguel.CarvajalS34Q6</dc:creator>
      <dc:date>2023-12-15T16:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443995#M15583</link>
      <description>&lt;P&gt;have you restarted inventor before running the rule?&amp;nbsp; &amp;nbsp;I need to leave now and attend the forum tomorrow&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 16:27:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12443995#M15583</guid>
      <dc:creator>yuzeaa</dc:creator>
      <dc:date>2023-12-15T16:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12448463#M15584</link>
      <description>&lt;P&gt;ok thanks&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 15:46:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12448463#M15584</guid>
      <dc:creator>Miguel.CarvajalS34Q6</dc:creator>
      <dc:date>2023-12-18T15:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: insert block into drawing sheet with custom part property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12448590#M15585</link>
      <description>&lt;P&gt;This code works well for me, I just can't get the value of the "item" ("general note ±1") to be a dynamic value that comes from the custom property iProperties.Value("Custom", "RUGOSIDAD") = RUGOSIDAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I also can't get the coordinate to insert the block to adjust according to the format in use&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="codigo 1212.jpg" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1305969i6D84EF49762F6074/image-size/medium?v=v2&amp;amp;px=400" role="button" title="codigo 1212.jpg" alt="codigo 1212.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 16:47:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/insert-block-into-drawing-sheet-with-custom-part-property/m-p/12448590#M15585</guid>
      <dc:creator>Miguel.CarvajalS34Q6</dc:creator>
      <dc:date>2023-12-18T16:47:26Z</dc:date>
    </item>
  </channel>
</rss>

