I have one DFT file, with a sheet with various drawing views and a title block filled with various values such as Title, Client, Paper size, Scale etc. The title block is created using Background sheet.
How can i read the values from this title block using vb.net ?
you need to set the background sheet at the active sheet 1st
CopyFrom.Activate() CopyFrom.Sections.BackgroundSection.Sheets.Item(CopyName).Activate() CopyFrom.SelectSet.AddAll() CopyFrom.SelectSet.Copy()
In my DFT file there is one main sheet and there are 5-6 background sheets. Based on requirement, any one of these 5-6 sheets is used in main sheet. How can I find which sheet is used as background. Also, after finding that sheet how can i read the data from title block of that sheet ?
you will need to interrogate your sheets somehow...
In this case, im using 2 drafts "DftSheet" and "CopySheet"
If the Background sheet name and the sheet size is the same then I assume they are a match.
For Each DftSheet In DftFile.Sections.BackgroundSection.Sheets ShtName = DftSheet.Name ShtSize = DftSheet.SheetSetup.SheetSizeOption For Each CopySheet In CopyFrom.Sections.BackgroundSection.Sheets CopyName = CopySheet.Name If ShtName = CopyName And DftSheet.SheetSetup.SheetSizeOption = CopySheet.SheetSetup.SheetSizeOption Then CopyFrom.Activate() CopyFrom.Sections.BackgroundSection.Sheets.Item(CopyName).Activate() CopyFrom.SelectSet.AddAll() CopyFrom.SelectSet.Copy()
is equivalent to UI "Edit Background sheet
this is exactly what you want.
The active sheet has a Background property, which gives you the background sheet of it. Then you can look for your BlockOccurrence on the background sheet, assuming that you created the title block as a block.
If not, access directly your text boxes, annotations, etc. on the background sheet.
Once you have the BlockOccurrence, you can get the BlockView which contains all the collections for TextBoxes, Balloons, DatumFrames, etc.
Dependend on how your text was created, you will find it anywhere in thoese "text" primitives.
Spy for Solid Edge is a great tool to check this out!!
You mean will following work (if objsheet is activesheet.... ) ?
Dim tempstr As String
tempstr = objSheet.Background.BlockOccurrences.Item(0).BlockView.TextBoxes.Item(0).Name