All about Sheets using the Solid Edge API – Part 1

When you access 2D objects from a Solid Edge Drawing, they are lying on a drawing sheet which belongs to one of these categories:



  1. Working Sheets.

  2. Background Sheets.

  3. 2D Model Sheet.

  4. Drawing View Sheet.


SESheetsInfographics.png


The working and background sheets are part of their respective “sections”.


So the declaration for these look like:

Dim seApp As SolidEdgeFramework.Application = Nothing
Dim seDoc As DraftDocument = Nothing

Dim seSections As Sections = Nothing
Dim seWorkingSection As Section = Nothing
Dim seBackgroundSection As Section = Nothing

Dim seSheet As Sheet = Nothing
Dim seSheets As SectionSheets = Nothing

These sections can be accessed separately as below:

seApp = Runtime.InteropServices.Marshal.GetActiveObject(“SolidEdge.Application”)
seDoc = seApp.ActiveDocument

seSections = seDoc.Sections

WorkingSection = seSections.WorkingSection
seBackgroundSection = seSections.BackgroundSection

and the sheets in each of these sections can be accessed as below:

seSheets = seWorkingSection.Sheets
‘or
seSheets = seBackgroundSection.Sheets

Similarly, the 2D Model  sheet can be directly accessed from the sections:

se2DModelSheet = seSections.Get2DModelSheet

To access the drawing objects, loop through each sheet as below

For Each seSheet In seSheets

Next


Within each sheet object are the various drawing or graphical elements.

SheetsAPI_02.png

Note that these drawing objects are the ones placed directly on the sheet and accessible only via their collections. Also note their types few of which are listed below:

Points – Point2d via the Points2d collection


Lines – Line2d via the Lines2d collection


Arcs – Arc2d via the Arcs2d collection


Circles – Circle2d via the Circles2d collection

Drawing views are also one of these.

Dim seDrawingView As DrawingView = seSheet.DrawingViews.Item(1)

Drawing views in turn contain 2d objects which are of type with a DV prefix:


Points – DVPoint2d via the DVPoints2d collection


Lines – DVLine2d via the DVLines2d collection


Arcs – DVArc2d via the DVArcs2d collection


Circles – DVCircle2d via the DVCircles2d collection

There’s a twist to this story however.


You can right-click on a drawing view and select ‘Draw in View’

SheetsAPI_03.png

The 2d objects added in this mode can be accessed through a special sheet belonging to the drawing view:

Dim seViewSheet As Sheet = seDrawingView.Sheet

This sheet is internal to the drawing view with a random number as its name. Note that the 2d objects on this sheet are of type Line2d accessible through the Lines2d collection for example and are not DVLine2d objects.

Read the next and concluding part, where you will learn how to:



  • Create new drawing sheets.
  • Access the current or active sheet.
  • Count the number of sheets in a drawing.
  • Activate a sheet by its name.
  • Remove or delete a sheet from a drawing.
  • Determine common sheet properties like size, type, etc.
  • Export sheets to other formats.
  • Display/Hide background sheets.

and many more drawing sheet related techniques which should answer your most common sheet related questions.

TwitterLogo32x32.png Tushar_Suradkar

Leave a Reply