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: 

TitleBlock Refrence for multiple drawings

2 REPLIES 2
Reply
Message 1 of 3
dnolascoZYGKF
145 Views, 2 Replies

TitleBlock Refrence for multiple drawings

Hello Community, 

Is it possible to use a drawing as a reference with the title block fill-out with correct data used to automate the title block on different drawings. I am using Inventor Professional 2023.

Drawing1.dwg to be the reference drawing.

Title block: DANNYBOY 

 FIELD TEXT: <CUSTOMER> VALUE <CUSTOMER LOCATION> VALUE <TITLE> VALUE ….

 

Other drawing: Drawing2.dwg

 

I create this rule to bring in the title block, but still need more direction to bringing in the data with the title block. 

ThisDrawing.ResourceFileName = "Drawing1.dwg"
ThisDrawing.KeepExtraResources = True
ActiveSheet.TitleBlock = "DANNYBOY"

DRAWING1.pngDRAWING2.pngRULE REFERENCETITLEBLOCK .pngTITLEBLOCK EDIT PROPERTY FIELD.png

 

Thank you for your support

2 REPLIES 2
Message 2 of 3
A.Acheson
in reply to: dnolascoZYGKF

It looks like your using prompted entry in the title block. I would advise you to change that to iproperty entries as it gets difficult to handle the prompted entry by code. 

 

 

 

If you cannot remove the prompted entry you will need to add the prompted entry contents at the same time as you are adding the titleblock. Here is the link to the  API sample.

This is where the prompts are added. It starts at 0 and ends at the number you need. 

Dim sPromptStrings(1) As String 

sPromptStrings(0) = "String 1"

sPromptStrings(1) = "String 2"

 

The below code is an extract of the InsertTitleBlockOnSheet sub routine and is converted from VBA to ilogic/vb.net . I have added in the border addition as well. 

    ' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument

    ' Obtain a reference to the desired border defintion.
    Dim oTitleBlockDef As TitleBlockDefinition
 	oTitleBlockDef = oDrawDoc.TitleBlockDefinitions.Item("DANNYBOY")
    
    Dim oSheet As Sheet
  oSheet = oDrawDoc.ActiveSheet

    ' Check to see if the sheet already has a title block and delete it if it does.
    If Not oSheet.TitleBlock Is Nothing Then
        oSheet.TitleBlock.Delete
    End If

    ' This title block definition contains one prompted string input.  An array
    ' must be input that contains the strings for the prompted strings.
    Dim sPromptStrings(1) As String
    sPromptStrings(0) = "String 1"
    sPromptStrings(1) = "String 2"

    ' Add an instance of the title block definition to the sheet.
    Dim oTitleBlock As TitleBlock
   oTitleBlock = oSheet.AddTitleBlock(oTitleBlockDef, , sPromptStrings)


    ' Check to see if the sheet already has a border and delete it if it does.
    If Not oSheet.Border Is Nothing Then
        oSheet.Border.Delete
    End If
    
	  'Obtain a reference to the desired border defintion.
    Dim oBorderDef As BorderDefinition
	oBorderDef = oDrawDoc.BorderDefinitions.Item("11x17")
    ' Add the border to the sheet.
    Dim oBorder As Border
   oBorder = oSheet.AddBorder(oBorderDef,)

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 3
A.Acheson
in reply to: A.Acheson

Here is the API sample to copy a title block definition to another drawing. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report