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: 

Title Block and Border Attributes

8 REPLIES 8
Reply
Message 1 of 9
LonesomeJoe
480 Views, 8 Replies

Title Block and Border Attributes

I need some VBA code that will allow me to get the Filename from the border of a drawing.  I've got code to get to the text  of the filename, but I need to get the filename itself.  Hope that males sense. Here's the code:

 

Public Sub GetModelFilename()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDoc.ActiveSheet 'Msgbox oSheet.Size
Dim oSketch As DrawingSketch
Dim oBorder As BorderDefinition
Set oBorder = oDoc.BorderDefinitions.Item(2)
Call oBorder.Edit(oSketch)
Dim tempTB As TextBox
Dim i As String
For Each tempTB In oSketch.TextBoxes
    'MsgBox tempTB.Text
    If tempTB.Text = "<FILENAME>" Then

HERE IS WHERE I NEED HELP

        i = tempTB.Text
        MsgBox i
    End If
Next
    Call oBorder.ExitEdit(True)

 

What the code returns is the text <FILENAME>.  What I need is the filename itself.  Anyone?  Thanx.

8 REPLIES 8
Message 2 of 9
jletcher
in reply to: LonesomeJoe

1st why ilogic might be able to do what you want.

 

2nd is it the filename you want or the drawing name in title block they could be different.

Message 3 of 9
LonesomeJoe
in reply to: jletcher

forgot to mention I'm using IV 10.  I don't know anything about iLogic, and I don't have time to learn it.  What I need is the filename as it appears on the drawing... I could use the title, too, but I don't know how to get it, wither.  All my code will get me is the text of the textbox which appears when you edit the definition.  I need the text that appears on the drawing.

Message 4 of 9
jletcher
in reply to: LonesomeJoe

What iproperty or what is driving the text in the title block is it the filename of the IDW or the model name?

Message 5 of 9
jletcher
in reply to: LonesomeJoe

Ok after looking at your code it is doing what you asked it to do. When you go to edit the border to find your file name the name is not there because inventor will not fill in the <filename> till you are done with the edit..

 

So the code you wrote is working the way you wrote it.

 

So with out knowing what you need or trying to do we cannot help I know you want the filename but why.

 

There are many ways to do things so telling us what you need and why we can help better.

 

But like I said the code you have is working the right way.

Message 6 of 9
LonesomeJoe
in reply to: jletcher

Here's the "end game"...  I need to open a folder full of drawing files, get the titles and the drawing numbers (I don't need filename, I actually need drawing number), and paste them into the proper cells of our flatBOM/Specialty list .xls.  I know Inventor has some utilities to generate BOMs, but the boss does not want to change the BOM we use, so I have to get the info and put it into the .xls.  Then, I take the drawing number, find the model that has that drawing number and grab a bunch of info from its properties and add that info to the flatBOM.  Most of this I have coded already, I just can't get the info out of the drawing's "Title" and "Drawingnumber" Most of this info is in the model properties, the only reason I need any info out of the drawing is because on large assemblies we sometimes use the same model for multiple drawings, and change the "Title" and "Drawingnumber" to reference the Drawing's properties.  Hope this makes sense.

Message 7 of 9
jonbrabbs
in reply to: LonesomeJoe

Hi,

 

Are you looking for something along the lines of:

ThisApplication.ActiveDocument.FullFileName

?

 

Jon.

///////////////////////////////////////////////////////////////////////////////////////////////////
If this post helps you, please give kudos.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Message 8 of 9
LonesomeJoe
in reply to: jonbrabbs

... sometimes I look for a ten dollar solution to a two dollar problem... that will do just fine to get the info to link to the model, however I still need the "Title" property from the drawing title block for those drawings which have been "cheated to use the drawing "Title" property instead of the model "Title" property", thanks. 

Message 9 of 9
LonesomeJoe
in reply to: LonesomeJoe

Got it... I took a different approach, using the Summary Property Sets to get the Info straight from the Property sets.  thanks for all your help!!

 

Public Sub GetModelFilename()
Dim oDoc As DrawingDocument
Dim allPropSets As PropertySets
Set oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDoc.ActiveSheet 'Msgbox oSheet.Size
Set allPropSets = oDoc.PropertySets
Dim DesignTrackingPropSets As PropertySet
Dim DocumentSummaryPropSets As PropertySet
Dim SummaryPropSets As PropertySet
Dim ContentLibraryCompPropSets As PropertySet
Dim UserPropSets As PropertySet

Dim DesignTrackingAuthority As String
Dim DesignTrackingAuthorityID As Integer '= 43
Dim DesignTrackingCatWebLink As String
Dim DesignTrackingCatWebLinkID As Integer
Dim DesignTrackingCheckedBy As String
Dim DesignTrackingCheckedByID As Integer
Dim DesignTrackingDescription As String
Dim DesignTrackingDescriptionID As Integer ' = 29

Dim DesignTrackingPartNum As String
Dim DesignTrackingPartNumID As Integer ' = 5

Dim DesignTrackingStockNum As String
Dim DesignTrackingStockNumID As String ' = 55

Dim SummaryInfoTitle As String
Dim SummaryInfoTitleID As Integer ' = 2
Set SummaryPropSets = allPropSets.Item("Summary Information")


SummaryInfoTitle = SummaryPropSets.ItemByPropId(2).Value
MsgBox SummaryInfoTitle

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

Post to forums  

Autodesk Design & Make Report