<?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: Modify a user parameter in a drawing from VB in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-a-user-parameter-in-a-drawing-from-vb/m-p/12256137#M158046</link>
    <description>try this&lt;BR /&gt;&lt;BR /&gt;Sub Main()&lt;BR /&gt;Dim oAsm As DrawingDocument = Invapp.ActiveDocument&lt;BR /&gt;MsgBox(oAsm.FullDocumentName)&lt;BR /&gt;&lt;BR /&gt;SetParameterValue(oAsm, "test", 15)&lt;BR /&gt;&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Public Sub SetParameterValue(Doc As drawingDocument, ParameterName As String, Val As Object)&lt;BR /&gt;Dim oPS As Parameters = Doc.Parameters&lt;BR /&gt;Dim oP As Parameter&lt;BR /&gt;Try&lt;BR /&gt;oP = oPS.Item(ParameterName)&lt;BR /&gt;Catch&lt;BR /&gt;'Parameter Does Not Exist&lt;BR /&gt;Exit Sub&lt;BR /&gt;End Try&lt;BR /&gt;&lt;BR /&gt;oP.Value = Val&lt;BR /&gt;End Sub</description>
    <pubDate>Thu, 21 Sep 2023 12:02:20 GMT</pubDate>
    <dc:creator>bradeneuropeArthur</dc:creator>
    <dc:date>2023-09-21T12:02:20Z</dc:date>
    <item>
      <title>Modify a user parameter in a drawing from VB</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-a-user-parameter-in-a-drawing-from-vb/m-p/12181440#M156675</link>
      <description>&lt;P&gt;I am trying to write an asynchronous loop to monitor what sheet a user is on in a drawing, as multiple people have access to the same drawing. Sheet 1 is the master copy, which keeps getting changed, Sheet 2 is a copy of sheet 1, which is permitted to have modifications to it. To do this, I have set up an iTrigger, which runs an iLogic script that prompts for a password through an inputbox, and if the password is not input then the document goes into read only mode.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless someone has a crafty suggestion, I believe I need to monitor the state of the active sheet in the drawing using an asynchronous loop in VB, and if the activesheet changes, update the iTrigger parameter to prompt for a password. The only solutions I've seen to this work in an assembly document or a part document, as they call a component definition, which unfortunately is not recognized by a drawing document. So, is this even possible?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I'm working with so far...&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;Sub Main()
Dim oAsm As DrawingDocument = Invapp.ActiveDocument
MsgBox(oAsm.FullDocumentName)

SetParameterValue(oAsm, "test", 15)

End Sub


Public Sub SetParameterValue(Doc As Document, ParameterName As String, Val As Object)
Dim oPS As Parameters = Doc.ComponentDefinition.Parameters
Dim oP As Parameter
Try
oP = oPS.Item(ParameterName)
Catch
'Parameter Does Not Exist
Exit Sub
End Try

oP.Value = Val
End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 18 Aug 2023 20:49:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-a-user-parameter-in-a-drawing-from-vb/m-p/12181440#M156675</guid>
      <dc:creator>michael.danyluk</dc:creator>
      <dc:date>2023-08-18T20:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a user parameter in a drawing from VB</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-a-user-parameter-in-a-drawing-from-vb/m-p/12256137#M158046</link>
      <description>try this&lt;BR /&gt;&lt;BR /&gt;Sub Main()&lt;BR /&gt;Dim oAsm As DrawingDocument = Invapp.ActiveDocument&lt;BR /&gt;MsgBox(oAsm.FullDocumentName)&lt;BR /&gt;&lt;BR /&gt;SetParameterValue(oAsm, "test", 15)&lt;BR /&gt;&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Public Sub SetParameterValue(Doc As drawingDocument, ParameterName As String, Val As Object)&lt;BR /&gt;Dim oPS As Parameters = Doc.Parameters&lt;BR /&gt;Dim oP As Parameter&lt;BR /&gt;Try&lt;BR /&gt;oP = oPS.Item(ParameterName)&lt;BR /&gt;Catch&lt;BR /&gt;'Parameter Does Not Exist&lt;BR /&gt;Exit Sub&lt;BR /&gt;End Try&lt;BR /&gt;&lt;BR /&gt;oP.Value = Val&lt;BR /&gt;End Sub</description>
      <pubDate>Thu, 21 Sep 2023 12:02:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-a-user-parameter-in-a-drawing-from-vb/m-p/12256137#M158046</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2023-09-21T12:02:20Z</dc:date>
    </item>
  </channel>
</rss>

