Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sheet name (number)

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
brian
5371 Views, 9 Replies

Sheet name (number)

For years we have been using a promted entry in our drawings for the sheet number.  E001

We have also been changing the sheet name in the browser to match this.  If the sheet number changes, we have to change both.  Can the sheet name from the browser be used in the tile block?  I couldn't seem to locate it under any of the properties.

 

Our ultimate goal is to use Ilogic to read and write the sheet numbers from a master Excel sheet.  I haven't been able to find any reference to Ilogic working with prompted entries.

 

Currently we are using Inventor 2012

 

Thanks

Tags (1)
9 REPLIES 9
Message 2 of 10
rhasell
in reply to: brian

Hopefully I understood your post correctly,

 

What I do works very well, (Only just applied it, as I did the same as you.)

 

Set your drawing number to the "Drawing, PART NUMBER" It works like a charm, no more renaming of sheets etc.

 

Regards

Reg.

Reg
2024.2
Please Accept as a solution / Kudos
Message 3 of 10
PACDrafting
in reply to: brian


brian wrote:

Our ultimate goal is to use Ilogic to read and write the sheet numbers from a master Excel sheet.


Find someone who has VB.Net experience to make use of the Inventor API and link it to an Access database or excel.

Message 4 of 10
Curtis_Waguespack
in reply to: brian

Hi brian,

 

Here is some code from another thread  that might get you closer. This reads the sheet name from the browser, trims off the :#, and then writes it to a prompted entry field in the titleblock called <Sheet Name>.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

 

 

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

Dim oTitleBlock As TitleBlock
Dim oTextBox As TextBox
Dim oSheet As Sheet

Dim lPos As Long
Dim sSheetName As String
 
For Each oSheet In oDoc.Sheets
    oTitleBlock = oSheet.TitleBlock
	lPos = InStr(oSheet.Name, ":")
	sSheetName = Left(oSheet.Name, lPos - 1)
	For Each oTextBox In oTitleBlock.Definition.Sketch.TextBoxes
        If oTextBox.Text = "<Sheet Name>" Then
            Call oTitleBlock.SetPromptResultText(oTextBox, sSheetName)
		End If
    Next
Next

 

Message 5 of 10
SBix26
in reply to: brian

We have iLogic filling in prompted entries in our title blocks on drawing creation.  The AddTitleBlock method will fill in prompted entries when it places the block if you provide the entries in a string array.

 

If you are pulling from a database, you might want to change from using prompted entries to iProperties.  We've stayed with prompted entries because these are things such as Finish and date that may need to be changed later.

Message 6 of 10
Curtis_Waguespack
in reply to: SBix26

Hi sbixler,

 

One thing to always be aware of concerning the use of prompted entry (and you're probably already aware of it already), is that information resides only in the titleblock instance. This can lead to major issues down the road, if there is a need to batch replace titleblocks, and it can negate the use of the Drawing Resource tool, which would otherwise make quick work of this.

 

Having said that, I know many companies use prompted entry with no concerns of replacing titleblocks in the future.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Message 7 of 10
SBix26
in reply to: Curtis_Waguespack

Yep, we've made that choice.  For us, building one-of-a-kind, completely self-contained projects, once a project is closed nobody messes with drawings, so replacing title blocks is not going to happen.

Message 8 of 10
Curtis_Waguespack
in reply to: brian

Hi brian.

 

Here's an updated code snippet that is closer to what you're after. This looks at the prompted entry text and writes it to the Sheet name (rather than the other way around). It checks for a sheet without a titleblock (and just skips it if found), and it checks for an empty prompted entry field. If empty is asks the user to enter one.

 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

 

 


Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

Dim oTitleBlock As TitleBlock
Dim oTextBox As TextBox
Dim oSheet As Sheet

Dim lPos As Long
Dim sSheetName As String
Dim sNewName As String

For Each oSheet In oDoc.Sheets
    'check to see if the sheet has a titleblock instance
    If oSheet.TitleBlock Is Nothing Then
    'Do Nothing
    Else
        oTitleBlock = oSheet.TitleBlock
    lPos = InStr(oSheet.Name, ":")
    sSheetName = Left(oSheet.Name, lPos - 1)
    For Each oTextBox In oTitleBlock.Definition.Sketch.TextBoxes
                If oTextBox.Text = "<Sheet Name>" Then
                    'check to see if prompted entry is empty
                    If oTitleBlock.GetResultText(oTextBox) = "" then
                    'if prompted entry is empty, then query the user
                    sNewName = InputBox("Enter Sheet Name", "No Sheet Name Found in TitleBlock", sSheetName)
                    oTitleBlock.SetPromptResultText(oTextBox, sNewName)
                    oSheet.Name = oTitleBlock.GetResultText(oTextBox)
            Else
            oSheet.Name = oTitleBlock.GetResultText(oTextBox)
            End if
        End If
        Next
        End If
Next

 

Message 9 of 10
brian
in reply to: brian

That works great.  Thank you all very much.

Message 10 of 10

The above code will work with one prompted entries, can two prompted entries be used to form a sheet name?


BL

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

Post to forums  

Autodesk Design & Make Report