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: 

ilogic titleblock textbox change

3 REPLIES 3
Reply
Message 1 of 4
barsea
1334 Views, 3 Replies

ilogic titleblock textbox change

I am trying to change the titleblock definition of a drawing when I run my custom ilogic code.  Currently (and for the past few years) the drawing name is defined by the drawing properties part number but when I run my code I would like the drawing name to be defined by the model properties part number as shown below:

 

Currently the textbox for the part number is configured as below:

 

Before.png

 

 

And I'd like to change it to this:

 

After.png

 

The code I have to find the part number is as follows:

 

    Dim x = 1
    Dim oTxtBox As Inventor.TextBox
    For Each oTxtBox In oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes
        If oTxtBox.Text = "<PART NUMBER>" Then
            oStuff = oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes(x)
            MessageBox.Show(oStuff.FormattedText, "Title")        
        End If
        x += 1 
    Next

 

 

 

 

 

 

 

 

3 REPLIES 3
Message 2 of 4
barsea
in reply to: barsea

The result of the code is shown below:

 

Result.png

 

I can't seem to change the property directly, when I try I receive an error like, "the value is read only"

 

Message 3 of 4
eljoseppo
in reply to: barsea

Why do you want to update drawing in this way? Have you try Drawing Recources Transfer Wizard? It's better if you know names of drawing you want to update, it's like batch update.

 

edit:

using wizard you have to make a new block with model - part number and then update all other drawings.

Message 4 of 4
barsea
in reply to: eljoseppo

Thanks for your reply.

 

I don't want to change too much.  We are making incremental changes to the way we do things here and I want to test this method without permanently changing all our engineering drawings (we have many product lines and very many drawings.)

 

What I have done is create an ilogic program that consolidates all my idw's into one using the assembly or weldment drawing as the master document and all the component part and sub assembly drawings are added to the master document.  This master document is then exported as a dwf which is then used in our ERP system.  

 

The problem with the current titleblock definition is that the drawings added to the master drawing take on the master drawing's name and so the name of the component/sub assembly is lost. By changing the titleblock definition from 'drawing - part number' to 'model - part number', the drawing name then takes on the part number of the component/sub assembly and all is well.

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

Post to forums  

Autodesk Design & Make Report