Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copy Title Block prompted entries

1 REPLY 1
Reply
Message 1 of 2
mikejones
1140 Views, 1 Reply

Copy Title Block prompted entries

Hi

 

The title blocks that we use have prompted entries in them and I would like to find a way using iLogic to copy the entries from one title block to another within the same drawing; i.e.. if the user decides to change from an A2 to A1 drawing.

I already have an iLogic rule which allows the user to change the active border, title block and sheet size based on a form selection but would like it to capture the prompted entries already entered and re-use them after the change.

 

Any ideas?

 

Mike

Autodesk Certified Professional
1 REPLY 1
Message 2 of 2
xiaodong_liang
in reply to: mikejones

Hi,

 

I wrote an iLogic code for your reference. It assumes the drawing has two sheets which use the same title block. In the title block, there is one prompt text named "MY_PROMPT". It will get the result string in sheet1 and copies to sheet2.

 

 

    ' assume sheet1 and sheet use the same title block definition
    
    Dim oDoc  
      oDoc = ThisApplication.ActiveDocument
    
    'get first sheet
    Dim oSheet1  
      oSheet1 = oDoc.Sheets(1)
    
    'get titleblock of sheet1
    Dim oTB1  
      oTB1 = oSheet1.TitleBlock
    
    ' search the textbox in definition
    
    Dim oPromptText  
    Dim oEachText 
    Dim I 
    For I = 1 To oTB1.Definition.Sketch.TextBoxes.Count
          oEachText = oTB1.Definition.Sketch.TextBoxes(I)
        If (oEachText.Text = "MY_PROMPT") Then
            ' found the prompt text we want to copy
              oPromptText = oEachText
            Exit For
        End If
    Next I
    
    'get the result string of the prompt text
    Dim oPromptEntry  
    oPromptEntry = oTB1.GetResultText(oPromptText)
    
    'get sheet2
    Dim oSheet2 As Sheet
      oSheet2 = oDoc.Sheets(2)
    
      'get titleblock of sheet2
    Dim oTB2 As TitleBlock
      oTB2 = oSheet2.TitleBlock
    
    ' copy the result string of the prompt text to the prompt text in sheet2
      oTB2.SetPromptResultText(oEachText, oPromptEntry)
  

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report