{"id":1936,"date":"2018-06-16T17:51:46","date_gmt":"2018-06-17T00:51:46","guid":{"rendered":"https:\/\/blogs.plm.automation.siemens.com\/t5\/Solid-Edge-Blog\/All-about-Sheets-using-the-Solid-Edge-API-Part-1\/ba-p\/500657"},"modified":"2020-02-17T09:42:42","modified_gmt":"2020-02-17T14:42:42","slug":"all-about-sheets-using-the-solid-edge-api-part-1","status":"publish","type":"post","link":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/all-about-sheets-using-the-solid-edge-api-part-1\/","title":{"rendered":"All about Sheets using the Solid Edge API &#8211; Part 1"},"content":{"rendered":"<p><P>When you access 2D objects from a Solid Edge Drawing,&nbsp;they are&nbsp;lying on a drawing sheet which belongs&nbsp;to one&nbsp;of these categories:<\/P><br \/>\n<OL><br \/>\n<LI>Working Sheets.<\/LI><br \/>\n<LI>Background Sheets.<\/LI><br \/>\n<LI>2D Model Sheet.<\/LI><br \/>\n<LI>Drawing View Sheet.<\/LI><br \/>\n<\/OL><br \/>\n<P><span class=\"lia-inline-image-display-wrapper lia-image-align-center\" style=\"width: 354px;\"><img decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/SESheetsInfographics-1.png\" alt=\"SESheetsInfographics.png\" title=\"SESheetsInfographics.png\" \/><\/span><\/P><br \/>\n<P>The working and background sheets are part of their respective &#8220;sections&#8221;.<\/P><br \/>\n<P>So the declaration for these look like:<\/P><\/p>\n<p><PRE>Dim seApp As SolidEdgeFramework.Application = Nothing<br \/>\nDim seDoc As DraftDocument = Nothing<\/p>\n<p>Dim seSections As Sections = Nothing<br \/>\nDim seWorkingSection As Section = Nothing<br \/>\nDim seBackgroundSection As Section = Nothing<\/p>\n<p>Dim seSheet As Sheet = Nothing<br \/>\nDim seSheets As SectionSheets = Nothing<\/PRE><\/p>\n<p><P>These sections can be accessed separately as below:<\/P><\/p>\n<p><PRE>seApp = Runtime.InteropServices.Marshal.GetActiveObject(&#8220;SolidEdge.Application&#8221;)<br \/>\nseDoc = seApp.ActiveDocument<\/p>\n<p>seSections = seDoc.Sections<\/p>\n<p>WorkingSection = seSections.WorkingSection<br \/>\nseBackgroundSection = seSections.BackgroundSection<\/PRE><\/p>\n<p><P>and the sheets in each of these sections can be accessed as below:<\/P><\/p>\n<p><PRE>seSheets = seWorkingSection.Sheets<br \/>\n&#8216;or<br \/>\nseSheets = seBackgroundSection.Sheets<\/PRE><\/p>\n<p><P>Similarly, the 2D Model&nbsp; sheet can be directly accessed from the sections:<\/P><\/p>\n<p><PRE>se2DModelSheet = seSections.Get2DModelSheet<\/PRE><\/p>\n<p><P>To access the drawing objects, loop through each sheet as below<\/P><\/p>\n<p><PRE>For Each seSheet In seSheets<\/p>\n<p>Next<\/PRE><br \/>\n<P>Within each sheet object are the various drawing or graphical elements.<\/P><\/p>\n<p><P><span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 308px;\"><img decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/SheetsAPI_02-1.png\" alt=\"SheetsAPI_02.png\" title=\"SheetsAPI_02.png\" \/><\/span><\/P><\/p>\n<p><P>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:<\/P><\/p>\n<p><P><STRONG>Points<\/STRONG> &#8211; Point2d via the Points2d collection<\/P><br \/>\n<P><STRONG>Lines<\/STRONG> &#8211; Line2d via the Lines2d collection<\/P><br \/>\n<P><STRONG>Arcs<\/STRONG> &#8211; Arc2d via the Arcs2d collection<\/P><br \/>\n<P><STRONG>Circles <\/STRONG>&#8211; Circle2d via the Circles2d collection<\/P><\/p>\n<p><P>Drawing views are also one of these.<\/P><\/p>\n<p><PRE>Dim seDrawingView As DrawingView = seSheet.DrawingViews.Item(1)<\/PRE><\/p>\n<p><P>Drawing views in turn contain 2d objects which are of type with a DV prefix:<\/P><br \/>\n<P><STRONG>Points<\/STRONG> &#8211; DVPoint2d via the DVPoints2d collection<\/P><br \/>\n<P><STRONG>Lines<\/STRONG> &#8211; DVLine2d via the DVLines2d collection<\/P><br \/>\n<P><STRONG>Arcs<\/STRONG> &#8211; DVArc2d via the DVArcs2d collection<\/P><br \/>\n<P><STRONG>Circles<\/STRONG> &#8211; DVCircle2d via the DVCircles2d collection<\/P><\/p>\n<p><P>There&#8217;s a twist to this story however.<\/P><br \/>\n<P>You can right-click on a drawing view and select &#8216;Draw in View&#8217;<\/P><\/p>\n<p><P><span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 333px;\"><img decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/SheetsAPI_03-1.png\" alt=\"SheetsAPI_03.png\" title=\"SheetsAPI_03.png\" \/><\/span><\/P><\/p>\n<p><P>The 2d objects added in this mode can be accessed through a special sheet belonging to the drawing view:<\/P><\/p>\n<p><PRE>Dim seViewSheet As Sheet = seDrawingView.Sheet<\/PRE><\/p>\n<p><P>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.<\/P><\/p>\n<p><P>Read the <a href=\"https:\/\/community.plm.automation.siemens.com\/t5\/Solid-Edge-Blog\/Solid-Edge-Drawing-Sheets-API-Part-2\/ba-p\/517875\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">next and concluding part<\/A>, where you will learn how to:<\/P><br \/>\n<UL><br \/>\n<LI><SPAN>Create new drawing sheets.<\/li>\n<p><LI><SPAN>Access the current or active sheet.<\/li>\n<p><LI><SPAN>Count the number of sheets in a drawing.<\/li>\n<p><LI><SPAN>Activate a sheet by its name.<\/li>\n<p><LI><SPAN>Remove or delete a sheet from a drawing.<\/li>\n<p><LI><SPAN>Determine common sheet properties like size, type, etc.<\/li>\n<p><LI><SPAN>Export sheets to other formats.<\/li>\n<p><LI><SPAN>Display\/Hide background sheets.<\/li>\n<p><\/UL><br \/>\n<P>and many more drawing sheet related techniques which should answer your most common sheet related questions.<\/P><\/p>\n<p><P><SPAN class=\"lia-inline-image-display-wrapper lia-image-align-inline\"><SPAN class=\"lia-message-image-wrapper lia-message-image-actions-narrow lia-message-image-actions-below\"><span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 32px;\"><img decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/TwitterLogo32x32-5.png\" alt=\"TwitterLogo32x32.png\" title=\"TwitterLogo32x32.png\" \/><\/span>&nbsp;<a href=\"https:\/\/twitter.com\/Tushar_Suradkar\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Tushar_Suradkar<\/A><BR \/><\/SPAN><\/SPAN><\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;<br \/>\n When you access 2D objects from a Solid Edge Drawing,&nbsp;they are&nbsp;lying on a drawing sheet which belongs&nbsp;to one&nbsp;of these categories: <\/p>\n<p> Working Sheets.<br \/>\n Background Sheets&#8230;.<\/p>\n","protected":false},"author":42979,"featured_media":1949,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1,96],"tags":[33],"industry":[],"product":[],"coauthors":[],"class_list":["post-1936","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","category-tips-tricks","tag-developer"],"featured_image_url":"https:\/\/blogs.stage.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/TwitterLogo32x32-5.png","_links":{"self":[{"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/posts\/1936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/users\/42979"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/comments?post=1936"}],"version-history":[{"count":5,"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/posts\/1936\/revisions"}],"predecessor-version":[{"id":1950,"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/posts\/1936\/revisions\/1950"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/media\/1949"}],"wp:attachment":[{"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/media?parent=1936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/categories?post=1936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/tags?post=1936"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/industry?post=1936"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/product?post=1936"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/coauthors?post=1936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}