iLOGIC TO EXTRACT SHEET NAME IN TO TITLE BLOCK

iLOGIC TO EXTRACT SHEET NAME IN TO TITLE BLOCK

michaelcrawforth
Explorer Explorer
1,813 Views
11 Replies
Message 1 of 12

iLOGIC TO EXTRACT SHEET NAME IN TO TITLE BLOCK

michaelcrawforth
Explorer
Explorer

I am wanting to use iLogic to extract the drawing sheet name and display it in the title block. I am new to iLogic and am wanting to learn. I find using code difficult but always know what i want to do, just can't work it out.

 

Any help would be appreciated.

0 Likes
1,814 Views
11 Replies
Replies (11)
Message 2 of 12

Anonymous
Not applicable

Why do you want ilogic for this?

 

There is the option to insert the partnumber of your drawingsheet in your titelblock already.

 

tijdelijk.PNG

 

Bianca

 

0 Likes
Message 3 of 12

michaelcrawforth
Explorer
Explorer

Thanks for th info, I am already using that but that is not what i want.

 

I have attached an image of a drawing which shows what i am wanting to use and display in a box within the title block. When you look in the rules there is a sheet name within the Drawings area i just want to know how i can use this name in the title block

 

Many thanks

 

SHEET NAME REQUEST.jpg

0 Likes
Message 4 of 12

marcin_otręba
Advisor
Advisor

idk what text you want to change... code below find text with vaulue = aaaaaa and changes it to active sheet name:

 

 

Dim osh As Sheet = ThisDoc.Document.activesheet
Dim oSketch As Sketch
Dim oTitleBlock As TitleBlock = osh.TitleBlock
Dim oTextBoxes As TextBoxes = oTitleBlock.Definition.Sketch.TextBoxes
Dim oTextBox As Inventor.TextBox

oTitleBlock.Definition.Edit(oSketch)
For Each oTextBox In oSketch.TextBoxes
	
	If oTextBox.Text = "aaaaaa" Then
	oTextBox.Text=osh.Name
	End If
Next
oTitleBlock.Definition.ExitEdit

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 5 of 12

marcin_otręba
Advisor
Advisor

and for all sheets in drawing:

if you want then send your drawing with titleblock and show wchich txtbox you want to change.

 

Dim osh As Sheet = ThisDoc.Document.activesheet
Dim oSketch As Sketch
Dim oTitleBlock As TitleBlock = osh.TitleBlock
Dim oTextBox As Inventor.TextBox
For Each osh In ThisDoc.Document.sheets
oTitleBlock.Definition.Edit(oSketch)
For Each oTextBox In oSketch.TextBoxes
	If oTextBox.Text = "aaaaaa" Then
	oTextBox.Text=osh.Name
	End If
Next
oTitleBlock.Definition.ExitEdit
Next

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 6 of 12

michaelcrawforth
Explorer
Explorer

Thanks for the help, i will try this, i am completely new to visual basic. Other than the aaaa are there any other fields i need to populate with information from the drawing i am putting this in please ?

 

0 Likes
Message 7 of 12

marcin_otręba
Advisor
Advisor

right now it will find text "aaaaaa" inside titleblock and change it to sheet name.

You can change this value to yours, or share here your drawing file and tell me wchich text you want to change, i will make corrections in code for you.

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 8 of 12

michaelcrawforth
Explorer
Explorer

Please find a screen grab of the title block and the place highlighted i would like the sheet name to go. The field is generated by the standard logic so i am happy to go with another name as it is a different property that is going to fill the text space withSHEET NAME.png

0 Likes
Message 9 of 12

marcin_otręba
Advisor
Advisor
Dim osh As Sheet = ThisDoc.Document.activesheet
Dim oSketch As Sketch
Dim oTitleBlock As TitleBlock = osh.TitleBlock
Dim oTextBox As Inventor.TextBox
For Each osh In ThisDoc.Document.sheets
oTitleBlock.Definition.Edit(oSketch)
For Each oTextBox In oSketch.TextBoxes
	If oTextBox.Text = "<DESCRIPTION>" Then
	oTextBox.Text=osh.Name
	End If
Next
oTitleBlock.Definition.ExitEdit
Next

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 10 of 12

michaelcrawforth
Explorer
Explorer

Hello Marchin

 

That works great, i am being a littl picky now and tell me to buzz off if you want. I am wondering if you can have it so that it does not put the colon and number into the text please ?

0 Likes
Message 11 of 12

marcin_otręba
Advisor
Advisor

there you go:

Dim osh As Sheet = ThisDoc.Document.activesheet
Dim oSketch As Sketch
Dim oTitleBlock As TitleBlock = osh.TitleBlock
Dim oTextBox As Inventor.TextBox
For Each osh In ThisDoc.Document.sheets
oTitleBlock.Definition.Edit(oSketch)
For Each oTextBox In oSketch.TextBoxes
	If oTextBox.Text = "<DESCRIPTION>" Then
	oTextBox.Text=Split(osh.Name,":")(0)
	End If
Next
oTitleBlock.Definition.ExitEdit
Next

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

Message 12 of 12

Chris.Truelove
Contributor
Contributor

Can this code be made to change just the specified text box on the active sheet?

0 Likes