Cancel
Showing results for 
Search instead for 
Did you mean: 

How to read data from Background sheet

Pioneer
Pioneer

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 ?

21 REPLIES 21

Re: How to read data from Background sheet

Gears Phenom Gears Phenom
Gears Phenom

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()

 

Matt Johnson
Solid Edge Certified Professional
Solid Edge 2019 (SEEC) - Production
NX12 (Tc Integration)
Teamcenter 10.1.7

Re: How to read data from Background sheet

Pioneer
Pioneer

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 ?

Re: How to read data from Background sheet

Gears Phenom Gears Phenom
Gears Phenom

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()
Matt Johnson
Solid Edge Certified Professional
Solid Edge 2019 (SEEC) - Production
NX12 (Tc Integration)
Teamcenter 10.1.7

Re: How to read data from Background sheet

Gears Phenom Gears Phenom
Gears Phenom

Looks like 

objApp.StartCommand(11109)

is equivalent to UI "Edit Background sheet

6-14-2018 7-40-05 AM.png

this is exactly what you want.  

Matt Johnson
Solid Edge Certified Professional
Solid Edge 2019 (SEEC) - Production
NX12 (Tc Integration)
Teamcenter 10.1.7

Re: How to read data from Background sheet

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

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.

Re: How to read data from Background sheet

Pioneer
Pioneer

Thanks

 

But after reading the blockoccurance, how can i read value of specific text in that block ?

Re: How to read data from Background sheet

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

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!!

Re: How to read data from Background sheet

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor
In this context I'd like to draw attention to an article on this topic, which tries to address several basic questions about the Drawing Sheets API:

https://community.plm.automation.siemens.com/t5/Solid-Edge-Blog/All-about-Sheets-using-the-Solid-Edg...

Re: How to read data from Background sheet

Pioneer
Pioneer

You mean will following work (if objsheet is activesheet.... ) ?

 

Dim tempstr As String

tempstr = objSheet.Background.BlockOccurrences.Item(0).BlockView.TextBoxes.Item(0).Name