We use cookies to give you the best experience possible. By continuing we’ll assume you’re on board with our cookie policy

Solid Edge Automation

The whole doc is available only for registered users

A limited time offer! Get a custom sample essay written according to your requirements urgent 3h delivery guaranteed

Order Now

According to MS Word thesaurus, customization means : “To alter something in order to make it fit somebody’s requirements better ” You too can customize Solid Edge to fit your requirements better. Whatever changes you make to the default appearance of the toolbar or layout of other windows is customization. Parts of the Solid Edge screen that can be customized : Toolbars – Manually or programmatically. Status bar – Display On/Off and location Top/Bottom. EdgeBar – Location (left/right) or display of sketches on/off. The Interface – Changing background color in Part or Draft. Only changes that persist (remain effective after Solid Edge is restarted) can be called Customization.

Whatever steps that you carry out to do a repetitive task can be combined into one step and this is called Automation. Steps/Commands in Solid Edge that can be automated : There is practically no limit to what can be automated. Mostly programs written in languages like VB or C++ are used to automate repetitive tasks. This entire book is an attempt to discuss what and how automation can be done.

Steps involved in the engineering design of a part or whole product can be automated and this is called ‘Design Automation’.

© 2013 Tushar Suradkar – www.CADVertex.com

Solid Edge Customization using VB and VB.NET

Steps involved in related engineering processes like cost calculations, material calculations, machining cost, product documentation from CAD data, producing quotations, etc. can also be automated and is called ‘Process Automation’. Solid Edge and Solid Edge API can be used extensively in both Design Automation and Process Automation. This entire book is an attempt to discuss what and how automation can be done, where you develop all of the following concepts and much more. Batch processing of Solid Edge files like, batch importing of legacy data, batch exporting of Solid Edge files, batch processing of legacy data, etc. Reading from and writing Solid Edge data to external databases like Excel, Access, text files, XML, PDF, HTML, etc. Product Configurator which integrates and automates much of the routine tasks of design and sales teams. Harnessing the Win API to streamline and integrate your apps with the host OS. Material estimates, cost and effort estimates from Solid Edge data. Advanced design optimization techniques for material and cost. Excel customization and using Excel in Solid Edge Automation. Customized Robotic simulation using Solid Edge API. Design and develop Solid Edge based ‘games’ !!

But for sure, you will resort to Customization in order to use Automation For example, customize the toolbar to add a new tool to run an automated task achieved using a VB program – This is the difference between Customization and Automation. Finally, the notion of customization does not merely imply automation of Solid Edge ‘commands’. It is essentially the automation of ‘your’ design steps like the design of your company’s product using rules, formulas, design tables, etc. and ‘process’ steps like estimates of machining time and cost, generating quotations, product catalogs, etc. all from CAD data.

This is going to be a very interesting exercise. More than often you find putting certain things on and off the screen like reference planes, sketches, zebra stripes, etc. Although Solid Edge provides a separate tool for this, the process takes too many clicks and becomes cumbersome. Why not create a toolbar to quickly access these options ! The toolbar would look something as shown below:

The Recipe
Right click on any toolbar (not the ribbon bar) or select View > Toolbars > Toolbars… Click New… A dialog box appears, type On/Off as name of the toolbar. A toolless toolbar will appear on the screen and also the Customize dialog pops up. Select from the category list on the right and start dragging and dropping various tools from the right-side area onto the empty toolbar. © 2013 Tushar Suradkar – www.CADVertex.com

Solid Edge Customization using VB and VB.NET

The following table shows which category to look for the desired tools to build the On/Off toolbar: Tool Reference Planes Reference Axes Sketches

Surfaces Curves Design Body Category Reference Reference Sketch Surfacing Surfacing Model

And although this toolbar occupies some space on the screen, it saves you many clicks later when turning display on and off – This way you have customized the default interface too.

Further Reading for Chapter 1
You can make as many toolbars as desired but need to be careful. A toolbar created in the Draft environment may not show up in Part. Further, a toolbar created in the sketcher or profile environment of Part may not be seen once you are out of the sketcher. You can create tools to run VB programs or external apps with your own bitmaps on the tool. To do this, take the Macros category and browse to the location where a VB program (exe) is kept or may be you want to launch notepad from within Solid Edge, so browse to the Windows folder to locate notepad.exe. All executable programs from that folder will be listed in place of the tools. Drag and drop a filename from the list on a toolbar and a dialog will appear to let you choose a bitmap picture for the new tool. Here, click the Browse… button and select your desired bmp file for the tool.

Closing Hour : Chapter 1

Customization is different from Automation. Only persistent changes be termed customization. Various parts of Solid Edge can be customized. Various steps in Solid Edge can be automated.

Chapter 2
A Quick Tour of Solid Edge Customization

To set a background color for graphics area: Format > View – Background tab. Select ‘Solid Edge Default’ from the ‘Type’ list.

To set a gradient background color for graphics area: Format > View – Background tab. Select ‘Gradient’ from the ‘Type’ list. Select Vertical/Diagonal, etc. from the ‘Gradient’ list. Select colors from the ‘Color1’ and ‘Color2’ lists. To set an image as background for graphics area: Format > View – Background tab. Select ‘Image’ from the ‘Type’ list. Click ‘Browse…’ to pick an image.

© 2013 Tushar Suradkar – www.CADVertex.com

Solid Edge Customization using VB and VB.NET

To Show/Hide a toolbar: Right-click on any visible toolbar and select a toolbar from the pop-up menu to show/Hide it. A toolbar with a checkmark ahead of its name in the pop-up menu is visible. To float/dock a toolbar: Move cursor to the top or left edge of the docked toolbar (area that has a raised line mark).

Press and drag into graphics area to undock the toolbar. To dock a floating toolbar horizontally or vertically, press and drag the title bar of a floating toolbar and drag towards the edge of the graphics area. Solid Edge shows a highlighted preview of the final position.

When you turn a toolbar On/Off or Dock/Undock it, Solid Edge remembers which toolbars to display and where to display them for each document type, after restarting.

Similarly move the EdgeBar from its docked or floating position. Click the line at the top or side of the Edgebar and drag it to the desired location to dock/undock it.

Solid Edge Customization using VB and VB.NET

To resize a toolbar or change orientation: Move cursor along the edges of a floating toolbar and when the cursor changes to a or press and drag to resize or swap orientation between horizontal/vertical.

To display large icons on a toolbar: Tools > Options – Helpers tab at the top. Check ON Large buttons. To remove a button from a toolbar: Right click on the toolbar and select ‘Customize…’ from the context menu. The Customize dialog appears. Drag any button out of the toolbar and drop it into the emptiness of the graphics area. Also, Drag & Dropping a button from one toolbar onto another toolbar ‘moves’ the button to the other toolbar. Drag & Dropping a button from one toolbar onto another toolbar with the Ctrl key pressed ‘copies’ the button to the other toolbar. Drag & Dropping a button from a toolbar onto the same toolbar ‘reorders’ the button on the toolbar. A toolbar created in the Drawing environment may not show up in Part

© 2013 Tushar Suradkar – www.CADVertex.com

Solid Edge Customization using VB and VB.NET

Creating a keyboard shortcut:
Solid Edge is among the very few Windows program and perhaps the only CAD software that allows assigning keyboard shortcut for menu sequences. Solid Edge sports a plethora of keyboard shortcuts for almost every commonly used command. Switching between shaded and wireframe display modes is a common task when modeling or assembling. Keyboard shortcuts for these are not available by default. How about a quick Ctrl+W for wireframe and Ctrl+H for shaded display?

The Recipe
Open a Part document in Solid Edge and right-click on any toolbar. Select ‘Customize…’ from the popup menu or select Tools > Customize… from the pulldown menu. Take the ‘Keyboard’ tab at the top. Select ‘Format in the Categories list and from the commands list pick ‘Wire Frame’. Click inside the textbox for ‘Press new shortcut key’. The empty area means no keyboard shortcut is assigned yet. Press the Ctrl+W key combination at the keyboard and then click the Assign button. Ctrl+W appears in the box below ‘Current keys:’. Similarly assign the Ctrl+H combination to Shaded. Next, select Tools > Options… and take the Helpers tab. Check ON Show tooltips and select the ‘with enhanced text’ option button. OK.

The shortcut Ctrl+H is now displayed in the tooltip as in image above.

© 2013 Tushar Suradkar – www.CADVertex.com

Solid Edge Customization using VB and VB.NET

Chapter 3
Solid Edge Specific VB

No plans here to teach Visual Basic programming since I want to remain focused on Solid Edge customization. Your understanding of VB could be as minimal as the VB syntax, constructs or ability to create simple dialog boxes – no problem ! Today you will focus on more subtle aspects of VB that you must understand before beginning to customize (or automate ?) Solid Edge. You will enjoy this day since we discuss collections and arrays besides objects and classes.

Arrays Vs. Collections
What you need to know

Solid Edge customization involves using collections and arrays day in and out. If you still believe these are something to eat with – probably you are correct – only that I will chew it for you and you need only digest. Lets start peeling it off… Solid Edge uses arrays to store reference planes, profiles, point coordinates, etc. Solid Edge uses collections to store documents, sheets, occurrences, layers, features, selection sets, etc.

What is the difference ?
Whatever, but lets also see how they are used. Arrays are normally of the same data type, like integers or strings, whereas collections can dump a variety of them in the same name. Whereas the range of arrays need to be declared or redimensioned, collections can expand or contract dynamically.

How ?
You would declare an array as below :

Dim objPlane (1 To 2) As SolidEdgePart.RefPlane
Then use it as :

Set objPPlane(1) = objDoc.RefPlanes(2)
Here, all items in an array are of the same type. This is not the case with collections. Whereas a collection is declared as below :

Dim oDocs As SolidEdgeFramework.Documents
Then used as :

Set oDocs = oApp.Documents
Here, items in the collection can be of different types – like a Draft document or Part document.

How collections are more versatile ? Staying away from Solid Edge usage, a collection can be simply declared as : Dim MyCol As collection Later in a procedure, you can use it as : Set MyCol = New Collection

Note the built-in support for collections.
© 2013 Tushar Suradkar – www.CADVertex.com

Solid Edge Customization using VB and VB.NET

Also, a collection can store more than one data type as below : MyCol.Add (“Radius”) MyCol.Add (12.5) MyCol.Add (100) Further, you can delete an item using its name or index, besides counting and referencing an item. To learn more about arrays and collections, download and read a free eBook ‘VB for engineers and designers’ from: http://cadvb.20m.com

Objects and Classes
Objects and classes form the backbone of Solid Edge Customization. Objects have properties and methods. Simple buttons on a form or the form itself are objects – a button has properties like caption, font, etc. and methods like Refresh, Drag, etc. Whereas, a form has properties like background color, draw mode and methods like Move, Hide, Popup Menu, etc. Similarly, Solid Edge itself is a huge object. Solid Edge also has properties and methods which you will explore beginning chapter 4 and start coding on Day 5.

Lab of the Day :
Creating a Simple Class

Creating a simple class and deriving an object from it would be a nice and encouraging activity. So Lets Go… In today’s lab we will create a class called Automobile and derive an object Car from this class. Although, this object won’t have any graphic interface, you will get to understand what goes on under the hood. © 2013 Tushar Suradkar – www.CADVertex.com

Solid Edge Customization using VB and VB.NET

The Recipe
Fire up Visual Basic and choose ActiveX DLL. In the Project Explorer, change the name of the Project name to Automobile. Add the following code : Option Explicit Enum cType cSports = 1 cSedan = 2 cRacer = 3 cHatchback = 4 End Enum Public Public Public Public sColor As String dPower As Long bHasSpoiler As Boolean CarType As cType

Public Function BlowHorn() MsgBox “Beep Beep” End Sub
Here, the four variables declared will serve as properties of the class Automobile. The function BlowHorn will be the method of the new class Automobile. Also note the data type cType which is an enum. Solid Edge also uses enums extensively as you will see later.

Save the project as Automobile.vbp and the class as Car.cls Select File > Make Automobile.dll… to compile the DLL (Dynamic Link Library). This also automatically registers the DLL to the Windows Registry so that it becomes available for other projects to reference. This way you have just created the design of a new car! © 2013 Tushar Suradkar – www.CADVertex.com

Close the current project and start a new Standard EXE project in Visual Basic. Spruce up the dialog as shown in image below:

Paste the following code to the form module: Option Explicit Dim oMyCar As Automobile.Car Private Sub cmdCreateCar_Click() Set oMyCar = New Automobile.Car oMyCar.sColor = Text1.Text oMyCar.dPower = Val(Text2.Text) oMyCar.bHasSpoiler = True oMyCar.CarType = cHatchback End Sub Private Sub cmdBlowHorn_Click() oMyCar.BlowHorn End Sub Private Sub cmdDestroCar_Click() Set oMyCar = Nothing End Sub In the above code, as soon as you press the spacebar after the keyword As, the Auto List Members setting lists Automobile as one of members.

Solid Edge Customization using VB and VB.NET

Further, Car is also listed after you place the dot after Automobile.

Here, you are specifying the type of the new object oMyCar using the fully qualified class name Automobile.Car Similarly, Solid Edge which itself is a big object can be declared as follows : Dim oSE As SolidEdgeFramework.Application Note that you have only declared the type of the object variable and not created the Car or Solid Edge objects. This is similar to declaring Dim iCount As Integer where the variable iCount is not yet assigned a value. Again, in the sub cmdCreateCar_Click(), you get the method BlowHorn listed as one of the methods of the object oMyCar, since it is a function defined in the class module Car.

Similarly, the Solid Edge object (or simply Solid Edge) has methods like Activate, StartCommand, Quit, etc.

Solid Edge Customization using VB and VB.NET

Also note the properties bHasSpoiler, CarType, dPower, sColor of the object oMyCar which were declared as variables in the class module Car. Similarly, the Solid Edge object (or simply Solid Edge) has various Properties like ActiveDocument, EdgeBarVisible, Version, etc. Some Solid Edge properties can be read-only. For e.g. The Version property is a read-only property and you cannot assign a different value to it, doing so will generate an error.

Further, when assigning a value to the CarType variable, again a list appears indicating valid set of values that can be assigned to it, this is courtesy of the Enum cType that you declared in the class module.

Similarly, Solid Edge also has a rich set of Enums and Constants like FeatureType or DocumentType as shown below :

Enums or Constants help assigning ‘hard-to-remember’ numeric values to properties using ‘easy-to-remember’ text strings. Here, the CarType variable is being assigned a value of 1 internally as defined in the enum when creating the Car class.

© 2013 Tushar Suradkar – www.CADVertex.com

Solid Edge Customization using VB and VB.NET

Similarly, Solid Edge implements an overwhelming number of Constants when assigning values to its various properties.

Next, note the code line Set oMyCar = New Automobile.Car This is where your new car is created. Congratulations ! Double-click the button Create Car and also observe its code. Values from the text boxes or default values are assigned to the various properties of the newly created Car object. Click the button Blow Horn and also observe its code. The method BlowHorn of the Car object is called. Click the button Destroy Car and look at its code. The Car object is set to Nothing and memory taken up is freed. This is an important technique in managing memory when writing custom apps that ‘automate Solid Edge commands’ (or simply – automate Solid Edge). Check this by clicking the ‘Blow Horn’ button again. Since you just destroyed the car, the horn is gone too and won’t blow.

You should get an error message mentioning that the Car object no longer exist. Click ‘End’ for now.

© 2013 Tushar Suradkar – www.CADVertex.com

Solid Edge Customization using VB and VB.NET

Further Reading for Chapter 3
This way, form a habit of getting under the hood, although not necessarily by coding an equivalent of a Solid Edge feature – but by reading interesting stories from whatever sources you can. Here is, for example, an interesting reference on the While Loop and the story goes like this…. Long time ago, there existed two nations – Athens and Sparta.

Athens Vs. Sparta
People from the two countries constantly innovated to gain an edge over the other. This eventually led to the invention of the catapult by the people of Athens and it was deployed immediately. The secret of the effective use of the catapult was a While Loop that is used even today. The commander of Athens gathered his army just behind a hillock. The army of Sparta was on the other side of the hill. The commander climbed and stood on top of the hill holding a flag upright as long as he wanted the catapult to be operated. At the foothill, the army systematically carried out the tasks of : Unloading the balls from a cart Loading the balls in the catapult Winding the catapult and make it ‘ready’ for launch Continue

Solid Edge Customization using VB and VB.NET

As long as they could see the flag (variable=true), they continued with the set of aforesaid steps. As soon as the flag came down (variable=false) they sopped (came out of the loop).

Today you would code the same as : Dim blnFlag As Boolean blnFlag = True While blnFlag = True Call UnloadBallsFromCart(2) Call LoadBallIntoCatapult(1) Call HurlBallAtEnemy(1) Call LoadBallIntoCatapult(1) Call HurlBallAtEnemy(1) Call WindCataPult(Fast) If NotSeen(Flag) Then blnFlag = False End If Wend Hope you enjoyed the story !

Closing Hour : Chapter 3

Arrays are different from collections. Arrays have items of only one data type. Collections can store values of a variety of data types. Solid Edge is made up of Objects with Methods and Properties.

It is a good idea to create a new folder per project and keep all frm, vbp, etc. files in it. Also create another resources folder to store bmps, icons, etc .

Chapter 4
The Solid Edge Object Model

Solid Edge itself is a huge object with lots of properties and methods. The Object is arranged in a hierarchical fashion where Solid Edge is at the top, followed by different environments like Part, Draft, Assembly. The Sheetmetal object is a part of the Part object (with no pun intended), while the Weldment and Mold Tooling environments are parts of the Assembly object. Further, the Draft object has further siblings like Sheets collection and a Sheet collection has a Sheet object. A Sheet object may have View object and Line object and Selection Sets. A Line object may further have properties like StartPoint, Endpoint, Width and methods like Extend, Rotate, Delete or Duplicate.

The whole Solid Edge object model can be visualized like a human skeleton, where the Solid Edge Application object is at the top.

Once Again, you have the Application bone at the top which is the Solid Edge object. This way you understand how critical it is to have the Solid Edge bone intact. The application – if it crashes – the remaining bones become useless.

Tomorrow you will learn more on how to prevent the Solid Edge bone from crashing. This way, build a habit of thinking bottom-up wherein, say, you want to access the EndPoint of a line in a draft document. Here, the reverse hierarchy would be EndPoint-Line-Lines2DSheet-Sheets-DraftFile-SolidEdge Accordingly variables can be declared and you will see the actual coding tomorrow.

To directly locate a bone (object or property), Solid Edge provides extensive help. Click Help > Programming with Solid Edge and take the Search Tab. Type get endpoint in the search box and press Enter. You will get topics on Endpoint for various objects like a line, arc, axes, etc. This way you can narrow down to a specific item in the help. Or you may take the Contents tab and select Visual Basic examples. Keep on double-clicking till you reach the desired program – for e.g. VB Examples – Draft – Line2D – Line2D.GetEndPoint

Further Reading for Chapter 4
Inside the VB IDE, press F2 to bring up the Object Browser.

The Object Browser provides more information than the Help, Reference dialog or any other picture might give. Here you can again search for the word endpoint and get complete information on which object does it belong to (see the last item in green color). The Object Browser also shows the properties and methods of other objects and sub-objects beneath them. The Object Browser is just like the folder browser where in you can traverse the objects like in a tree structure like the Windows Explorer.

Closing Hour : Chapter 4

Solid Edge is a giant object with lots of Properties and Methods. The Solid Edge object is arranged in a hierarchical method. To access an object it is required to traverse the complete hierarchy up to the Solid Edge application object. Pressing F2 shows the Object Browser which helps in finding more information about an object.

Related Topics

We can write a custom essay

According to Your Specific Requirements

Order an essay
Materials Daily
100,000+ Subjects
2000+ Topics
Free Plagiarism
All Materials
are Cataloged Well

Sorry, but copying text is forbidden on this website. If you need this or any other sample, we can send it to you via email.

By clicking "SEND", you agree to our terms of service and privacy policy. We'll occasionally send you account related and promo emails.
Sorry, but only registered users have full access

How about getting this access

Your Answer Is Very Helpful For Us
Thank You A Lot!


Emma Taylor


Hi there!
Would you like to get such a paper?
How about getting a customized one?

Can't find What you were Looking for?

Get access to our huge, continuously updated knowledge base

The next update will be in:
14 : 59 : 59