54
Unrestricted © Siemens AG 2013 All rights reserved. 4 th Generation VLC courtesy of Edison2 #SEU13 Developer Day Agenda (Beginner) Greg Chasteen, Siemens PLM Software

Solid Edge Develop Day Beginner Track

Embed Size (px)

DESCRIPTION

Includes the entire beginner track presentation material: Prerequisites, Getting Started with Visual Studio 2012, My first Solid Edge Macro, Create an assembly and generate drawing, Solid Edge Type Libraries, My first Solid edge Automation, Automating Assembly Replace Part, Ready to use samples (codeplex)

Citation preview

Page 1: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

4th Generation VLCcourtesy of Edison2

#SEU13

Developer Day Agenda (Beginner)Greg Chasteen, Siemens PLM Software

Page 2: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 2 Siemens PLM Software

Agenda

 Time Topic Speaker

08:00 – 08:15 Introductions and Day’s Agenda Greg Chasteen

08:15 – 09:00 Review Pre-requisites and Licensing Greg Chasteen

09:00 – 10:00 Hands-On: Visual Studio 2012 – Getting Started Greg Chasteen

10:00 – 10:15 Break

10:15 – 11:15 Hands-on: My First Solid Edge Macro Greg Chasteen

11:15 – 12:15 Program to Create an Assembly and Generate Drawing Greg Chasteen

12:15 – 01:00 Lunch

01:00 – 02:00 Understanding Solid Edge Type Libraries Greg Chasteen

02:00 – 03:00 Hands-On: My First Solid Edge Automation Greg Chasteen

03:00 – 04:00 Automating Assembly Replace Part Art Patrick

04:00 – 04:15 Break

04.15 – 04.45 Ready-to-Use Samples (Codeplex) Jason Newell

04:45 – 05:00 Evaluation Greg Chasteen

Page 3: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 3 Siemens PLM Software

Review Pre-requisites and Licensing

System Requirements • Operating system

Windows 7 SP1 (x86 and x64)• Supported architectures

32-bit (x86) 64-bit (x64)

• Minimum Hardware requirements 1.6 GHz or faster processor 4 GB of RAM (2.0 GB if running on a virtual machine) 5 GB of available hard disk space 7200 RPM hard disk drive DirectX 9-capable video card running at 1024 x 768 or higher display resolution

Minimum Software Requirement• Visual Studio 2010 Express or Visual Studio 2012 Express. Download from:

http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop• Solid Edge ST5 (32-Bit or 64-Bit). • Microsoft Word – 2003 or higher• Adobe Acrobat Reader Back to Agenda

Page 4: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 4 Siemens PLM Software

Visual Studio 2012 – Getting Started

• Create your first Visual Studio form based application using VB.NET Choose an example from MS Getting Started Tutorials

Create a new project Test (debug) an application Add basic controls like check boxes and buttons to a form Position controls on a form using layouts Add Open File and Color dialog boxes to a form Write code using IntelliSense and code snippets Write event handler methods.

Back to Agenda

Page 5: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

4th Generation VLCcourtesy of Edison2

#SEU13

Hands On: Visual Studio 2012Greg Chasteen, Siemens PLM Software

Page 6: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 6 Siemens PLM Software

Topics Covered

• Create New Project• Test an Application• Add basic controls• Write code using IntelliSense and code snippets• Write event handler methods

This presentation will mainly use Visual Basic delivered with Visual Studio 2010.

Page 7: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 7 Siemens PLM Software

Create a Windows Forms Application Project

To create a Windows Forms application project

On the File menu, choose New Project. If you’re not using an Express version of Visual Studio, choose either Visual C# or Visual Basic in the Installed

Templates list. Choose the Windows Forms Application icon, name the form PictureViewer, and then choose the OK button. Visual Studio creates the solution. On the File menu, choose Save All. As an alternative, choose the Save All button on the toolbar, which the following illustration shows. Save All toolbar button Make sure that the project is saved in a folder under your My Documents folder, verify that the Create Directory for

Solution check box is selected, and then choose the Save button.

Visual Studio automatically fills in the folder name and the project name and then saves the project in your projects folder.

Page 8: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 8 Siemens PLM Software

Run Your Program

Press the F5 key or click the Start Debugging toolbar button, which appears as follows.

Start Debugging toolbar button

2.The IDE runs your program, and a window appears. The following picture shows the program you just built. The program is running, and you will soon add to it.

Page 9: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 9 Siemens PLM Software

Run Your Program

Press the F5 key or click the Start Debugging toolbar button, which appears as follows.

Go back to the IDE, and look at the new toolbar - Debugging toolbar

Click the square Stop Debugging button or from the Debug menu, click Stop Debugging. The program stops running, and the window closes. You can also just close the open window to stop debugging.

When you run your program from inside the IDE, it's called debugging because you typically do it to track down and fix bugs. It's a real program, and you can run it just like you run any other program.

Page 10: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 10 Siemens PLM Software

Set Form Properties

Use the Properties window to change the way your form looks.

Be sure you're looking at Windows Forms Designer. In the IDE, click the Form1.vb [Design] tab (or the Form1.vb [Design] tab in Visual Basic).

Click anywhere inside the form to select it. Look at the Properties window, which should now be showing the properties for the form. Forms have various properties. For example, you can set the foreground and background color, title text that appears at the top of the form, size of the form, and other properties.

When you run your program from inside the IDE, it's called debugging because you typically do it to track down and fix bugs. It's a real program, and you can run it just like you run any other program.

After the form is selected, scroll down to the bottom of the Properties window, and find the Text property. Click Text, type Picture Viewer, and then press ENTER. Your form should now have the text Picture Viewer in its title bar, and the Properties window should look like the following picture.

Properties can be ordered by a Categorized or Alphabetical view. You can switch between these two views by using the buttons on the Properties window. In this tutorial, it's easier to find properties through the Alphabetical view.

Page 11: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 11 Siemens PLM Software

Layout Your Form

Go back to Windows Forms Designer. Click the form's lower-right drag handle, which is the small white square in the lower-right of the form and appears as follows. Drag it to resize the form so the form is wider and a bit taller.

Click the plus sign next to the Containers group to open it, as shown in the following picture

Page 12: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 12 Siemens PLM Software

Layout Your Form

You can add controls like buttons, check boxes, and labels to your form. Double-click the TableLayoutPanel control in the Toolbox. When you do this, the IDE adds a TableLayoutPanel control to your form, as shown in the following picture.

After you add your TableLayoutPanel, if a window appears inside your form with the title TableLayoutPanel Tasks, click anywhere inside the form to close it. You will learn more about this window later in the tutorial.

Notice how the Toolbox expands to cover your form when you click its tab, and closes after you click outside of it. That's the IDE auto-hide feature. You can turn it on or off for any of the windows by clicking the pushpin icon in the upper-right corner of the window to toggle auto-hide and lock it in place. The pushpin icon appears as follows.

Page 13: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 13 Siemens PLM Software

Layout Your Form

Be sure TableLayoutPanel is selected by clicking it. You can verify what control is selected by looking at the drop-down list at the top of the Properties window, as shown in the following picture.

Properties window showing TableLayoutPanel control

The control selector is a drop-down list at the top of the Properties window. In this example, it shows that a control called tableLayoutPanel1 is selected. You can select controls either by clicking in Windows Forms Designer or by choosing from the control selector. Now that TableLayoutPanel is selected, find the Dock property and click Dock, which should be set to None. Notice that a drop-down arrow appears next to the value. Click the arrow, and then select the Fill button (the large button in the middle), as shown in the following picture.

Page 14: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 14 Siemens PLM Software

Layout Your Form

After you set the TableLayoutPanel Dock property to Fill, the panel fills the entire form. If you resize the form again, the TableLayoutPanel stays docked, and resizes itself to fit.

A TableLayoutPanel works like a table in Microsoft Office Word: It has rows and columns, and an individual cell can span multiple rows and columns. Each cell can hold one control (like a button, a check box, or a label). Your TableLayoutPanel will have a PictureBox control spanning its entire top row, a CheckBox control in its lower-left cell, and four Button controls in its lower-right cell.

Although it was stated that each cell can hold only one control, the lower-right cell has four Button controls. This is because you can put a control in a cell that holds other controls. That kind of control is called a container, and the TableLayoutPanel is a container. You will learn more about this later in the tutorial.

Currently, the TableLayoutPanel has two equal-size rows and two equal-size columns. You need to resize them so the top row and right column are both much bigger. In Windows Forms Designer, select the TableLayoutPanel. In the upper-right corner, there is a small black triangle button, which appears as follows.

Page 15: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 15 Siemens PLM Software

Layout Your Form

Click the Edit Rows and Columns task to display the Column and Row Styles window. Click Column1, and set its size to 15 percent by being sure the Percent button is selected and entering 15 in the Percent box. (That's a NumericUpDown control, which you will use in a later tutorial.) Click Column2 and set it to 85 percent. Don't click the OK button yet, because the window will close. (But if you do, you can reopen it using the task list.)

From the Show drop-down list at the top of the window, click Rows. Set Row1 to 90 percent and Row2 to 10 percent.

Click OK. Your TableLayoutPanel should now have a large top row, a small bottom row, a small left column, and a large right column. You can resize the rows and columns in the TableLayoutPanel by dragging their borders.

Page 16: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 16 Siemens PLM Software

Add Controls to Your Form

Go to the Toolbox and expand the Common Controls group. This shows the most common controls that you see on forms.

Double-click the PictureBox control. The IDE adds a PictureBox control to your form. Because the TableLayoutPanel is docked to fill your form, the IDE adds the PictureBox control to the first empty cell.

Click the black triangle on the new PictureBox control to display its task list, as shown in the following picture. If you accidentally add the wrong type of control to your TableLayoutPanel,

you can delete it. Right-click the control, and then click Delete from the menu. You can also select Undo from the Edit menu to remove controls from the form

Page 17: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 17 Siemens PLM Software

Add Controls to Your Form

Click the Dock in parent container link. This automatically sets the PictureBox Dock property to Fill. To see this, click the PictureBox control to select it, go to the Properties window, and be sure that the Dock property is set to Fill.

Make the PictureBox span both columns by changing its ColumnSpan property. Select the PictureBox control and set its ColumnSpan property to 2. Also, when the PictureBox is empty, you want to show an empty frame. Set its BorderStyle property to Fixed3D.

Add the CheckBox control to the form. Double-click the CheckBox item in the Toolbox to make the IDE add a new CheckBox control to the next free cell in your table. Because a PictureBox takes up the first two cells, a CheckBox control is added to the lower-left cell. Select the new CheckBox control and set its Text property to Stretch.

Go to the Containers group in the Toolbox (where you got your TableLayoutPanel control) and double-click the FlowLayoutPanel item to add a new control to the last cell in the PictureBox. Then dock it in the parent container (either by choosing Dock in parent container from the task list, or by setting its Dock property to Fill).

A FlowLayoutPanel is a container that arranges other controls in neat rows in order. When you resize a FlowLayoutPanel, if it has room to lay out all of its controls in a single row, it does that. Otherwise, it arranges them in lines, one on top of the other. You will use a FlowLayoutPanel to hold four buttons.

Page 18: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 18 Siemens PLM Software

Add Controls to Your Form – Add Buttons

Select the FlowLayoutPanel that you added. Go to Common Controls in the Toolbox and double-click the Button icon to add a button called button1 to your FlowLayoutPanel. Repeat to add another button. The IDE determines that there's already a button called button1 and calls the next one button2. In Visual Basic the buttons are named with an initial cap, so button1 is Button1, button2 is Button2, and so on.

Typically, you add the other buttons using the Toolbox. This time, click button2, and then on the Edit menu, click Copy (or press Ctrl+C). On the Edit menu, click Paste (or press Ctrl+V) to paste a copy of your button. Now paste it again. The IDE has now added button3 and button4.

You can copy and paste any control. The IDE names and places the new controls in a logical manner. If you paste a control into a container, the IDE chooses the next logical space for placement.

Select the first button and set its Text property to Show a picture. Then set the Text properties of the next three buttons to Clear the picture, Set the background color, and Close.

The next step is to size the buttons and arrange them so they align to the left side of the panel. Select the FlowLayoutPanel and look at its FlowDirection property. Change it so it's set to RightToLeft. As soon as you do, the buttons should align themselves to the right side of the cell, and reverse their order so that the Show a picture button is on the right.

If the buttons are still in the wrong order, you can drag the buttons around the FlowLayoutPanel to rearrange them in any order. You can click one of the buttons and drag it left or right.

Click the Close button to select it. Hold down the CTRL key and click the other three buttons, so that they are all selected. While all the buttons are selected, go to the Properties window and scroll up to the AutoSize property. This property tells the button to automatically resize itself to fit all of its text. Set it to true. Your buttons should now be sized properly and be in the right order. (As long as all four buttons are selected, you can change all four AutoSize properties at the same time.)

Make the PictureBox span both columns by changing its ColumnSpan property. Select the PictureBox control and set its ColumnSpan property to 2. Also, when the PictureBox is empty, you want to show an empty frame. Set its BorderStyle property to Fixed3D.

Add the CheckBox control to the form. Double-click the CheckBox item in the Toolbox to make the IDE add a new CheckBox control to the next free cell in your table. Because a PictureBox takes up the first two cells, a CheckBox control is added to the lower-left cell. Select the new CheckBox control and set its Text property to Stretch.

Go to the Containers group in the Toolbox (where you got your TableLayoutPanel control) and double-click the FlowLayoutPanel item to add a new control to the last cell in the PictureBox. Then dock it in the parent container (either by choosing Dock in parent container from the task list, or by setting its Dock property to Fill).

A FlowLayoutPanel is a container that arranges other controls in neat rows in order. When you resize a FlowLayoutPanel, if it has room to lay out all of its controls in a single row, it does that. Otherwise, it arranges them in lines, one on top of the other. You will use a FlowLayoutPanel to hold four buttons.

Page 19: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 19 Siemens PLM Software

Name Your Button Controls

To name your button controls

There are four buttons on your form, and the IDE named them button1, button2, button3, and button4. By just looking at their current names, you don't know which button is the Close button and which one is the Show a picture button. That's why naming your button controls is helpful.

Click the Close button. (If you still have all the buttons selected, press the ESC key to cancel the selection.) Scroll in the Properties window until you see the (Name) property. (The (Name) property is near the top when the properties are alphabetical.) Change the name to closeButton, as shown in the following picture.

If you try changing the name of your button to close Button, with a space between the words close and Button, the IDE displays an error message: "Property value is not valid." Spaces (and a few other characters) are not allowed in control names.

Rename the other three buttons to backgroundButton, clearButton, and showButton. You can verify the names by clicking the control selector drop-down list in the Properties window. The new button names appear.

Page 20: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 20 Siemens PLM Software

Write Code for the Show a Picture Button Event Handler

Private Sub showButton_Click() Handles showButton.Click

If OpenFileDialog1.ShowDialog() = DialogResult.OK Then PictureBox1.Load(OpenFileDialog1.FileName) End If

End Sub

To run your program press F5

Page 21: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

4th Generation VLCcourtesy of Edison2

#SEU13

My First Solid Edge MacroGreg Chasteen, Siemens PLM Software

Page 22: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 22 Siemens PLM Software

My First Solid Edge Macro

What is a Macro?

Macro is a set of instructions that are given to an application to perform repetitive tasks.

We can create a macro in Visual Studio as well as in other Microsoft applications like Microsoft Excel.

Macro is one of the way to customize Solid Edge.

Problem to solve:

Need a macro to clean up draft files. Empty layers must be deleted!

Page 23: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 23 Siemens PLM Software

Create Macro in Microsoft Excel

To create a macro in Microsoft Excel go through following steps.1

1. Start Microsoft Excel.

2. Click on “Developer” Tab in ribbon bar.

3. If “Developer” tab is not present then click on File > Options. Following dialogue box will appear.

Page 24: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 24 Siemens PLM Software

Create Macro in Microsoft Excel

4. Now save this file with extension as .xlsm (Applicable for MS Excel 2010 onwards)

5. In “Developer” tab you will find button to add control on this worksheet. Click on command button to add on worksheet.

6. Dialogue box as shown will appear.

Page 25: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 25 Siemens PLM Software

Create Macro in Microsoft Excel

7. Click on New button, “Microsoft Visual Basic for Applications” will open.

8. Now click on Tools > References to add references to your Macro.

9. Click on Solid Edge references as per your requirement.

10. For current example add “Solid Edge Framework type Library” and “Solid Edge Draft type library”

Page 26: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 26 Siemens PLM Software

Create Macro in Microsoft Excel

Page 27: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 27 Siemens PLM Software

My Second Solid Edge Macro – Time Permitting

Problem to solve:

Need to produce a dimension inspection sheet for opened draft file.

Page 28: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 28 Siemens PLM Software

Program to Create an Assembly and Generate Drawing

• This will NOT be a Hands-On session

• In this session we will give a walkthrough of a program that creates an assembly and generates a detailed drawing.

Add Solid Edge Assembly and Draft references Create Solid Edge instance Create an assembly file Add parts in the assembly Specify relationship between the parts Create a draft from this assembly Create a parts list in the draft Save the assembly file and the draft file

• This program is a part of the “sample programs” that will be shared with the users at the end of the day

Back to Agenda

Page 29: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

4th Generation VLCcourtesy of Edison2

#SEU13

Program to Create an Assembly and Generate DrawingGreg Chasteen, Siemens PLM Software

Page 30: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 30 Siemens PLM Software

Program to Create an Assembly and Generate Drawing

• This will NOT be a Hands-On session

• In this session we will give a walkthrough of a program that creates an assembly and generates a detailed drawing.

Add Solid Edge Assembly and Draft references Create Solid Edge instance Create an assembly file Add parts in the assembly Specify relationship between the parts Create a draft from this assembly Create a parts list in the draft Save the assembly file and the draft file

Page 31: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

4th Generation VLCcourtesy of Edison2

#SEU13

Understanding Solid Edge Type LibrariesGreg Chasteen, Siemens PLM Software

Page 32: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 32 Siemens PLM Software

Understanding Solid Edge Type Libraries

• Why is automation necessary?

• Understand various Type Libraries available in Solid Edge. Detailed explanation on usage of each type library

• Overview of Solid Edge development environment

• Introduction to sample templates available in VS2010

• How to go about finding the right API to do the job

• Frequently needed utility programs

• Identify errors in the program

Page 33: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 33 Siemens PLM Software

Necessity of Automation

The complexity of CAD automation can vary from a simple template to a full application, covering simple automation of repetitive tasks to complex optimizations. CAD Automation can provide benefits throughout the entire development lifecycle of a product. These tools offer a number of benefits ranging from increased throughput, enforced common design methods and consistency, and improved quality. By leveraging corporate best practices and lessons learned, CAD Automation provides the right knowledge to the engineer when they need it allowing for first time quality!It has other benefits such as

• Knowledge Based Manufacturing

• Risk Reduction

• Cost and availability of skilled workers

• Productivity Benefits

• Ease of use and reliability

• Better faster service

• Rapid ROI and lifetime cost

Page 34: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 34 Siemens PLM Software

Solid Edge Core Type Libraries

The Solid Edge core COM type libraries are the APIs that are available to automate the Solid Edge application.

These APIs can be used by any programming or scripting language that supports COM.

You can find these type libraries in the installation path of Solid Edge under the “Program” folder.

For example: “%PROGRAMFILES%\Solid Edge VXX\Program”.

Name Description Type LibrarySolidEdgeFramework Solid Edge Framework Type Library framewrk.tlb SolidEdgeFrameworkSupport Solid Edge FrameworkSupport Type Library fwksupp.tlb SolidEdgePart Solid Edge Part Type Library part.tlb SolidEdgeGeometry Solid Edge Geometry Type Library geometry.tlbSolidEdgeAssembly Solid Edge Assembly Type Library assembly.tlb SolidEdgeAssemblySync Solid Edge Assembly Synchronous Type Library assemblysync.tlb SolidEdgeDraft Solid Edge Draft Type Library draft.tlb SolidEdgeConstants Solid Edge Constants Type Library constant.tlbSEInstallDataLib Solid Edge Install Data Library SEInstallData.dll SolidEdgeFileProperties Solid Edge File Properties Object Library PropAuto.dll RevisionManager Solid Edge Revision Manager Object Library RevMgr.tlb

Page 35: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 35 Siemens PLM Software

How to add references?

Before you can start working with the Solid Edge API, you'll need to add a reference to the type libraries that you'll be using. You can begin by selecting Project -> Add Reference from the main menu in Visual Studio .NET.

Page 36: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 36 Siemens PLM Software

How to add references?

The Add Reference dialog window will appear. You will first need to click the COM tab. Scroll down until you get to the Solid Edge Type Libraries. Select the Solid Edge Framework Type Library as shown below.

When you add a COM reference in .NET, Visual Studio .NET actually calls a Type Library Importer program that generates an "Interop Assembly" for your project to use. This also means that your executable will forever and always dependent upon the generated interop assembly. If you plan on deploying your application to users, you'll need to be sure to include any interop assemblies that you've generated for your project.

Page 37: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 37 Siemens PLM Software

Solid Edge Assembly Type Library (assembly.tlb)

The SolidEdgeAssembly type library contains interfaces related to the 3-D Assembly environment. The most important interface in this type library is the SolidEdgeAssembly.AssemblyDocument interface. This interface allows you to work directly with assembly document types in Solid Edge.

Let’s take a look at the contents of this type library with the VS object browser!

Page 38: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 38 Siemens PLM Software

Solid Edge Constants Type Library (constant.tlb)

This type library is exclusively for global enumerations. e.g: igRight, igUnitDistance, etc

Oleview.exe is a great way to view these enumerations and their values.

You should be aware that some of the enumerations defined in this type library are duplicated in other type libraries.

Let’s take a look at the contents of this type library with the VS object browser!

Page 39: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 39 Siemens PLM Software

Solid Edge Drafts Type Library

The SolidEdgeDraft type library contains interfaces related to the 2-D Draft environment.

The most important interface in this type library is the SolidEdgeAssembly.DraftDocument interface. This interface allows you to work directly with draft document types in Solid Edge.

Let’s take a look at the contents of this type library with the VS object browser!

Page 40: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 40 Siemens PLM Software

Solid Edge File Properties Object Library (PropAuto.dll)

This is a Lightweight API to get read/write access to a Solid Edge document’s file propertiesThe SolidEdgeFileProperties API is used to read and write Solid Edge file properties outside of Solid Edge. This can be extremely useful when you need to quickly work with a large dataset of files. Solid Edge uses standard Microsoft Structured Storage API to store properties. You can learn more about Microsoft’s Structured Storage API on MSDN at: http://msdn2.microsoft.com/en-us/library/aa380369(VS.80).aspx

Let’s take a look at the contents of this type library with the VS object browser!

• Sample code FileProperties.sln from the USB thumb drive in the Completed Program\SolidEdgeFileProperties folder

Page 41: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 41 Siemens PLM Software

Solid Edge Framework Type Library (framewrk.tlb)

The SolidEdgeFramework type library is the root type library. It has no dependencies on any other type library. At a minimum, you must reference it to interact with Solid Edge with strongly typed objects.

Most other core APIs have a dependency on this type library. One of the most important interfaces that you will work with is the SolidEdgeFramework.Application interface. You must get a reference to this object before you can do any automation in Solid Edge.

Typically, this comes in some form of GetObject() or CreateObject(). You can use the ProgID, “SolidEdge.Application” to get a reference to this object. Another important interface is the SolidEdgeFramework.SolidEdgeDocument interface.

Let’s take a look at the contents of this type library with the VS object browser!

Page 42: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 42 Siemens PLM Software

SolidEdgeFrameworkSupport Type Library (fwksupp.tlb)

The SolidEdgeFrameworkSupport type library contains interfaces that span all Solid Edge environments and are not environment specific.

All APIs for functionality common across all environments for 2D elements (lines, dimensons, boundaries,etc)

Let’s take a look at the contents of this type library with the VS object browser!

Page 43: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 43 Siemens PLM Software

Solid Edge Geometry Type Library (geometry.tlb)

The SolidEdgeGeometry type library contains interfaces that relate to both 2D and 3D elements. ( body,face,curve,etc.)

Let’s take a look at the contents of this type library with the VS object browser!

Page 44: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 44 Siemens PLM Software

Solid Edge Install Data Library (SEInstallData.dll)

This is a lightweight API to determine Solid Edge information such as path version, etc.The SEInstallDataLib API is used to safely harvest installation information about Solid Edge from the Windows registry. It contains only one class, the SEInstallData class. This class has straight forward named methods to get installation information. You can use the ProgID “SolidEdge.InstallData” to create an instance of the SEInstallData class.

Let’s take a look at the contents of this type library with the VS object browser!

• Sample code SEInstallData.sln from the USB thumb drive in the Completed Program\SEInstallData folder

Page 45: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 45 Siemens PLM Software

Solid Edge Part Type Library (part.tlb)

The SolidEdgePart type library contains interfaces related to the following 3-D environments:

Part, SheetMetal, and Weldment. The most important interfaces in this type library are the SolidEdgePart.PartDocument, SolidEdgePart.SheetMetalDocument and SolidEdgePart.WeldmentDocument.

These interfaces allow you to work with a specific document type in SE.

Let’s take a look at the contents of this type library with the VS object browser!

Page 46: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 46 Siemens PLM Software

Solid Edge Revision Manager Object Library (RevMgr.tlb)

The RevisionManager API can be used for several purposes. • Manage file properties • Manage link information • Integrate with Insight

You can use the ProgID 'RevisionManager.Application' to create an instance of the Application class.

Let’s take a look at the contents of this type library with the VS object browser!

• Sample code AStruct.sln from the USB thumb drive in the Completed Program\RevManager folder

Page 47: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 47 Siemens PLM Software

Adding References (Preferred!)

Since your program is actually referencing the COM “interops” instead of the Solid Edge type libraries, it is a good idea to reference UNIQUE interop DLLs!

• GenEdgeInteropAssemblies.bat is a tools delivered with Solid Edge in the following folder:

C:\Program Files\Solid Edge STX\SDK\tools

Example invocation:

GenEdgeInteropAssemblies “C:\Program Files\Solid Edge ST5" C:\SEU13\ST5_Interops _Siemens

Page 48: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 48 Siemens PLM Software

Online Solid Edge Templates for SE Customization

Run file/new project. Click “online templates” and enter “solid edge” in the search box and do the search. This is Visual Studio 2010 only.

Page 49: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 49 Siemens PLM Software

Online Solid Edge Templates for SE Customization

Solid Edge Add-In

A project for creating a VB .NET based Solid Edge Add-In that has has a user interface in Solid Edge. The add-in implements the “ISolidEdgeAddIn” interface and also responds to Solid Edge application events by implementing the “ISEApplicationEvents” interface. The add-in also supports the Solid Edge edgebar user interface. The add-in also has support for the Solid Edge File User Interface event set, the Solid Edge Bar Events and Solid Edge Shortcut Menu events by implementing the appropriate event interfaces

Solid Edge Command Macro

A project for creating a macro that runs as a command in Solid Edge. The project will connect to a running instance of Solid Edge or create an instance of Solid Edge if one is not running. Then if a document is opened, the project creates a command in Solid Edge with mouse locate capability. If an instance of Solid Edge is started, a new part document is automatically created.

Solid Edge Add-In No UI

A project for creating a VB .NET based Solid Edge Add-In that has has a user interface in Solid Edge. The add-in implements the ISolidEdgeAddIn interface and also responds to Solid Edge application events by implementing the ISEApplicationEvents interface. The add-in also supports the Solid Edge edgebar user interface. The add-in also has support for the Solid Edge File User Interface event set, the Solid Edge Bar Events and Solid Edge Shorcut Menu events by implementing the appropriate event interfaces.

Page 50: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 50 Siemens PLM Software

How to go about finding the right API to do the job?

• How to go about finding the right API to do the job?

Page 51: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 51 Siemens PLM Software

Frequently needed utility programs

• Frequently needed utility programs/functions

• See USB drive• Beginner Track\Completed Programs\MySolidEdgeMacroTemplate folder

Page 52: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

4th Generation VLCcourtesy of Edison2

#SEU13

Hands-On: My First Solid Edge AutomationGreg Chasteen, Siemens PLM Software

Page 53: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 53 Siemens PLM Software

Hands-On: My First Solid Edge Automation

• This is a Hands-On session which will cover following points.

• Create your first VB.NET form based application that will create a Solid Edge part model Add Solid Edge references Create Solid Edge instance Create a part file Plane selection/reference plane generation. Create profile Constrain profile Add base feature Round the edges Save the file

• More samples • See USB driveBeginner Track\Completed Programs\MyFirstSolidEdgeApplication\BasicAutomationOfPartsAssemblyandDraft.sln

Page 54: Solid Edge Develop Day Beginner Track

Unrestricted © Siemens AG 2013 All rights reserved.

Page 54 Siemens PLM Software

Hands-On: My First Solid Edge Automation - Continuation

• Time permitting cover Mark Critical Dimensions in Draft

• This is a Hands-On session which will cover following points.

• Create your first VB.NET form based application that will create a Solid Edge part model Add Solid Edge references and alternative method (preferred) OLE messaging…. Very important! Connect to Solid Edge Draft document Working with Selected draft file objects. Working with dimensions. Working with drawing annotations… specifically balloons Save the file