Draw p-cad error dbx32.dll

draw p-cad error dbx32.dll

This symbol appears in this document to draw your attention to information relevant to the subject in hand. The following warning notes with varying degrees. n]#$a_inco[x]#$a_inse#$a_inse(d),#$a_inse(p)#$a_inse)#$a_inse,#$a_inse. error#$ma_gantry_axis_type#$ma_gantry_axis_type:#$ma_gantry_axis_type=#$. n]#$a_inco[x]#$a_inse#$a_inse(d),#$a_inse(p)#$a_inse)#$a_inse,#$a_inse. error#$ma_gantry_axis_type#$ma_gantry_axis_type:#$ma_gantry_axis_type=#$.

Are certainly: Draw p-cad error dbx32.dll

Draw p-cad error dbx32.dll
Draw p-cad error dbx32.dll
Lockinfo plugin + sub-process error
HTTP ERROR 500 INTERNAL TO SERVOR IS
SPAWN NOT FOUND ERROR

1 P-CAD DBX Programmer's Interface User Guide and Reference This is the User Guide and Reference Manual for the P-CAD Database Exchange (DBX) Programmer's Interface. The P-CAD DBX interface allows you to create custom reports, CAM output, and utility functions by writing user programs that retrieve design data from an active P-CAD PCB or Schematic design session. The DBX interface also allows you to modify an P-CAD P-CAD PCB or Schematic design by placing new design objects or modifying properties of existing objects. Draw p-cad error dbx32.dll, DBX provides the capability to read and write specific data terrorist threat levels in russia P-CAD Library Manager and P-CAD Library Executive. This User Guide and Reference includes general user information, programming hints, definition of the functional interface and its data structures, and some basic examples. This document is formatted so that it is suitable for both viewing on your screen and printing hardcopies. To print this document, choose the File Print command while this document is loaded in Microsoft Word or WordPad. The first-time user should read Section 1 for an overview of P-CAD DBX and its capabilities. Then, when you are ready to write your first user program, skim Sections 2 through 7 to learn the key aspects and features of the interface, what data is available, and how to manipulate it. Section 8 provides an overview of project development, with Section 8.4 and 8.5 including Visual Basic and C++ specifics. Examples are provided in Section 8.6, and online. Referring to these examples, and copying the examples to use as a starting point is highly recommended. Important Information about P-CAD 2004 Version The supplied DBX32.H and DBX32.BAS source files have been updated. For your existing applications you need to recompile and relink your source programs using draw p-cad error dbx32.dll supplied DBX32.H (for C or C++ programs) or DBX32.BAS (for Visual Basic programs). Layer Stackup Support (PCB): Support has been added for the new layer stackup data. This includes one new data structure TLayerStackup. Contained within are four char arrays; layername, layermaterial, layerthickness, layerdialectricconstant. With the data structure are two functions TGetFirstLayerStackup and TGetNextLayerStackup for fetching the data. Layer and Sheet Suppor (PCB/Schematic): Two new functions, TAddLayer and TAddSheet have been added to allow creation of layers/sheets in a design. Pad and Via Style Support: Four new functions were added to support retrieving pad and via style data. They are: TGetFirstPadStyle, TGetNextPadStyle, TGetFirstViaStyle, and TGetNextViaStyle. Copyright 2006 Altium Limited i

2 Contents 1 Introduction to DBX What is P-CAD DBX? Document Conventions Data Overview Functional Overview Retrieving Net Data - A Brief Example Modifying Components - A Brief Example Interface Summary Function Naming Conventions Status and Error Returns Stateful Functions Declaring User Data Using P-CAD DBX-Supplied Structures The P-CAD DBX TItem Using a TItem to Modify Design Data Database Units vs. User Units Default Item Origins for Modify Operations DBX Conversation Structure tcontext Opening, Closing, and Saving a Design Retrieving Data - PCB Extracting General Design Data Extracting Layers and Layer Data Extracting Layer Items Extracting Nets and Net Data Extracting NetClasses and NetClass Data Extracting ClassToClass Data Extracting Net Nodes and Net Items Extracting NetClassNets and Net Data Extracting Components and Component Data Extracting Component Pad and Pattern Data Extracting Pad, Via, draw p-cad error dbx32.dll, and Text Style Data Extracting Pad and Via Shape Data Extracting Rooms and Room Data Extracting Room Points Extracting Room Components Extracting Grids and Grid Data Extracting Attributes Extracting Polygon Points Extracting Items from the Current Selection Set Extracting Print Jobs Extracting Layer Stackup ii

3 3.

4 5.

5 8 Building a User Program DBX32.H and DBX32.BAS Unit Conversion Utilities Status and Error values Using Visual Basic as a Development Environment for DBX Overview Creating a project Including DBX32.BAS Adding User Code Using Existing Basic Programs String Handling Executing the Program Using Visual C++ as a Development Environment for DBX Overview Installing Visual C Creating a project Setting the Project Options Including DBX32.H Linking to DBX32.DLL and DBX32.LIB Adding User Code Executing the Program Examples Opening and closing a design Retrieving layer and component data Retrieving specific item data Common Run-time Errors Running a DBX User Program with P-CAD Online Sample Programs Upgrading DBX Programs Appendix A: DBX Data Constants Appendix B: P-CAD DBX Data Types and Globals Appendix C: P-CAD DBX Functions v

6 1 Introduction to DBX 1.1 What is P-CAD DBX? P-CAD DBX is a programmatic interface that allows you to retrieve or modify design data from an active P-CAD PCB or Schematic design using your own Visual Basic, C, or C++ programs. Data is retrieved from the design by making P-CAD DBX library function calls, draw p-cad error dbx32.dll. Design data is modified by making DBX library function calls with PCB design data items as input. Similarly, there is a DBX interface to the Component Library Manager and Library Executive. By using the Draw p-cad error dbx32.dll DBX interface, you can create interactive design query functions, custom report generators, or custom design file output. You can also create custom applications that make modifications to the active design based on your own specific design needs. Since the interface communicates directly with an active P-CAD design session, your DBX user programs can perform custom database queries and modifications as you design, without the need to generate intermediate files that your program must then parse, interpret, and modify. Your DBX user program can extract or modify as much, or as little, detailed information as is needed, draw p-cad error dbx32.dll. The P-CAD DBX Programmer's Interface includes a functional interface (a "function library"), pre-defined data structures, support files and utilities, examples, and a user guide. This interface may be called by any Windows application that can reference Windows Dynamic Link Libraries (DLLs). Developing DBX applications using either the Visual Basic or Visual C++ development environment is described in this manual. It is recommended that programmers less familiar with developing Windows applications use either Visual Basic or the Windows application development environment with which you are already familar. By using one of the Windows development environments available and the supplied code samples provided with P-CAD DBX, novice and experienced programmers alike will find this a convenient, yet extremely flexible tool to enhance your development process. This guide provides an overview that describes the use of two prevalent Windows development environments: Visual Basic and Visual C Document Conventions P-CAD supplied functions and datatype names are bolded. Function parameters, when referred to within the body of the text of draw p-cad error dbx32.dll manual, are shown in italics. Filenames are shown in CAPITAL letters. User variables and structure member data are shown in lower case, with all words capitalized except the first word. 1.3 Data Overview The P-CAD DBX Programmer's Interface provides direct access to all key PCB, Schematic, and Library data. DBX programs may retrieve and modify PCB and Schematic design information about the current design: layers, sheets, nets, components, draw p-cad error dbx32.dll, pads, vias, styles, symbols, component patterns, connections, routed 1

7 traces, draw p-cad error dbx32.dll, polygons, pours, text items, netclasses, class to class rules, rooms, grids and attributes. DBX programs may retrieve and modify Library Manager or Library Executive library objects, including components, symbols, and patterns. Predefined data structures and data types are provided for easy retrieval and access to the specific data defining these items. These data structures are provided as Visual Basic User Defined Types for Visual Basic user programs, and as C structures for C and C++ user programs. An example is the TNet structure defined in Visual Basic as the User Defined Structure TNet: Type TNet netid as Long netname as String*DBX_MAX_NAME_LEN nodecount as Long; length as Long; isplane as Long; TNet; and in C as a structure Typedef TNet: typedef struct { netid; char netname[dbx_max_name_len]; nodecount; length; isplane; } TNet; TArc, TAttribute, TClassToClass, TComponent, TDesign, Tgrid, TLine, TLayer, TNetClass, TPad, TPadViaShape, TPadViaStyle, TPin, TPoly, TPour, TRoom, TSymbol, TText, TTextStyle, and TVia are defined similarly. An overview of the data and functions to retrieve the data returned in these structures is provided in Sections 3 through 7 of this document. Note that many data items and function calls are shared between PCB, Schematic and Library Manager, with Library Manager and Library Executive being identical. This helps simplify the interface, and makes it possible for some DBX programs to be written such that they access multiple P-CAD products without any changes or a recompile. The actual structure definitions, types, and sizes are provided for reference in Appendix B. User programs reference the data in the predefined structures by declaring a DBX item and examining or assigning values to the individual data elements within the structure. An example of declaring a TNet item and accessing TNet data is given in Section Functional Overview The P-CAD DBX interface provides the ability to extract or modify complete design information, yet is still easy to use and flexible enough to satisfy a variety of user needs. Function input arguments are simple, with consistent, predefined data output formats returned by each function. Each function call returns a status value indicating success or failure, draw p-cad error dbx32.dll, and if failure, draw p-cad error dbx32.dll, what type of failure. The P-CAD DBX interface retrieves data in a top-down fashion. In other words, highlevel functions provide high level data, with subsequent calls available to access more 2

8 detailed and in-depth data. The interface additionally uses a "get first", "get next" approach to return design data with a variable number of items. This approach eliminates the need to define large arrays and data structures within your program to hold potentially large amounts of data, where the size of the array would be dependent on the size of the design being accessed, draw p-cad error dbx32.dll. For example, functions returning P-CAD PCB net data, net items, and net nodes are: TGetFirstNet TGetNextNet TGetNetById TGetNetByName TGetFirstNetItem TGetNextNetItem TGetFirstNetNode TGetNextNetNode Design modification and updates draw p-cad error dbx32.dll performed by function calls that have a DBX item as input to the function. Input to these functions are the same DBX items that are returned by the data extraction function calls. For example, functions to modify an existing PCB component are: TFlipComponent TMoveComponent TRotateComponent THighlightComponent TUnHighlightComponent TModifyComponent TDeleteComponent and to place or delete a component: TPlaceComponent TDeleteComponent The next sections provide an example of how these functions and DBX data types may be used. 1.5 Retrieving Net Data - A Brief Example Retrieving data about an P-CAD PCB net is an example demonstrating this type of interface and how the interface is used. Function TGetFirstNet and TGetNextNet return general net data for a P-CAD PCB net including net length, number of nodes, and the net name. The output data is returned in a P-CAD DBX data structure called TNet. If you were interested in the length of the net, for example, your program would declare a DBX item anet as a TNet structure, and examine anet.length, a member of the DBX item anet. In addition, if your program needed to retrieve data on the nodes which define the net, a call maybe made to TGetFirstNetNode to retrieve the first node in the net, followed by 3

9 calls to TGetNextNetNode for each subsequent node in the net, until either all nodes have been retrieved or you have located a particular node of interest. In this way a user program may be written to access all nodes in a net (or all nets, for that matter) without knowing in advance what the largest net to be handled is expected. The following examples find the length of the est net in the current P-CAD PCB design. Using Visual Basic: Dim mynet as TNet Dim maxnetlength as Long status = TGetFirstNet(tContext,myNet) maxnetlength = mynet.length Do While (tstatus == DBX_OK) tstatus = TGetNextNet(tContext,myNet) if (mynet.length > maxnetlength) then maxnetlength = mynet.length endif Loop Using C: TNet mynet; maxnetlength; status = TGetFirstNet(tContext,myNet); maxnetlength = mynet.length; while (tstatus == DBX_OK) { tstatus = TGetNextNet(tContext,myNet); if (mynet.length > maxnetlength) { maxnetlength = mynet.length; } } Variables tstatus and tcontext are explained in Section 2.2, 2.9 and Complete examples are provided in Section 8.6, and in the online sample programs included with your P-CAD DBX installation files. The online sample programs are described draw p-cad error dbx32.dll Section 10 of this manual. 1.6 Modifying Components - A Brief Example Retrieving all of the components in a PCB design and flipping each component that meets a certain criteria is an example of modifying active design data. Functions TGetFirstComponet and TGetNextComponent return general component data for an P-CAD PCB component including component type, refdes, pattern name, number of pins, library, location and orientation. The output data is returned in a P-CAD DBX data structure called TComponent. If you were interested in the component type, 4

10 for example, your program would declare a DBX item acomponent as a TComponent structure, and examine acomponent.comptype, a member of the DBX item acomponent. In addition, if your program needed to retrieve and modify the component pads, calls to GetFirstCompPad and GetNextCompPad, followed by the appropriate function call to modify each pad would update the component's pads. The following example retrieves all of the design components, and flips the component if the component is of type Using Visual Basic: Dim mycomponent as TComponent status = TGetFirstComponent(tContext,myComponent) Do While (tstatus == DBX_OK) if (trim(mycomponent.comptype) = "7400") then status = TFlipComponent(tContext,myComponent) if (status <> DBX_OK) then go to ErrorHandler endif tstatus = TGetNextComponent(tContext,myComponent) Loop Using C or C++: TComponent mycomponent; status = TGetFirstComponent(tContext,myComponent); while (tstatus == DBX_OK) { if (stricmp(mycomponent.comptype,"7400")==0) { status = TFlipComponent(tContext,myComponent); if (status!= DBX_OK) { break; } tstatus = TGetNextComponent(tContext,myComponent) } } Variables tstatus and tcontext are draw p-cad error dbx32.dll in Sections 2.2, 2.9, and Complete examples are provided in Section 8.6, and in the online sample programs included with your P-CAD DBX installation files. The online sample programs are described in Section 10 of this manual. 5

11 2 Interface Summary This section provides an overview of some of the fundamental aspects and features of the P-CAD DBX interface, draw p-cad error dbx32.dll. Specific details on item definitions, sizes, and values are listed in Appendix B. Function syntax and parameters are described in Appendix C. Mnemonic constants mentioned in this section are listed in Appendix A, draw p-cad error dbx32.dll. All of the information presented in Appendices A-C may be found online in the file DBX32.H. 2.1 Function Naming Conventions All P-CAD DBX functions are prefaced with the capital letter 'T', draw p-cad error dbx32.dll. This convention helps to distinguish P-CAD-supplied DBX functions from your user function and program names. In addition, the first letter of each word in the function name is capitalized. Visual Basic is not case sensitive, so this capitalization convention may be followed or ignored based on your own preference. For 'C' programs, however, the case must be observed or the functions will be listed as "undeclared" at compile time. 2.2 Status and Error Returns All P-CAD DBX functions return a completion status value. This status is an integer value. For ease of use, each value is represented by a mnemonic constant declared in DBX32.H and DBX32.BAS. Draw p-cad error dbx32.dll status constants are prefaced by "DBX_", (for example, DBX_ITEM_NOT_FOUND) and are grouped according to completion status and severity of the error, draw p-cad error dbx32.dll. The value of DBX_OK is zero. All other return values are non-zero, beginning at This convention will allow non-zero status checking by 'C' programs, and direct use of the Visual Basic error handling tools without conflicting with pre-defined Visual Basic error return values. Note that many of these non-zero status values returned are not necessarily errors. They may indicate normal operating conditions, like DBX_NO_MORE_ITEMS, for example. A complete list of all status values may be found in DBX32.H or DBX32.BAS. A global variable tstatus has also been declared in both DBX32.H and DBX32.BAS. This variable may be used directly by your user program, as is shown in the following examples. 2.3 Stateful Functions Any function prefaced by "GetNext" indicates that it is a stateful function, retrieving the next sequential data item from the list of related data items being retrieved. Layer and Net functions return items in order of layer number and Net ID. Other functions return items in the order the items are stored in the P-CAD database. Except for layers and nets, this order is design dependent and should not be assumed to be consistent from DBX program session to session. Function calls which set the internal program state to a particular item in the sequence are those prefaced by "GetFirst". A GetFirst function must be called prior to calling any GetNext function or the error status DBX_GETFIRST_NOT_CALLED will be returned. 6

12 GetNext functions can be called after a GetFirst function call and will return the next sequential item after the GetFirst or GetBy item returned. 2.4 Declaring User Data Using P-CAD DBX-Supplied Structures There are two P-CAD supplied files providing structure definitions you may use directly within your user program to define local variables and structures. The files are DBX32.H and DBX32.BAS. DBX32.H includes C structure typedefs, and is used by user programs written in C or C++. DBX32.BAS includes Visual Basic Declare Type definitions, and is used by user programs written in Visual Basic. For example, to declare a local DBX item mynetdata to be used with the TGetFirstNet function, you would use: Dim mynetdata as TNet in the declarations section of a Visual Basic program, or TNet mynetdata; in the declarations section of a C program. In either language, the local DBX item and its member data are accessed and named identically. As in the previous example, to access the net length of a net after a Get*Net call, you would use the syntax: mynetlength = mynetdata.length; (no semi-colon in VB) As with other supported datatypes, you can declare arrays of DBX items. Continuing with the net data example, to declare an array of 100 TNet items, you would use the following syntax: Dim mynetarray as TNet(100) (from Visual Basic) TNet mynetarray[100]; (from C) 2.5 The P-CAD DBX TItem The P-CAD DBX structure TItem is used to create a special type of DBX item. It is used to declare a DBX item that can receive data from functions that may return one of many types of design items. For example, TGetFirstLayerItem and TGetNextLayerItem functions accessing a PCB design may return an arc, component, line, pad, draw p-cad error dbx32.dll, point, polygon, copper pour, text, or a via on a single call. The P-CAD DBX TItem structure eliminates the need for your program to know in advance what type of item is about to be returned from a function by defining a structure which can represent each of these different item types. It is also defined so that the structure elements have easy to reference data elements with consistent meanings regardless of the type of item it contains. Dim myitem As TItem (for Visual Basic) TItem myitem; (for C) After extracting a DBX item, you can access the TItem data directly. To examine the 7

13 radius of an arc returned by TGetNextLayerItem, for example, you could use the following statement: status = TGetNextLayerItem(tContext, myitem) arcradius = myitem.arc.radius Alternatively, the item returned can be copied directly to a local DBX item, in this case an arc item, and the arc specific information retrieved from the local DBX item myarc by: Dim myitem As TItem (for Visual Basic) Dim myarc as TArc status = TGetNextLayerItem(tContext, myitem) myarc = myitem.arc arcradius draw p-cad error dbx32.dll myarc.radius Either approach will generate identical results. The former is preferred if only a select amount of information is needed, while the latter is generally more convenient if you will be using the data from this particular arc in many places or referencing the data many times, since it requires less typing. The items returned by these functions are: arc attribute bus ClassToClass CompPin component Design detail diagram field grid layer line metafile net NetClass pad PadViaShape PadViaStyle Pattern pin point Poly port pour PrintJob Room symbol table text TextStyle via wire 8

14 The TItem structure includes a field which is present for all item types returned: itemtype. This field is an integer value indicating what type of item has been returned in the TItem structure. By using this value after a get Item function call (e.g. GetFirstLayerItem), you draw p-cad error dbx32.dll determine what type of item has been returned and process the data appropriately. These item types are enumerated in both DBX32.H and DBX32.BAS. For ease of use, readability, and future program compatibility, we strongly recommend that you draw p-cad error dbx32.dll the mnemonic constants within your program and not the integer values they represent. For example, to determine if the item returned is an arc item: if myitem.itemtype = DBX_ARC if myitem.itemtype = 3 ' Right ' Wrong You can declare arrays of TItem items, but due to the size requirements for TItem, you should not declare large arrays of TItems, but declare arrays of the specific DBX item type you intend to keep instead, an array of TLine items, for example. 2.6 Using a TItem to Modify Design Data Several functions are available to modify PCB design data using a TItem directly as an input argument. This provides a mechanism to generically retrieve and modify a set of items without specifically writing code to make different DBX Modify calls based on the type of item retrieved. This is especially useful when using calls that return a TItem like GetFirstNetItem and GetNextNetItem, followed by a DBX Modify call to update those items regardless of the item type. For example, to retrieve all of the items in a specific net and highlight those items, draw p-cad error dbx32.dll, you would use the GetFirstNetItem/GetNextNetItem calls followed by a call to THighlightItem with the extracted TItem as input to the highlight call. The generic DBX Modify item functions are: TFlipItem TMoveItem TModifyItem TRotateItem THighlightItem TUnHighlightItem TDeleteItem 2.7 Database Units vs, draw p-cad error dbx32.dll. User Units All functions returning or requiring size, location, length, width, or rotation values use values in database units. Using database units preserves database accuracy, and allows user programs to work in gta san andreas runtime error hatas unit of choice: database, mils, millimeter, or user defined. Database units are defined as 2540 database units per mil, and database units per mm. Rotation values are represented at the ratio of 10 database units per degree of rotation (in other words, 3600 database units is equivalent to 360 degrees). As a convenience, DBXUTILS.H (for C and C++user programs) and DBXUTILS.BAS (for Visual Basic user programs) provide utility functions that convert database units to and from mils and mm, both as numbers and as strings. 9

15 2.8 Default Item Origins for Modify Operations DBX Flip and Rotate functions have an optional parameter to specify the point about which to flip or rotate the item. If this point is not specified (by setting the x and y coordinate values of the rotate or flip point to -1) a default item origin is used for the operation. The default origin depends on the type of the item being flipped or rotated and is as follows in the form (x,y): Arc: (centerpt.x, centerpt.y) Attribute: (refpoint.x, refpoint.y) Bus: (startpt.x, startpt.y) Component: (refpoint.x, refpoint.y) Field: (refpoint.x, refpoint.y) Line: (startpt.x, startpt.y) Free Pad or Via: (center.x, center.y) Pin: (refpoint.x, refpoint.y) Point: (point.x, point.y) Port: (point.x, point.y) Symbol: (refpoint.x, refpoint.y) Table: (refpoint.x refpoint.y) Text: (refpoint.x, refpoint.y) Wire: (startpt.x, draw p-cad error dbx32.dll, starrtpt.y) The default flip or rotate point can be overridden by specifically setting the appropriate input argument to the function to have the coordinates of the flip or rotate point. See sections 5.1, 5.2, 6.1, and 6.2 for more information on how to do this. 2.9 DBX Conversation Structure tcontext P-CAD DBX user programs communicate with P-CAD applications using Windows Dynamic Data Exchange (DDE) protocols. Using this protocol allows DBX programs to communicate directly with an active P-CAD application during a design session. The DDE protocol requires certain conversation identification information each time one process communicates with another. This information is returned draw p-cad error dbx32.dll TOpenDesign (TOpenLibrary in P-CAD Library Manger) in a P-CAD supplied structure called TContext, and must be passed to each DBX function call after the TOpenDesign call. For convenience, a global variable tcontext is provided in DBX32.H and DBX32.BAS and may be used directly by your user program to receive and maintain this information. The global variable tcontext is used throughout this manual and in the samples provided with your P-CAD DBX installation. Opening and closing a library is detailed in section Opening, Closing, and Saving a Design You establish a connection between your user program and the PCB or Schematic design session by "opening" a design. To open the design, you use the function TOpenDesign, providing some basic information: the version of the P-CAD DBX software you are using, and the type of language you are using to write your user program, and the P-CAD application name, draw p-cad error dbx32.dll, either "pcb" or "sch". TOpenDesign returns the P-CAD-supplied TContext structure tcontext, which describes the connection you just established. This TContext structure must be used in all subsequent DBX function 10

16 calls to identify the DBX conversation. For example, to open the current P-CAD PCB design: TOpenDesign(DBX_LANGUAGE, DBX_VERSION, pcb,tcontext) DBX_VERSION and DBX_LANGUAGE are constants provided by P-CAD DBX and may be used exactly as written here. Also defined in DBX32.H and DBX32.BAS is tcontext, a global variable which may also be used exactly as written here, and in subsequent function calls, to accept and maintain the conversation context information. The 3rd argument to TOpenDesign, the P-CAD Application:Design name, should have a value of either "pcb" or "sch" to signify which P-CAD application to open. To provide easier migration of TangoPRO DBX programs to P-CAD, using an empty string ("") for the application name will open P-CAD PCB by default. Optionally, a colon followed by the full path and design file name may be specified. For example, pcb:c:\p- CAD\files\demo2.pcb,may be used to open the c:\p-cad\files\demo2.pcb design file in P-CAD PCB. If no design file name is specified, then the current design in the P-CAD application is used. If the design file name matches an existing open design, then that design will become the current design. If delphi removedir error 145 design file name does not specify an existing file or there are any errors while loading the design then DBX_FILE_OPEN_FAILURE will be returned. To save the current design, use TSaveDesign. This will write the current design to the file it was loaded from. If the current design is Untitled, you will be prompted by the P- CAD application for the file name to save to. The design will always be saved even if no changes have been made. To determine if the current design has been modified, see TGetDesignInfo s ismodified flag. To end your DBX session, use TCloseDesign. Note that tcontext is the global structure returned by TOpenDesign. TCloseDesign(tContext,"") If the empty string ( ) is specified for the second argument then the connection is closed but the design is left open in the P-CAD application. Draw p-cad error dbx32.dll you may specify FileClose as the second argument to close the connection to the P-CAD application and close the design also. Important: TCloseDesign will not save the design even if changes have been made. A DBX conversation with P-CAD PCB or Schematic may also be terminated by clicking Cancel on the dialog which is presented in the design window when your DBX program begins executing. Using TCloseDesign is the preferred method, but the Cancel dialog is useful should your DBX program terminate abnormally or find itself in an infinite loop from which you cannot exit. The Cancel dialog will return P-CAD PCB or Schematic to a state from which you can safely continue your PCB design session. For information about Library DBX see sections 7.1 on opening and closing a component library. 11

17 3 Retrieving Data - PCB This section provides a summary of the interface functions and data returned by P-CAD DBX PCB functions when retrieving P-CAD PCB design information. The functions are grouped by the type of data they retrieve. For a detailed description of each function, its arguments, or P-CAD DBX structure contents, see DBX32.H, or the appendices at the end of this manual, draw p-cad error dbx32.dll. To enable code sharing between DBX applications used for PCB, Schematic, and Library Manager or Library Executive, function calls and DBX items are intentionally similar where possible. 3.1 Extracting General Design Data General design information is retrieved using the function TGetDesignInfo(tContext,designInfo) where tcontext is the structure returned by TOpenDesign, draw p-cad error dbx32.dll. Design data is returned the structure designinfo, which you declare as type TDesign. The TGetDesignInfo function returns general board information including the board size, workspace extents, relative grid origin, design name, title, author, version, date and modified flag. 3.2 Extracting Layers and Layer Data Four functions return layer data. Layer data is returned in the DBX item mylayerdata, which you declare as type TLayer. TGetFirstLayer(tContext,myLayerData) TGetNextLayer(tContext,myLayerData) TGetLayerById(tContext,layerId,myLayerData) TGetLayerByName(tContext,layerName,myLayerData) Layer functions GetFirstLayer, GetNextLayer, GetLayerById, and GetLayerByName return layer name, layerid, type and bias, clearances, and plane status. 3.3 Extracting Layer Items Two functions return the items being to a P-CAD PCB layer. Item data is returned in the DBX item myitem, which you declare as type TItem. See section 2.5 for a discussion of the TItem structure and its usage. TGetFirstLayerItem(tContext,layerId,myItem) TGetNextLayerItem(tContext,myItem) Layer Item functions GetFirstLayerItem and GetNextLayerItem return PCB design items located on a layer in draw p-cad error dbx32.dll TItem data item. The items returned include arcs, attributes, components, connections, cutouts, details, diagrams, keepouts, lines, draw p-cad error dbx32.dll, metafiles, pads, polygons, points, copper pours, tables, text, and vias. 12

18 3.4 Extracting Nets and Net Data Four functions return net data. Net data is returned in the DBX item mynetdata, which you declare draw p-cad error dbx32.dll type TNet. TGetFirstNet(tContext,myNetData) TGetNextNet(tContext,myNetData) TGetNetById(tContext,netId,myNetData) TGetNetByName(tContext,netName,myNetData) Net functions GetFirstNet, GetNextNet, GetNetById, draw p-cad error dbx32.dll, and GetNetByName return net name, netid, net length, number of nodes, and plane status. 3.5 Extracting NetClasses and NetClass Data Four functions return NetClass data. NetClass data is returned in the DBX item mynetclassdata, which you declare as type TNetClass. TGetFirstNetClass(tContext,myNetClassData) TGetNextNetClass(tContext,myNetClassData) TGetNetClassById(tContext,netClassId,myNetClassData) TGetNetClassByName(tContext,netClassName,myNetClassData) NetClass functions GetFirstNetClass, GetNextNetClass, GetNetClassById, and GetNetClassByName return netclassname, netclassid, number of nets. 3.6 Extracting ClassToClass Data Three functions return ClassToClass data. ClassToClass data is returned in the DBX item myclasstoclassdata, which you declare as type TClassToClass. TGetFirstClassToClass(tContext,myClassToClassData) TGetNextClassToClass(tContext,myClassToClassData) TGetClassToClassById(tContext,netClassId1,netClassID2, myclasstoclassdata) ClassToClass functions GetFirstClassToClass, GetNextClassToClass and GetClassToClassById return NetClassName1, NetClassName2, NetClassID1 and NetClassID2. Note that NetClassID1 must be less than or equal to NetClassID2 in function TGetClassToClassById. 3.7 Extracting Net Nodes and Net Items Four functions return the items and nodes defining a P-CAD PCB Net. Item data is returned in the DBX item myitem, which you declare as type TItem. See Section 2.5 for 13

19 a discussion of the TItem structure and its usage. TGetFirstNetItem(tContext,netId,myItem) TGetNextNetItem(tContext,myItem) TGetFirstNetNode(tContext,netId,myItem) TGetNextNetNode(tContext,myItem) Net Item functions GetFirstNetItem and GetNextNetItem return PCB design items defining a net in a TItem data item. The items returned include arcs, connections, lines, and vias. Net Node functions GetFirstNetNode and GetNextNetNode return PCB design items which are the nodes in the net in a TItem data item. These items include pads. 3.8 Extracting NetClassNets and Net Data Two functions return NetClassNet data. NetClassNet data is returned in the DBX item mynetdata, which you declare as type TNet. TGetFirstNetClassNet(tContext,netClassId,myNetData) TGetNextNetClassNet(tContext,myNetData) NetClassNet functions GetFirstNetClassNet and GetNextNetClassNet return net name, netid, net length, number of nodes, and plane status. 3.9 Extracting Components and Component Data Three functions return component data. Component data is returned in the DBX item mycompdata, which you declare as type TComponent. TGetFirstComponent(tContext,myCompData) TGetNextComponent(tContext,myCompData) TGetCompByRefDes(tContext,compRefDes,myCompData) Component functions GetFirstComponent, GetNextComponent, and GetCompByRefDes return Component ID, refdes, component type, value, pattern name, location, number of pads, bounding box, and orientation information in a TComponent data item Extracting Component Pad and Pattern Data Four functions return the pads and pattern items defining a PCB Component. Pad items are returned in the DBX item mypad, which you declare as type TPad. Pattern item data is returned in the DBX item myitem, which you declare as type TItem. See section 2.5 for a discussion of the TItem structure and its usage. TGetFirstCompPad(tContext,refDes,myPad ) TGetNextCompPad(tContext,myPad) 14

20 TGetFirstCompItem(tContext,refDes,myItem) TGetNextCompItem(tContext,myItem) Pad and Via data returned by Layer Item, Net Item, and Component Pad functions includes location, pad or via style ID, the net ID, rotation, and bounding box information. Data for pads and vias is returned in TPad and TVia data items, respectively. Pad data additionally includes the pad pin number, pin designator, pin type, and component refdes. Component Item functions GetFirstCompItem and GetNextNetCompItem return the PCB design items defining the component pattern in a TItem data item. The items returned include arcs, lines, points, polygons and text Extracting Pad, Via, and Text Style Data Pads, Vias, draw p-cad error dbx32.dll, and Text items each include a StyleId as part of their definition. This StyleId value may be used to get information about a style in general, or more specific information about the current pad/via/text item being examined. There are three functions available to retrieve style information for pads, via, and text. Style information is returned in mypadstyle (or mytextstyle, myviastyle), which you declare as TPadStyle (or TTextStyle, TViaStyle). TGetPadStyle(tContext,padStyleId,myPadStyle) TGetTextStyle(tContext,textStyleId,myTextStyle) TGetViaStyle(tContext,viaStyleId,myViaStyle) Given a StyleId, GetPadStyle and GetViaStyle functions return the style type, style name, hole diameter, and x and y offsets in a TPadViaStyle data item. Note that valid style ids range from 0 to 99 each for text, pad, and via styles. The styles used may not be consecutive, however, so looping through the style ids from 0 until a DBX_STYLE_NOT_FOUND to find all valid styles may stop too soon if there are "holes" in the used style ids. The correct approach is to loop from 0 to 99, recording which styles are valid based on the status returned from the GetStyle function. Another way to loop over pad or via styles is to use TGetFirstPadStyle and TGetNextPadStyle, or TGetFirstViaStyle and TGetNextViaStyle. These functions will skip any holes in the used style ids. Text Style function TGetTextStyle returns the style name, font type, pen width, and text height in a TTextStyle data item Extracting Pad and Via Shape Data There is a significant amount of design data which may be different for each pad, draw p-cad error dbx32.dll, or more accurately, for each pad style on each of the active layers. This is also true for vias. There are two functions available to retrieve layer specific shape data from a pad or via style. Data is returned in mypadshape for pad shapes, and myviashape for vias, which you declare as TPadShape and TViaShape, respectively, draw p-cad error dbx32.dll. TGetPadShapeByLayer(tContext,padStyleId,layerId,myPadShape) TGetViaShapeByLayer(tContext,viaStyleId,layerId,myViaShape) TGetPadShapeByLayer or TGetViaShapeByLayer functions return pad or via style, 15

21 layer type, hole diameter, shape, width, and height (or for thermals: outer diameter, inner diameter and spoke width) in a TPadViaShape data item Extracting Rooms and Room Data Two functions return room data. Room data is returned in the DBX item myroomdata, which you declare as type TRoom. TGetFirstRoom(tContext,myRoomData) TGetNextRoom(tContext,myRoomData) Room functions TGetFirstRoom and TGetNextRoom return room name, room ID, number of included components, boundary rectangle, placement side, is fixed, is flipped, is highlighted, room fill pattern, reference point and rotation angle Extracting Room Points Two functions return room point data. Room point data is returned in the DBX item mypointdata, which you declare as type TPoint, draw p-cad error dbx32.dll. TGetFirstRoomPoint(tContext,roomId,myPointData) TGetNextRoomPoint(tContext,myPointData) Room Point functions TGetFirstRoomPoint and TGetNextRoomPoint return item ID, x, y, point type, number, text info string, layer Id, is flipped, is visible and is highlighted Extracting Room Components Two functions return room component data. Room component data is returned in the DBX item mycompdata, which you declare as type TComponent. TGetFirstIncludedRoomComponent(tContext,roomId,myCompData) TGetNextIncludedRoomComponent(tContext,myCompData) Room component functions TGetFirstincludedRoomComponent and TGetNextIncludedRoomComponent return component Id, reference designator string, component type string, value string, pattern name, library name, reference point, boundary rectangle, rotation angle, number of pads, number of pins, number of parts, is alpha, is flipped, is highlighted, is heterogeneous, connection type and is fixed Extracting Grids and Grid Data Two functions return grid data. Grid data is returned in the DBX item mygriddata, which you declare as type TGrid. TGetFirstGrid(tContext,myGridData) TGetNextGrid(tContext,myGridData) Grid functions TGetFirstGrid and TGetNextGrid return grid ID and grid spacing which is 16

22 a string containing the spacing values separated by a comma Extracting Attributes Fourteen functions return the attributes which are associated with design, layer, net, net class, class to class, room or component. Attribute data is returned in myattr, which you declare as TAttribute. For components, you specify the component refdes using a string variable in Visual Basic, or a Char* in C or C++. For all others specify the ID declared as a. TGetFirstDesignAttribute(tContext, myattr) TGetNextDesignAttribute(tContext, myattr) TGetFirstLayerAttribute(tContext,layerId, myattr) TGetNextLayerAttribute(tContext, myattr) TGetFirstNetAttribute(tContext,netId, myattr) TGetNextNetAttribute(tContext, myattr) TGetFirstNetClassAttribute(tContext, NetClassId,myAttr) TGetNextNetClassAttribute(tContext, myattr) TGetFirstClassToClassAttribute(tContext, NetClassId1, NetClassId2, myattr) TGetNextClassToClassAttribute(tContext, myattr) TGetFirstRoomAttribute(tContext, RoomId,myAttr) TGetNextRoomAttribute(tContext, myattr) TGetFirstCompAttribute(tContext,refDes,myAttr) TGetNextCompAttribute(tContext, myattr) The above functions return type and value strings for oki c5850 srvice call 163 fatall error attribute associated with the class in a TAttribute data item. These attributes also include location, style, and orientation information. Additionally, the layer functions return pre-defined clearance information Extracting Polygon Points Two functions return the points defining a polygon. Point data is returned in mypoint, which you declare as type TPoint. TGetFirstPolyPoint(tContext,polyId,myPoint) TGetNextPolyPoint(tContext,myPoint) TGetFirstPolyPoint and TGetNextPolyPoint return the point location and layer id TPoint data item Extracting Items from the Current Selection Set Two functions return the items in the active design selection set (items you have selected by Block Select or selecting individual items). Item data is returned in selectitem, which you declare as type TItem. TGetFirstSelectedItem(tContext,selectItem) TGetNextSelectedItem(tContext,selectItem) 17

23 Get Selection functions return selected items in a TItem data item. The item types returned in the TItem include arc, attribute, connection, component, draw p-cad error dbx32.dll, cutout, detail, diagram, keepout, line, metafile, pad, point, polygon, pour, table, text, and via Extracting Print Jobs Two functions return the print jobs in the active design. Print job information is returned in ajob, which you declare as type TPrintJob. TGetFirstPrintJob(tContext, ajob) TGetNextPrintJob(tContext, ajob) Print Job functions TGetFirstPrintJob and TGetNextPrintJob return the name of the print job and if it is selected for output during a print operation Extracting Layer Stackup Two functions retrieve the layer stackup information in the active design. Layer stackup information is returned in pstackup, which you declare as type TLayerStackup. TGetFirstLayerStackup(tContext, pstackup) TGetNextLayerStackup(tContext, pstackup) Layer Stackup functions TGetFirstLayerStackup and TGetNextLayerStackup return a TLayerStackup struct that contains the layername, layermaterial, layerthickness, and layerdialectricconstant Extracting Variants These methods are used for retrieving all the existing Variants in a design. TGetFirstVariant(DbxContext* pcontext, TVariant* pvariant) TGetNextVariant(DbxContext* pcontext, TVariant* pvariant) Variant functions TGetFirstVariant and TGetNextVariant return TVariant structure that contains the Variant name, description, and id. 18

24 4 Retrieving Data - Schematic This section provides a summary of the interface functions and data returned by P-CAD DBX functions when retrieving P-CAD Schematic data. The functions are grouped by the type of data they retrieve. For a detailed description of each function, its arguments, or P-CAD DBX structure contents, see DBX32.H, or the appendices at the end of this manual. To enable code sharing between DBX applications used for PCB, Schematic, and Library Manager or Library Executive, function calls and DBX items are intentionally similar where possible. 4.1 Extracting General Design Data General design information is retrieved using the function TGetDesignInfo(tContext,designInfo) where tcontext is the structure returned by TOpenDesign. Design data is returned the structure designinfo, which you declare as type TDesign. The TGetDesignInfo function returns general design information including the design size, workspace extents, draw p-cad error dbx32.dll, relative grid origin, design name, title, author, version, and date, draw p-cad error dbx32.dll. 4.2 Extracting Sheets and Sheet Data Four functions return sheet data. To provide consistency between the PCB and Schematic interfaces, draw p-cad error dbx32.dll, sheet and sheet data are referenced as Layers. Sheet data is returned in the DBX item mylayerdata, which you declare as type TLayer. TGetFirstLayer(tContext,myLayerData) TGetNextLayer(tContext,myLayerData) TGetLayerById(tContext,layerId,myLayerData) TGetLayerByName(tContext,layerName,myLayerData) Layer functions TGetFirstLayer, Connectify cf001006error configuration hotspot, TGetLayerById, and TGetLayerByName return the sheet name (sheet description) as layer name and the sheet number as layerid. layerid zero is returned, but not useable. Schematic DBX applications should skip to layerid Extracting Sheet Items Two functions return the items on a Schematic sheet. To provide consistency between the PCB and Schematic interfaces, sheet and sheet data are referenced as Layers. Item data is returned in the DBX item myitem, which you declare as type TItem. See section 2.5 for a discussion of the TItem structure and steamstartvalidatinguseridticket esteamerror 25 usage. TGetFirstLayerItem(tContext,layerId,myItem) TGetNextLayerItem(tContext,myItem) Layer Item functions TGetFirstLayerItem and TGetNextLayerItem return Schematic 19

25 design items located on a sheet in a TItem data item. The items returned draw p-cad error dbx32.dll arcs, attributes, buses, fields, info points, lines, pins, ports, ref points, symbols, table, text, and wires. 4.4 Extracting Nets and Net Data Four functions return net data. Net data is returned in the DBX item mynetdata, which you declare as type TNet. TGetFirstNet(tContext,myNetData) TGetNextNet(tContext,myNetData) TGetNetById(tContext,netId,myNetData) TGetNetByName(tContext,netName,myNetData) Net functions TGetFirstNet, TGetNextNet, TGetNetById, and TGetNetByName return net name, netid, and number of nodes. 4.5 Extracting NetClasses and NetClass Data Four functions return NetClass data. NetClass data is returned in the DBX item mynetclassdata, which you declare as type TNetClass. TGetFirstNetClass(tContext,myNetClassData) TGetNextNetClass(tContext,myNetClassData) TGetNetClassById(tContext,netClassId,myNetClassData) TGetNetClassByName(tContext,netClassName,myNetClassData) Net functions TGetFirstNetClass, TGetNextNetClass, TGetNetClassById, and TGetNetClassByName return netclassname, netclassid, number of nets. 4.6 Extracting ClassToClass Data Three functions return ClassToClass data. ClassToclass data is returned in the DBX item myclasstoclassdata, which you declare as type TClassToClass. TGetFirstClassToClass(tContext,myClassToClassData) TGetNextClassToClass(tContext,myClassToClassData) TGetClassToClassById(tContext,netClassId1,netClassID2,myClassTo ClassData) Net functions TGetFirstClassToClass, TGetNextClassToClass and TGetClassToClassById return netclassname1, netclassname2, netclassid1 and netclassid2. Note that in function TGetClassToClassById NetClassID1 must be less than or equal to NetClassID2. 20

26 4.7 Extracting Net Nodes and Net Items Two functions return the items defining a P-CAD Schematic Net. Item data is returned in the DBX item myitem, which you declare as type TItem. See Section 2.5 for a discussion of the TItem structure and its usage. TGetFirstNetNode(tContext,netId,myItem) TGetNextNetNode(tContext,myItem) Net Node functions TGetFirstNetNode and TGetNextNetNode return Schematic design items which are the nodes in the net in a TItem data item. These items are pins. 4.8 Extracting NetClassNets and Net Data Two functions return NetClassNet data. NetClassNet data is returned in the DBX item mynetdata, which you declare as type TNet. TGetFirstNetClassNet(tContext,netClassId,myNetData) TGetNextNetClassNet(tContext,myNetData) NetClassNet functions GetFirstNetClassNet and GetNextNetClassNet return net name, netid, net length, number of nodes, and plane status. 4.9 Extracting Components and Component Data Three functions return component data, draw p-cad error dbx32.dll. Component data is returned in the DBX item mycompdata, which you declare as type TComponent. TGetFirstComponent(tContext,myCompData) TGetNextComponent(tContext,myCompData) TGetCompByRefDes(tContext,compRefDes,myCompData) Component functions TGetFirstComponent, TGetNextComponent, and TGetCompByRefDes return Component ID, refdes, component type, value, pattern name, number of pins, number of parts, isalpha, ishetero, and connection type information in a TComponent data item Extracting Component Pin and Symbol Data Six functions return pin and symbol data. Symbol items are returned in the DBX item mysymbol, which you declare as type TSymbol. Pin data is returned in the DBX item mypin, which you declare as type TPin. The component is specified by a character string, refdes. This is the component, not the symbol, refdes (e.g. U1). TGetFirstCompPin(tContext,refDes,myPin) TGetNextCompPin(tContext,myPin) TGetFirstCompSymbol(tContext,refDes,mySymbol) TGetNextCompSymbol(tContext,mySymbol) 21

27 TGetCompSymbolByPartNumber(tContext,refDes,PartNo,mySymbol) TGetCompSymbolByRefDes (tcontext,refdes,mysymbol) Symbol data returned includes the symbol Id, name, symbol refdes (e.g. U1:A), number of pins, part number and alternate type. Pin data returned in mypin includes the pin item Id, pin number, symbol part number, component refdes (e.g. U1), pin pindes (e.g. 1), pin type, outside and inside style and edge styles, net Id, gate equivalence value, and pin equivalence value Extracting Symbol Pin Data Two functions return symbol pin data. Pin data is returned in the DBX item mypin, which you declare as type TPin. The symbol is specified by a character string, refdes. This is the full symbol refdes (e.g. U1:A). TGetFirstSymbolPin(tContext,refDes,myPin) TGetNextSymbolPin(tContext,myPin) Pin data returned in mypin includes the pin item Id, pin number, symbol part number, component refdes (e.g. U1), pindes (e.g. 1), pin type, outside and inside style and edge styles, net Id, gate equivalence value, and pin equivalence value Extracting Style Data for Text Items Text items include a StyleId as part of their definition. This StyleId value may be used to get information about a style in general, or more specific information about the current text item being examined. There are three functions available to retrieve style information. Style information is returned in mytextstyle, which you declare as TTextStyle. TGetTextStyle(tContext,textStyleId,myTextStyle) Note that valid style ids range from 0 to 99 for text styles. The styles used may not be consecutive, however, so looping through the style ids from 0 until a DBX_STYLE_NOT_FOUND to find all valid styles may stop too soon if there are "holes" in the used style ids. The correct approach is to loop from 0 to 99, recording draw p-cad error dbx32.dll styles are valid based on the status returned from the GetStyle function. Text Style function TGetTextStyle returns the style name, font type, pen width, draw p-cad error dbx32.dll text height in a TTextStyle data item Extracting Grids and Grid Data Two functions return grid data. Grid data is returned in the DBX item mygriddata, which you declare as type TGrid. TGetFirstGrid(tContext,myGridData) TGetNextGrid(tContext,myGridData) Grid functions TGetFirstGrid and TGetNextGrid return grid ID and grid spacing which is 22

28 a string containing the spacing values separated by a comma Draw p-cad error dbx32.dll Attributes Ten functions return the attributes which are associated with design, layer, net, net class, class to class, room or component. Attribute data is returned in myattr, which you declare as TAttribute. For components, you specify the component refdes using a string variable in Visual Basic, or a char* in C or C++. For all others specify the ID declared as a. TGetFirstDesignAttribute(tContext, myattr) TGetNextDesignAttribute(tContext, myattr) TGetFirstNetAttribute(tContext,netId, myattr) TGetNextNetAttribute(tContext, myattr) TGetFirstNetClassAttribute(tContext,NetClassId, myattr) TGetNextNetClassAttribute(tContext, myattr) TGetFirstClassToClassAttribute(tContext, NetClassId1, NetClassId2, myattr) TGetNextClassToClassAttribute(tContext, myattr) TGetFirstCompAttribute(tContext,refDes,myAttr) TGetNextCompAttribute(tContext, myattr) The above functions return type and value strings for each attribute associated with the class in a TAttribute data item. These attributes also include location, style, and orientation information Extracting Symbol Attributes Two functions return the attributes which are associated with a symbol. Attribute data is returned in myattr, which you declare as TAttribute. For symbols, you specify the symbol, refdes (i.e. U1:A) using a string variable, in Visual Basic, or a Char*, draw p-cad error dbx32.dll, draw p-cad error dbx32.dll C or C++. TGetFirstSymAttribute (tcontext, refdes, myattr) TGetNextSymAttribute (tcontext, myattr) Symbol Attribute functions TGetFirstCompAttribute and TGetNextCompAttribute return type and value strings for each attribute associated to a symbol in a TAttribute data item. These attributes also include location, style, and orientation information Extracting Items from the Current Selection Set Two functions return the items in the active design selection set (items you have selected by Block Select or selecting individual items). Item data is returned in selectitem, which you declare as type Titem. See section 2.5 for a discussion of the TItem structure and its usage. TGetFirstSelectedItem(tContext,selectItem) TGetNextSelectedItem(tContext,selectItem) Get Selection functions return selected items in a TItem data item. The item types returned in thetitem include arcs, attributes, buses, fields, info points, lines, pins, ports, 23

29 ref points, symbols, tables, text, and wires Extracting Print Job Two functions return the print jobs in the active design. Print job information is returned in ajob, which you declare as type TPrintJob. TGetFirstPrintJob(tContext, ajob) TGetNextPrintJob(tContext, ajob) Print Job functions TGetFirstPrintJob and TGetNextPrintJob return the name of the print job and if it is selected for output during a print operation Extracting Variants These methods are used for retrieving all the existing Variants in a design. TGetFirstVariant(DbxContext* pcontext, TVariant* pvariant) TGetNextVariant(DbxContext* pcontext, TVariant* pvariant) Variant functions TGetFirstVariant and TGetNextVariant return TVariant structure draw p-cad error dbx32.dll contains the Variant name, description, and id. 24

30 5 Modifying Design Data - PCB This section provides a summary of the interface functions that add, modify, or delete PCB design data. Note that these functions are available only for P-CAD P-CAD PCB. For a detailed description of each function, its arguments, or P-CAD DBX structure contents, see DBX32.H, or the appendices at the end of this manual, draw p-cad error dbx32.dll. Note that DBX items returned by a successful Modify operation will have a new dbid or compid database identifier. The old dbid or compid value will no er be a valid identifier; the modified DBX item returned by the function call should be used for subsequent DBX function calls. To enable code sharing between DBX applications used for PCB, Schematic, and Library Manager or Library Executive, function calls and DBX items are intentionally similar where possible. 5.1 Draw p-cad error dbx32.dll Objects Nine functions flip PCB design objects, draw p-cad error dbx32.dll. Input to the function is the item to be flipped, and the point about which the item is to be flipped, draw p-cad error dbx32.dll. Items may be flipped using item type specific function calls, or by using a DBX TItem as input to TFlipItem. The item to be flipped is declared as a TArc, TAttribute, TComponent, TField, TLine, TPad, TPoint, Ttable, TText, TVia or TItem, respectively. The point about which to flip, ppoint, is declared as a TCoord. If the TCoord coordinates are specified as (-1,-1), the item is flipped about its default origin. See Section 2.8, Default Item Origins for a listing of what item property is used as a default origin. TFlipArc(tContext, ppoint, parc) TFlipAttribute(tContext, ppoint, pattribute) TFlipComponent(tContext, ppoint, pcomponent) TFlipField(tContext, ppoint, pfield) TFlipLine(tContext, ppoint, pline) TFlipPad(tContext, ppoint, ppad) TFlipPoint(tContext, ppoint, ppoint2) TFlipTable(tContext, ppoint, ptable) TFlipText(tContext, ppoint, ptext) TFlipVia(tContext, ppoint, pvia) TFlipItem(tContext, ppoint, TItem) DBX Flip functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TFlipItem. The item is updated to have its draw p-cad error dbx32.dll field set appropriately. 5.2 Rotating Objects Ten functions rotate PCB design objects. Input to the function is the item to be rotated, the rotation angle, and the point about which the item is to be rotated. Items may be rotated using item type specific function calls, or by using a DBX TItem as input to TRotateItem. 25

31 The item to be rotated is declared as a TArc, TAttribute, TComponent, Tfield, TLine, TPad, draw p-cad error dbx32.dll, Tpoint, TTable, TText, TVia or TItem, respectively. The rotation angle angle, is declared as a and may range from to 3600 (recall that degree values are specified in 1/10 degrees). The point about which to rotate, ppoint, is declared as a TCoord. If the TCoord coordinates are specified as (-1,-1), the item is rotated about its default origin. See Section 2.8, Default Item Origins for a listing of what item property is used as a default origin. TRotateArc(tContext, angle, ppoint, parc) TRotateAttribute(tContext, angle, ppoint, pattribute) TRotateComponent(tContext, angle, ppoint, pcomponent) TRotateField(tContext, angle, ppoint, pfield) TRotateLine(tContext, angle, ppoint, pline) TRotatePad(tContext, angle, ppoint, ppad) TRotatePoint(tContext, angle, ppoint, ppoint2) TRotateTable(tContext, angle, ppoint, ptable) TRotateText(tContext, angle, ppoint, ptext) TRotateVia(tContext, angle, ppoint, pvia) TRotateItem(tContext, angle, ppoint, pitem) DBX Rotate functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TRotateItem. The item rotateangle or rotation fields are updated to reflect the item's new orientation. 5.3 Moving Objects Thirteen functions move PCB design objects. Input to the function is the item to be moved, and the distance in the x and y directions to move the item. Items may be moved using item type specific function calls, or by using a DBX TItem as input to TMoveItem. The item to be moved is declared as a TArc, TAttribute, TComponent, TDetail, TDiagram, TLine, TMetafile, TPad, TPoint, TTable, draw p-cad error dbx32.dll, TText, TVia or TItem, respectively. The distances to move, dx and dy, are declared as a s and are in database units. TMoveArc(tContext, dx, dy, parc) TMoveAttribute(tContext, dx, dy, pattribute) TMoveComponent(tContext, dx, dy, pcomponent) TMoveDetail(tContext, dx, dy, pdetail) TMoveDiagram(tContext, dx, dy, pdiagram) TMoveLine(tContext, dx, dy, pline) TMoveMetafile(tContext, dx, dy, pmetafile) TMovePad(tContext, dx, dy, ppad) TMovePoint(tContext, dx, draw p-cad error dbx32.dll, dy, ppoint) TMoveTable(tContext, dx, dy, ptable) TMoveText(tContext, dx, draw p-cad error dbx32.dll, dy, ptext) TMoveVia(tContext, dx, dy, pvia) TMoveItem(tContext, dx, dy, pitem) DBX Move functions return a DBX error return status, draw p-cad error dbx32.dll, and an updated DBX item, draw p-cad error dbx32.dll, either in an item type specific DBX item structure, or as a TItem from TMoveItem. The item location information is updated to reflect the item's new location after the Move operation. 26

32 5.4 Deleting Objects Seventeen functions delete PCB design objects, draw p-cad error dbx32.dll. Input to the function is the item to be deleted. Items may be deleted using item type specific function calls, or by using a DBX TItem as input to TDeleteItem. The item to be deleted is declared as a TArc, TAttribute, TClassToClass, TComponent, TDetail, TDiagram, TLine, TMetafile, TPad, TPoint, TText, TVia or TItem respectively. TDeleteArc(tContext, parc) TDeleteAttribute(tContext, pattribute) TDeleteClassToClass(tContext, pclasstoclass) TDeleteComponent(tContext, pcomponent) TDeleteDetail(tContext, pdetail) TDeleteDiagram(tContext, pdiagram) TDeleteIncludedRoomComponent(tContext, roomid, pcomponent) TDeleteLine(tContext, pline) TDeleteNetClass(tContext, pnetclass) TDeleteNetClassNet(tContext,NetClassId, pnet) TDeleteMetafile(tContext, pmetafile) TDeletePad(tContext, ppad) TDeletePoint(tContext, ppoint) TDeleteTable(tContext, ptable) TDeleteText(tContext, ptext) TDeleteVia(tContext, pvia) TDeleteItem(tContext,pItem) DBX Delete functions return a DBX draw p-cad error dbx32.dll return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TDeleteItem. The item is indicated as no er being a valid PCB design item by having its DBID property set equal to zero. 5.5 Highlighting Objects Twenty-five functions highlight and unhighlight PCB design objects. Input to each function is the item to be highlighted or unhighlighted, and a highlight color for highlight functions. Items may be highlighted or unhighligted using item type specific function calls, or by using a DBX TItem as input to THighlightItem and TUnHighlightItem, draw p-cad error dbx32.dll. All items in the active design may be draw p-cad error dbx32.dll using the TUnHighlightAll function. All items in a net may be highlighted or unhighlighted using the THighlightNet and TUnHighlightNet functions, respectively. The item to be highlighted is declared as a TArc, TAttribute, TComponent, TLine, TNet, TPad, TPoint, TRoom, TTable, TText, TVia or TItem, respectively. The highlight color color is declared as a value and specifies highlight colors 1 through 20. The 20 colors associated with the highlight color constants are listed in Appendix A, P-CAD DBX Data Constants under DBX Color Index Types. THighlightArc(tContext, color, parc) THighlightAttribute(tContext, color, pattribute) THighlightComponent(tContext, color, pcomponent) 27

33 THighlightLine(tContext, color, pline) THighlightPad(tContext, color, ppad) THighlightPoint(tContext, color, ppoint) THighlightTable(tContext, color, ptable) THighlightText(tContext, draw p-cad error dbx32.dll, color, ptext) THighlightVia(tContext, color, pvia) TUnHighlightArc(tContext, parc) TUnHighlightAttribute(tContext, pattribute) TUnHighlightComponent(tContext, pcomponent) TUnHighlightLine(tContext, pline) TUnHighlightPad(tContext, ppad) TUnHighlightPoint(tContext, ppoint) TUnHighlightTable(tContext, ptable) TUnHighlightText(tContext, ptext) TUnHighlightVia(tContext, pvia) THighlightNet(tContext, color, pnet) TUnHighlightNet(tContext, pnet) THighlightRoom(tContext, draw p-cad error dbx32.dll, color, proom) TUnHighlightRoom(tContext, proom) THighlightItem(tContext, color, pitem) TUnHighlightItem(tContext, pitem) TUnHighlightAll(tContext) DBX Highlight functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from THighlightItem or TUnHighlightItem. Individual items highlighted or unhighlighted are returned having their ishighlighted field updated to indicate its highlight color. (ishighlighted is 0 to indicate that the item is not highlighted and ranges 1 through 20 to specify which highlight color is in use.) In addition, Details, Diagrams, and Metafiles can be highlighted or unhighlighted by using the THighlightItem or TUnHighlightItem with the apporiprate fields of the TItem structure filled in. 5.6 Modifying Object Properties Twelve functions modify PCB design objects properties. Input to the function is the item to be modified. Items may be modified using item type specific function calls, or by using a DBX Titem as input to TModifyItem. The modification to be performed is specified by setting one or more of the DBX item properties prior to calling the Modify function. The properties that may be modified by a DBX program are specific to the type of item being modified and are listed below. All modifications must conform to P-CAD PCB design rules. For example, component refdes values must be unique and contain no invalid characters; a location or rotation which would move the item outside the design workspace will return a DBX error value of DBX_ITEM_OUTSIDE_WORKSPACE; moving an item to an invalid layer will return an error value of DBX_INVALID_LAYER. The item to be modified is draw p-cad error dbx32.dll as a TArc, TAttribute, TComponent, TLine, TNet, TNetClass, TPad, Tpoint, TRoom, TText, TVia or TItem, respectively, draw p-cad error dbx32.dll. 28

34The item properties are updated to reflect the item status after the Modify call. Item properties not legal for modification that were modified in the DBX item prior to the function call are overwritten with valid data representing the item's current state after the Modify call. Note: For information on modifying component and net attributes, see sections 5.13 and 5.14, draw p-cad error dbx32.dll, respectively. 5.7 Placing Objects Eight functions place PCB design objects in an active PCB design. Input to the function is the item to be placed, draw p-cad error dbx32.dll. There is no generic TPlaceItem form. The properties for the item to be placed is specified by setting one or more of the DBX item properties prior to calling the Place function. The properties that must be specified during placement are specific to the type of item being placed and are listed below. All items to be placed, and the properties of those items, must conform to P-CAD PCB design rules. For example, component refdes values must be unique and contain no invalid characters; a location or rotation which would place the item outside the design workspace will return a DBX error value of DBX_ITEM_OUTSIDE_WORKSPACE; placing an item on an invalid layer will return an error value of DBX_INVALID_LAYER. The item to be placed is declared as a TArc, TAttribute, Draw p-cad error dbx32.dll, TLine, TPad, TPoint, Ttext and TVia, respectively. 29

35 The specifiable properties for each DBX item are listed below. Note that except for component.libraryname, component.typename, and point.infotext, these are exactly the properties valid for DBX Modify operations. Note also that all properties listed must be specified to place a new design item. Arc: width, radius, centerpt, startang, sweepang, layerid Attribute: type, value, refpoint, textstyleid, justpoint, isvisible, layerid Component: refdes, value, refpoint, libraryname, comptype Line: width, startpt, endpt, layerid Net: netname Free Pad: padstyleid, center, pinnumber Via: viastyleid, center Point: pointtype x, y (location), layerid; InfoText, rulecategory, ruletype (InfoPoint only) Text: text, refpoint, textstyleid, justpoint, isvisible, layerid Note: When placing a component component.libraryname, if specified, must include the complete library path and file name (e.g. c:\p-cad\demo.lib). If not specified by leaving the input property field blank, the open libraries will be searched in the current open library order for the input component type. TPlaceArc(tContext, parc) TPlaceAttribute(tContext, pattribute) TPlaceComponent(tContext, draw p-cad error dbx32.dll, pcomponent) TPlaceLine(tContext, draw p-cad error dbx32.dll, pline) TPlacePad(tContext, ppad) TPlacePoint(tContext, ppoint) TPlaceText(tContext, ptext) TPlaceVia(tContext, pvia) DBX Place functions return a DBX error return status, and an updated DBX item. The item properties are updated to reflect the item status after the Place call. Item properties not legal to be specified during placement that were specified in the DBX item prior to the function call are overwritten with valid data representing the item's current state after the Place call. 5.8 Creating and Deleting Nets Two functions create and delete a PCB design net. Input to the TCreateNet function is a DBX TNet item. The net.netname field must specify the name of the new net. The name must be a valid netname, and not be a duplicate of an existing net. All other TNet properties are ignored. A PCB net must contain no design items (lines, arcs, vias) and have no net nodes to be deleted. See Sections 5.4, Deleting Objects, and 5.9, Adding and Deleting Net Nodes for information on how to delete net items and net nodes. Note: When deleting a net, net objects (using TGetFirstNetItem and TGetNextNetItem) should be deleted first, then delete the net nodes (using TGetFirstNetNode and TGetNextNetNode). It is not necessary to delete all net attributes before deleting a net. TCreateNet(tContext, pnet) TDeleteNet(tContext, pnet) 30

36 DBX TCreateNet and TDeleteNet functions return a DBX error return status, and an updated DBX net item. If successful, a created TNet will be returned and indicate a valid net number in the net.netnumber field. A deleted net will be indicated by a net.netnumber field value of zero. 5.9 Adding and Deleting Net Nodes Two functions add and delete PCB net nodes. Input to these functions is the net number, and the pad to be added or deleted. netid is declared as a, and must be a valid net number. pitem is the node to be added or deleted from the net, and is declared as a Titem with the pad structure filled in. TAddNetNode(tContext, netid, pitem) TDeleteNetNode(tContext, netid, pitem) DBX TAddNetNode and TDeleteNet functions return a DBX error return status, and an updated DBX Titem with the pin structure filled in. If a pad has been successfully added to a net, the pad netid property will be updated to reflect the net number of the net to which it has been added. If a pad has been successfully deleted from a net, the pad netid property will be set to zero, indicating it bes to no nets Creating and Deleting NetClasses Two functions create and delete a PCB design NetClass. Input to the TCreateNetClass function is a DBX TNetClass item. The netclass.netclassname field must specify the name of the new NetClass. The name must be a valid netclassname, and not be a duplicate of an existing NetClass. All other TNet properties are ignored. TCreateNetClass(tContext, pnetclass) TDeleteNetClass(tContext, pnetclass) DBX TCreateNetClass and TDeleteNetClass functions return a DBX error return status, and an updated DBX net class draw p-cad error dbx32.dll. If successful, a created TNetClass will be returned and indicate a valid net class number in the netclass.numberofnets field Adding and Deleting NetClassNets Two functions add and delete a PCB design net class net. Input to the TCreateNetClassNet function is a DBX netclassid and a TNet item. The netclassid is declared as a and must be a valid NetClass number. pnet is the net to be added or deleted from the net, and is declared as a TNet with the net structure filled in. TAddNetClassNet(tContext, netclassid, pnet) TDeleteNetClassNet(tContext, netclassid, pnet) DBX TAddNetClassNet and TDeleteNetClassNet functions return a DBX error return status and the number of nets in the net class is incremented or decremented. 31

37 5.12 Creating and Deleting ClassToClass Rules Two functions create and delete a PCB design ClassToClass rules. Input to the TCreateClassToClass function is a DBX TClassToClass item. TCreateClassToClass(tContext, pclasstoclass) TDeleteClassToClass(tContext, pclasstoclass) DBX TCreateClassToClass and TDeleteClassToClass functions return a DBX error return status Modifying Component Attributes Three functions modify component attributes. Input to these functions is the component refdes, which you declare as a string variable in Visual Basic, and as a char* in C or C++, and the attribute to be added, modified, or deleted, pattribute, declared as a TAttribute. TAddCompAttribute(tContext, refdes, pattribute) TModifyCompAttribute(tContext, refdes, pattribute) TDeleteCompAttribute(tContext, refdes, pattribute) The following TAttribute properties are used when adding an attribute to a component: type, value, refpoint, textstyleid, justpoint, isvisible, and layerid. All properties must draw p-cad error dbx32.dll fully specified unless isvisible=0, where the following defaults are used: refpoint: will be placed at the component reference point textstyleid: default justpoint: lower left justification layerid: Top Silk layer The following TAttribute properties may be modified using the TModifyCompAttribute function: value, refpoint, textstyleid, justpoint, draw p-cad error dbx32.dll, isvisible, and layerid. Note that a component refdes is modifiable only by using TModifyComponent with the component refdes property updated. DBX Modify Component Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with draw p-cad error dbx32.dll attribute properties updated. A deleted attribute will be returned with its DB ID set to zero Modifying Net Attributes Three functions modify net attributes. Input to these functions is the net number, netid, which you declare as a, and the attribute to be added, modified, or deleted, pattribute, draw p-cad error dbx32.dll, declared as a TAttribute. TAddNetAttribute(tContext, netid, pattribute) TModifyNetAttribute(tContext, netid, pattribute) TDeleteNetAttribute(tContext, netid, pattribute) The following TAttribute properties are used when adding an attribute to a net or modifying an existing net attribute: type, value, formula, comment and units. Net 32

38 attributes are not visible. All other properties are ignored when adding or modifying a net attribute. DBX Modify Net Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties updated. A deleted attribute will be returned with its DB ID set to zero Modifying Design Attributes Three functions modify design attributes. The attribute to be added, modified, or deleted, draw p-cad error dbx32.dll, pattribute, is declared as a TAttribute. TAddDesignAttribute(tContext, pattribute) TModifyDesignAttribute(tContext, pattribute) TDeleteDesignAttribute(tContext, pattribute) The following TAttribute properties are used when adding an attribute to a design or modifying an existing design attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a design attribute. DBX Modify Design Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties updated. A deleted attribute will be returned with its DB ID set to zero Modifying Layer Attributes Three functions modify layer attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddLayerAttribute(tContext, pattribute) TModifyLayerAttribute(tContext, pattribute) TDeleteLayerAttribute(tContext, pattribute) The following TAttribute properties are used when adding a layer attribute to a design or modifying an existing layer attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a layer attribute. DBX Modify Layer Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified layer attributes will be returned with all attribute properties updated. A deleted layer attribute will be returned with its DB ID set to zero Modifying NetClass Attributes Three functions modify NetClass attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddNetClassAttribute(tContext, netclassid, pattribute) TModifyNetClassAttribute(tContext, netclassid, pattribute) TDeleteNetClassAttribute(tContext, netclassid, pattribute) The following TAttribute properties are used when adding a netclass attribute to a 33

39 design or modifying an existing netclass attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a netclass attribute. DBX Modify NetClass Attribute innodb error cannot allocate return a DBX error return status, and an updated DBX TAttribute item. Added or modified NetClass attributes will be returned with all attribute properties updated, draw p-cad error dbx32.dll. A deleted NetClass attribute will be returned with its DB ID set to zero Modifying ClassToClass Attributes Three functions modify ClassToClass attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) TModifyClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) TDeleteClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) The following TAttribute properties are used when adding a ClassToClass attribute to a design or modifying an existing ClassToClass attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a ClassToClass attribute. DBX Modify ClassToClass Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified ClassToClass attributes will be returned with all attribute properties updated. A deleted ClassToClass attribute will be returned with its DB ID set to zero Modifying Room Attributes Three functions modify Room attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddRoomAttribute(tContext, roomid, pattribute) TModifyRoomAttribute(tContext, roomid, pattribute) TDeleteRoomttribute(tContext, draw p-cad error dbx32.dll, roomid, pattribute) The following TAttribute properties are draw p-cad error dbx32.dll when adding a Room attribute to a design or modifying an existing Room attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a Room attribute. DBX Modify Room Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified Room attributes will be returned with all attribute properties updated. A deleted Room attribute will be returned with its DB ID set to zero. 34

40 5.20 Saving a Design The following function is used to save the active design. TSaveDesign(tContext) The active design will be written to disk in the same manner as if the File Save command was chosen from the P-CAD application menu Selecting Print Jobs Three functions select or deselect the print jobs in the active design. Selected print jobs are those that are output during the next print operation. Print jobs are specified in the jobname string. TSelectPrintJob(tContext, jobname) TDeselectPrintJob(tContext, jobname) TSelectAllPrintJob(tContext) the TSelectPrintJob and TDeselectPrintJob functions will select or deselect the print job specified by its name. The TSelectAllPrintJobs function will select all the print jobs in the active design Printing Print Jobs Two functions print the print jobs of the active design to the current printer. Print jobs are specified in the jobname string. TOutputPrintJobByName(tContext, jobname) TOutputSelectedPrintJobs(tContext) The TOutputPrintJobByName function will print the job specified by its name, regardless of whether or not it has been selected for output. The TOutputSelectedPrintJobs function will print jobs that are selected for output Add Layers One function adds a layer to draw p-cad error dbx32.dll active design TAddLayer(tContext, player) The TAddLayer function will add a layer with the specific data of layer name, layerid, type and bias, clearances, and plane status. If the layerid is already used it TAddLayer will use the next available number. If the layer name already exists then an error is returned. 35

41 5.24 Modifying Variants These three functions modify variants. The variant to be added, deleted or renamed, pvariant, is declared as a TVariant. TAddVariant(DbxContext* pcontext, TVariant* pvariant) TDeleteVariant(DbxContext* pcontext, TVariant* pvariant) TRenameVariant(DbxContext* pcontext, TVariant* pvariant) TAddVariant is used for adding a uniquely named Variant to a design. In the TVariant structure the name must be unique otherwise an error is returned of duplicate name. TVariant.description and TVariant.id are optional. TDeleteVariant is used for removing a Variant from draw p-cad error dbx32.dll design. The Variant must exist otherwise an error is returned. Description and id are optional. TRenameVariant method is used to rename a Variant. To use, first get the variant data by TGetFirstVariant and TGetNextVariant. When you have the one of interest change its name and call TRenameVariant. Be sure to not change the id as this is used to identify the variant for renaming purposes Modifying Pad Styles These three functions modify pad styles. Long TCreatePadStyle(DbxContext* pcontext, (i/o) dbx context info fromid (i) existing style Id to copy from - Use 0 for default const char* pnewname, (i) new style name TPadViaStyle* pstyle); (o) new style return The TCreatePadStyle function create a new pad style by copying from an existing style. The parameter fromid is the id of an existing pad style. You can use the TGetFirstPadStyle and TGetNextPadStyle functions to fetch the existing pad styles in the design. pnewname is the name for the newly create style. TPadViaStyle* is filled in if successful. It fills in the style id, name, hole diameter, etc. See TPadViaStyle type definition for more details. TDeletePadStyle(DbxContext* pcontext, (i/o) dbx context info padstyleid); (i) pad style Id to delete The TDeletePadStyle function is used to delete a pad style from the design. Default style or styles that are in-use in the design cannot be deleted. Use the padstyleid to specify the style to delete. TModifyPadStyle(DbxContext* pcontext, (i/o) dbx context info TPadViaStyle* pstyle); (i) style info to modify 36

42 The TModifyPadStyle function is used to modify a pad style. pstyle is the pad style info to modify. The following fields need to be filled in: styleid name holedia xoffset yoffset holestartlayer holeendlayer 5.26 Modifying Pad Shapes These two functions modify pad shapes. TAddPadShape(DbxContext* pcontext, (i/o) dbx context info padstyleid, (i) Pad style Id to add shape to TPadViaShape* ppadshape); (i) Pad shape to add The TAddPadShape function is used to add or modify the pad shape (for a layer) of a pad style. Note that because polygon shape uses different property attributes, this function will not add a polygon pad shape. To add/modify polygon pad shapes for a layer, use the TAddPolyPadShape function. TDeletePadShape(DbxContext* pcontext, (i/o) dbx context info padstyleid, (i) pad style id layerid); (i) layer id The TDeletePadShape function is used to delete a pad style shape, draw p-cad error dbx32.dll. Note that it cannot delete default shapes for the following layers: top, bottom, default non-signal, signal and plane Modifying Polygon Pad Shapes These two functions are used to add regular and irregular polygon pad shape definitions. TAddPadRegularPolyShape(DbxContext* pcontext, (i/o) dbx context info padstyleid, (i) pad style id TPadViaRegularPolyShape* pregpolyshape); (i) The TAddPadRegularPolyShape function is used to add or modify the regular polygon shape for a pad style. Use pregpolyshape to pass in the number of sides, and rotation angle for the regular polygon. Long TAddPadIrregularPolyShape(DbxContext* pcontext, (i/o) dbx context info padstyleid, (i) pad style id layerid, (i) layer Id or 0 if add or modify default layer layertype, (i) use if layer Id is 0 37

43 ispournoconn, (i) Prohibit Cu pour thermalizing numberofpoints, (i) number of poly points const TCoord* ppoints); (i) point array. The size of draw p-cad error dbx32.dll array is numberofpoints The TAddPadIrregularPolyShape function is used to add or modify a Irregular polygon shape for a pad style. Note that the array of points, the ppoints parameter, defines a polygon shape. The X, Y coordinate of a point is relative draw p-cad error dbx32.dll the "origin" of the polygon, not the PCB design. The coordinate is in database unit. The layerid is the layer number for the pad shape. If the layer number is 0, the layertype can be used to modify the default shape of a pad style: DBX_LAYERTYPE_SIGNAL -shape for default Signal Layer DBX_LAYERTYPE_PLANE - shape for default Plane Layer, and DBX_LAYERTYPE_NON_SIGNAL - shape for default Non Signal layer 5.28 Modifying Via Styles draw p-cad error dbx32.dll Shapes The following functions are duplicates of the Pad style and shape functions except they are used for Vias. TCreateViaStyle(DbxContext* pcontext, (i/o) dbx context info fromid, (i) existing style Id to copy from - Use 0 for default const char* pnewname, (i) new style name TPadViaStyle* pstyle). (o) new style return TDeleteViaStyle(DbxContext* pcontext, (i/o) dbx context info viastyleid); (i) via style Id to delete TModifyViaStyle(DbxContext* pcontext, (i/o) dbx context info TPadViaStyle* pstyle); (i) style info to modify TAddViaShape(DbxContext* pcontext, draw p-cad error dbx32.dll, (i/o) dbx context info viastyleid, (i) Via style Id to add shape to TPadViaShape* draw p-cad error dbx32.dll (i) via shape to add Long TAddViaRegularPolyShape(DbxContext* pcontext, (i/o) dbx context info viastyleid, (i) via style id TPadViaRegularPolyShape* pregpolyshape); (i) Regular poly shape definition TAddViaIrregularPolyShape(DbxContext* pcontext, (i/o) dbx context info viastyleid, (i) via style id layerid, (i) layer Id or 0 if add or modify default 38

44 layer layertype, (i) use if layer Id is 0 ispournoconn, (i) Prohibit Cu pour thermalizing numberofpoints, (i) number of poly points const TCoord* ppoints); (i) point array. The size of the array is numberofpoints Modifying Text Styles Below are Text style functions. These are similar to those for Pad styles. TAddTextStyle(DbxContext* pcontext, (i/o) dbx context info fromid, (i) existing style Id to copy from TTextStyle* pstyle); (i/o) new text style return Description: Add a new text style by copying it from an existing style. TDeleteTextStyle(DbxContext* pcontext, (i/o) dbx context info styleid); (i) style to delete Description: Delete an existing text style. Use the styleid to specify the style to be removed. Note that Default style or styles that are in-used cannot be deleted. DLLX TModifyTextStyle(DbxContext* pcontext, TTextStyle* pstyle); (i/o) dbx context info (i) style info to modify Description: Modify various fields of a text style. Use the styleid to specify the text style to modify. Valid fields that can be modified are: name strokeheight strokepenwidth istruetypeallowed isdisplaytruetype ttypeheight Note: This function returns DBX_BAD_INPUT when one of the following possible errors happened: 1) The name is a duplicate of another text style. 2) Height or width of the text are out of range Note: This function returns DBX_ILLEGAL_OP when one of the following possible errors happened: 1) The style to be modified is a default style (i.e. (Default), (DefaultTTF)) 2) The new font height and width might make the text fall out of the workspace. 39

45 6 Modifying Design Data - Schematic This section provides a summary of the interface functions that add, modify, or delete Schematic design data. For a detailed description of each function, its arguments, or P-CAD DBX structure contents, see DBX32.H, draw p-cad error dbx32.dll, or the appendices at the end of this manual. Note that DBX items returned by a successful Modify operation will have a new dbid or compid database identifier. Draw p-cad error dbx32.dll old dbid or compid value will no er be a valid identifier; the modified DBX item returned by the function call should be used for subsequent DBX function calls. Before placing or modifying a symbol or wire, read section 6.22; the section discusses net connectivity issues, draw p-cad error dbx32.dll. To enable code sharing between DBX applications used for PCB, Schematic, and Library Manager or Library Executive, function calls and DBX items are intentionally similar where possible. 6.1 Flipping Objects Twelve functions flip Schematic design objects. Input to the function is the item to be flipped, and the point about which the item is to be flipped. Items may be flipped using item type specific function calls, or by using a DBX TItem as input to TFlipItem. The item to be flipped is declared as a TArc, TAttribute, TBus, TField, TLine, TPin, TPort, TSymbol, TTable, TText, TWire or TItem, respectively. The point about which to flip, ppoint, is declared as a TCoord. If the TCoord coordinates are specified as (-1,-1), the item is flipped about its default origin. See Section 2.8, Default Item Origins for a listing of what item property is used as a default origin. TFlipArc(tContext, ppoint, parc) TFlipAttribute(tContext, ppoint, pattribute) TFlipBus(tContext, ppoint, pbus) TFlipField(tContext, ppoint, pfield) TFlipLine(tContext, ppoint, draw p-cad error dbx32.dll, pline) TFlipPin(tContext, ppoint, ppin) TFlipPort(tContext, ppoint, pport) TFlipSymbol(tContext, ppoint, psymbol) TFlipTable(tContext, ppoint, ptable) TFlipText(tContext, ppoint, ptext) TFlipWire(tContext, ppoint, pwire) TFlipItem(tContext, ppoint, TItem) DBX Flip functions return a DBX error return status, and an updated DBX item, draw p-cad error dbx32.dll, either in an item type specific DBX item structure, or as a TItem from TFlipItem. The item is updated to have its isflipped field set appropriately. 6.2 Rotating Objects Twelve functions rotate Schematic design objects. Input to the function is the item to be rotated, the rotation angle, and the point about which the item is to be rotated. Items may 40

46 be rotated using item type specific function calls, or by using a DBX TItem as input to TRotateItem. The item to be rotated is declared as a TArc, TAttribute, TBus, TField, TLine, TPin, TPort, TSymbol, TTable, TText, TWire or TItem, respectively. The rotation angle angle, is declared as a and may range from to 3600 (recall that degree values are specified in 1/10 degrees). The point about which to rotate, ppoint, is declared as a TCoord. If the TCoord coordinates are specified as (-1,-1), draw p-cad error dbx32.dll, the item is rotated about its default origin. See section 2.8, Default Item Origins for a listing of what item property is used as a default origin. TRotateArc(tContext, angle, ppoint, parc) TRotateAttribute(tContext, angle, ppoint, pattribute) TRotateBus(tContext, angle, ppoint, pbus) TRotateField(tContext, angle, ppoint, pfield) TRotateLine(tContext, angle, ppoint, pline) TRotatePin(tContext, angle, ppoint, ppin) TRotatePort(tContext, angle, ppoint, pport) TRotateSymbol(tContext, angle, ppoint, psymbol) TRotateTable(tContext, angle, ppoint, ptable) TRotateText(tContext, angle, ppoint, ptext) TRotateWire(tContext, angle, ppoint, pwire) TRotateItem(tContext, angle, ppoint, pitem) DBX Rotate functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TRotateItem. The item rotateangle or rotation fields are updated to reflect the item's new orientation. 6.3 Moving Objects Thirteen functions move Schematic design objects. Input to the function is the item to be moved, and the distance in the x and y directions to move the item. Items may be moved using item type specific function calls, or by using a DBX TItem as input to TMoveItem. The item to be moved is declared as a TArc, TAttribute, TBus, TField, TLine, TPin, TPoint, TPort, TSymbol, TTable, TText, TWire or TItem, respectively. The distances to move, dx and dy, are declared as a s and are in database units. TMoveArc(tContext, dx, draw p-cad error dbx32.dll, dy, parc) TMoveAttribute(tContext, dx, dy, pattribute) TMoveBus(tContext, dx, dy, pbus) TMoveField(tContext, dx, dy, pfield) TMoveLine(tContext, dx, dy, pline) TMovePin(tContext, dx, dy, ppin) TMovePoint(tContext, dx, dy, ppoint) TMovePort(tContext, dx, dy, pport) TMoveSymbol(tContext, dx, dy, psymbol) TMoveTable(tContext, dx, dy, ptable) TMoveText(tContext, dx, draw p-cad error dbx32.dll, dy, ptext) TMoveWire(tContext, dx, dy, pwire) TMoveItem(tContext, dx, dy, pitem) DBX Move functions return a DBX error return status, draw p-cad error dbx32.dll, and an updated DBX item, either in 41

47 an item type specific DBX item structure, or as a TItem from TMoveItem. The item location information is updated to reflect the item's new location draw p-cad error dbx32.dll the Move operation. 6.4 Deleting Objects Seventeen functions delete Schematic design objects. Input to the function is the item to be deleted. Items may be deleted using item type specific function calls, or by using a DBX TItem as input to TDeleteItem. The item to be deleted is declared as a TArc, TAttribute, TBus, TClassToClass, TField, TLine, TNet, TNetClass, TPin, TPoint, TPort, TSymbol, TTable, TText, TWire or TItem, respectively. TDeleteArc(tContext, parc) TDeleteAttribute(tContext, pattribute) TDeleteBus(tContext, pbus) TDeleteClassToClass(tContext, pclasstoclass) TDeleteField(tContext, pfield) TDeleteLine(tContext, pline) TDeleteNet(tContext, pnet) TDeleteNetClass(tContext, pnetclass) TDeleteNetClassNet(tContext,NetClassId, pnet) TDeletePin(tContext, ppin) TDeletePoint(tContext, ppoint) TDeletePort(tContext, pport) TDeleteSymbol(tContext, psymbol) TDeleteTable(tContext, ptable) TDeleteText(tContext, ptext) TDeleteWire(tContext, pwire) TDeleteItem(tContext,pItem) DBX Delete functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TDeleteItem. The item is indicated as no er being a valid Schematic design item by having its DBID property set equal to zero. 6.5 Highlighting Objects Twenty-nine functions highlight and unhighlight Schematic design objects, draw p-cad error dbx32.dll. Input to each function is the item to be highlighted or unhighlighted, and a highlight color for highlight functions. Items may be highlighted or unhighligted using item type specific function calls, or by using a DBX TItem as input to THighlightItem and TUnHighlightItem. All items in the active design may be unhighlighted using the TUnHighlightAll function. All items in a net may be highlighted or unhighlighted using the THighlightNet and TUnHighlightNet functions, respectively. The item to be highlighted or unhighlighted is declared as a TArc, TAttribute, TBus, TField, TLine, TNet, TPin, TPoint, TPort, TSymbol, TTable, TText, TWire or TItem, respectively. The highlight color color is declared as a value and specifies highlight colors 1 through 20. The 20 colors associated with the highlight color constants are listed 42

48 in Appendix A, P-CAD DBX Data Constants under DBX Color Index Types. Individual items highlighted or unhighlighted are returned having their ishighlighted field updated to indicate its highlight color. (ishighlighted is 0 to indicate that the item is not highlighted and ranges 1 through 20 to specify which highlight color is in use.) 6.6 Modifying Object Properties Fourteen functions modify Schematic design objects properties. Input to the function is the item to be modified. Items may be modified using item type specific function calls, or by using a DBX Titem as input to TModifyItem. The modification to be performed is specified by setting one or more of the DBX item draw p-cad error dbx32.dll prior to calling the Modify function. The properties that may be modified by a DBX program are specific to the type of item being modified and are listed below. All modifications must conform to P-CAD Schematic design rules. For example, component refdes values must be unique and contain no invalid characters; a location or rotation which would move the item outside the design workspace will return a DBX error value of DBX_ITEM_OUTSIDE_WORKSPACE; moving an item to an invalid layer will return an error value of DBX_INVALID_LAYER. 43

49 The item to be modified is declared as a TArc, TAttribute, TBus, draw p-cad error dbx32.dll, TField, TLine, TNet, TNetClass, TPin, Tpoint, TPort, TSymbol, TText, TWire or TItem, respectively. The item properties are updated to reflect the item status after the Modify call. Item properties not legal for modification that were modified in the DBX item prior to the function call are overwritten with valid data representing the item's current state after the Modify call. The function TModifyPin is only applicable to free pins only. Modifing a symbol s refdes may result in components being created and std runtime error. If you change refdes to an existing component, it must be of the same type and the gate must be unused. Note: For information on modifying component, symbol and net attributes, see sections 6.13, 6.14 and 6.15, respectively. Note: For information on net conectivity issues, see section Placing Objects 44

50 Eleven functions place Schematic design objects in an active Schematic design. Input to the function is the item to be placed. There is no generic TPlaceItem form. The properties for the item to be placed is specified by setting one or more of the DBX item properties prior to calling the Place function. The properties that must be specified during placement are specific to the type of item being placed and are listed below. All items to be placed, and the properties of those items, must conform to P-CAD Schematic design rules. For example, component refdes values must be unique and contain no invalid characters; a location or rotation which would place the item outside the design workspace will return a DBX error value of DBX_ITEM_OUTSIDE_WORKSPACE; placing an item on an invalid layer will return an error value of DBX_INVALID_LAYER. The item to be placed is declared as a TArc, TAttribute, TBus, TField, TLine, TPin, TPoint, TPort, TSymbol, Ttext and TWire, respectively. The specifiable properties for each DBX item are listed below. Note that except for component.libraryname, component.typename, and point.infotext, these are exactly the properties valid for DBX Modify operations. Note also that all properties listed must be specified to place a new design item. Arc: width, radius, centerpt, startang, sweepang, layerid Attribute: type, value, refpoint, textstyleid, justpoint, isvisible, layerid Bus: startpt, endpt, busname, layerid Field: fieldkeytype, refpoint, textstyleid, layerid, justpoint Line: width, startpt, endpt, style, layerid Pin: refpoint, style, pinnumber, layerid, pinlength Point: pointtype, x, y (location), layerid; textinfo, rulecategory, ruletype (InfoPoint only) Port: porttype, pinlength, refpoint, layerid, netid Symbol: comptype, refdes, partnumber, draw p-cad error dbx32.dll, refpoint, libraryname, layerid Text: text, refpoint, textstyleid, justpoint, layerid Wire: startpt, endpt, netid, layerid, width DesignInfo: ismodified Note: When placing a symbol, symbol.libraryname, if specified, must include the complete library path and file name (e.g. c:\p-cad\demo.lib). If not specified by leaving the input property field blank, the open libraries will be searched in the current open library order for the input component type. TModifyDesignInfo(tContext, pdesigninfo) TPlaceArc(tContext, parc) TPlaceAttribute(tContext, pattribute) TPlaceBus(tContext, pbus) TPlaceField(tContext, pfield) TPlaceLine(tContext, pline) TPlacePin(tContext, ppin) TPlacePoint(tContext, ppoint) TPlacePort(tContext, pport) TPlaceSymbol(tContext,pSymbol) TPlaceText(tContext, ptext) TPlaceWire(tContext, pwire) DBX Place functions return a DBX error return status, and an updated DBX item. The draw p-cad error dbx32.dll properties are updated to reflect the item status after the Place call, draw p-cad error dbx32.dll. Item properties not legal to be specified during placement that were specified in the DBX item prior draw p-cad error dbx32.dll the function call are overwritten with valid data representing the item's current state after the 45

51 Place call. When placing a symbol, if draw p-cad error dbx32.dll component doesn t exist it will be created otherwise the comptype field must be the same as the existing component. Note: For information on net connectivity issues concerning placing a wire or symbol, see section Creating and Deleting Nets Two functions create and delete a Schematic net. Input to the TCreateNet function is a DBX TNet item. The net.netname field must specify the name of the new net. The name must be a valid netname, and not be a duplicate of an existing net. All other TNet properties are ignored. A Schematic net must contain no design items (lines, arcs, vias) and have no net nodes to be deleted. See Sections 6.4, Deleting Objects, and 6.9, Adding and Deleting Net Nodes for information on how to delete net items and net nodes. Note: When deleting a net, net objects (using GetFirstNetItem and GetNextNetItem) should be deleted first, then delete the net nodes (using GetFirstNetNode and GetNextNetNode). It is not necessary to delete all net attributes before deleting a net. TCreateNet(tContext, pnet) TDeleteNet(tContext, pnet) DBX TCreateNet and TDeleteNet functions return a DBX error return status, and an updated DBX net item. If successful, a created TNet will be returned and indicate a valid net number in the net.netnumber field. A deleted net will be indicated by a net.netnumber field value of zero. 6.9 Adding and Deleting Net Nodes Two functions add and delete Schematic net nodes, draw p-cad error dbx32.dll. Input to these functions is the net number, and the pin to be added or deleted. netid is declared as a, and must be a valid net number. pitem is the node to be added or deleted from draw p-cad error dbx32.dll net, and is declared as a TItem with the pin structure filled in. TAddNetNode(tContext, netid, pitem) TDeleteNetNode(tContext, netid, draw p-cad error dbx32.dll, pitem) DBX TAddNetNode and TDeleteNetNode functions return a DBX error return status, draw p-cad error dbx32.dll an updated DBX TItem with the pin structure filled in. If a pin has been successfully added to a net, the pin netid property will be updated to reflect the net number of the net to which it has been added. If a pin has been successfully deleted from a net, the pin netid property will be set to zero, draw p-cad error dbx32.dll, indicating it bes to no nets Creating and Deleting NetClasses Two functions create and delete a Schematic design net class. Input to the TCreateNetClass function is a DBX TNetClass item. The netclass.netclassname field must specify the name of the new net class. The name must be a valid netclassname, and not be a duplicate of an existing netclass. All other TNet properties are ignored. 46

52 TCreateNetClass(tContext, pnetclass) TDeleteNetClass(tContext, pnetclass) DBX TCreateNetClass and TDeleteNetClass functions return a DBX error return status, and an updated DBX net class item. If successful, a created TNetClass will be returned and indicate a valid net class number in the netclass.numberofnets field Adding and Deleting NetClassNets Two functions add and delete a Schematic design net class net. Input to the TCreateNetClassNet function is a DBX netclassid and a TNet item. The netclassid is declared as a and must be a valid NetClass number. pnet is the net to be added or deleted from the net, and is declared as a TNet with the net structure filled in. TAddNetClassNet(tContext, netclassid, pnet) TDeleteNetClassNet(tContext, netclassid, pnet) DBX TAddNetClassNet and TDeleteNetClassNet functions return a DBX error return status and the number of nets in the net class is incremented or decremented Creating and Deleting ClassToClass Rules Two functions create and delete a Schematic design class to class rules. Input to the TCreateClassToClass function is a DBX TClassToClass item. TCreateClassToClass(tContext, pclasstoclass) TDeleteClassToClass(tContext, pclasstoclass) DBX TCreateClassToClass and TDeleteClassToClass functions return a DBX error return status Modifying Component Attributes Three functions modify component attributes. Input to these functions is the component refdes, which you declare as a string variable in Visual Basic, and as a Char* in C or C++, and the attribute to be added, modified, or deleted, pattribute, declared as a TAttribute. TAddCompAttribute(tContext, refdes, pattribute) TModifyCompAttribute(tContext, refdes, pattribute) TDeleteCompAttribute(tContext, refdes, pattribute) The following TAttribute properties are used when adding an attribute to a component: type, value. The component attribute is added, draw p-cad error dbx32.dll, modified, or deleted to/from all symbols of draw p-cad error dbx32.dll component instance. Use TModifySymbolAttribute to modify the graphical representation of each individual symbol. The following TAttribute properties may be modified using the TModifyCompAttribute function: value. 47

53 DBX Modify Component Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties updated. A deleted attribute will be returned with its DB ID set to zero Modifying Symbol Attributes One function is available to modify a symbol s attributes. Input to this function is draw p-cad error dbx32.dll symbol draw p-cad error dbx32.dll s reference designator (e.g. U1:A) crystal reports error 13001 the attribute to be modified declared as a TAttribute. status = TModifySymbolAttribute(tContext,SymbolRefDes, TAttribute) Only the graphical representation of a symbol is modifiable by this function, including refpoint, textstyle, justification, and visibility. The user can not change its value. Use TModifyCompAttribute to change a symbol s attribute value (note that this value is shared by all symbols in the component). DBX Modify Symbol Attribute function returns any of the following DBX error return status (DBX_ITEM_NOT_FOUND if the target symbol is not found and DBX_MODIFY_ERROR for others). If successful, the function returns an updated DBX TAttribute item. Modified attributes will be returned with all attribute properties updated Modifying Net Attributes Three functions modify net attributes. Input to these functions is the net number, netid, which you declare as a, and the attribute to be added, modified, or deleted, pattribute, declared as a TAttribute. TAddNetAttribute(tContext, draw p-cad error dbx32.dll, netid, pattribute) TModifyNetAttribute(tContext, draw p-cad error dbx32.dll, netid, pattribute) TDeleteNetAttribute(tContext, netid, pattribute) The following TAttribute properties are used when adding an attribute to a net or modifying an existing net attribute: type, and value. Net attributes are not visible. All other properties are ignored when adding or modifying a net attribute. DBX Modify Net Attribute functions return a DBX error return status, draw p-cad error dbx32.dll, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties updated. A deleted attribute will be returned with its DB ID set to zero Modifying Design Attributes Three functions modify design attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddDesignAttribute(tContext, pattribute) TModifyDesignAttribute(tContext, pattribute) TDeleteDesignAttribute(tContext, draw p-cad error dbx32.dll, pattribute) The following TAttribute properties are used when adding an attribute to a design or 48

54 modifying an existing design attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a design attribute. DBX Modify Design Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties updated. A deleted attribute will be returned with its DB ID set to zero Modifying NetClass Attributes Three functions modify NetClass attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddNetClassAttribute(tContext, netclassid, pattribute) TModifyNetClassAttribute(tContext, netclassid, draw p-cad error dbx32.dll, pattribute) TDeleteNetClassAttribute(tContext, netclassid, pattribute) The following TAttribute properties are used when adding a NetClass attribute to a design or modifying an existing NetClass attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a NetClass attribute. DBX Modify NetClass Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified NetClass attributes will be returned with all attribute properties updated. A deleted NetClass attribute will be returned with its DB ID set to zero Modifying ClassToClass Attributes Three functions modify ClassToClass attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) TModifyClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) TDeleteClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) The following TAttribute properties are used when adding a ClassToClass attribute to a design or modifying an existing ClassToClass attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a ClassToClass attribute. DBX Modify ClassToClass Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified ClassToClass attributes will be returned with all attribute properties updated. A deleted ClassToClass attribute will be returned with its DB ID set to zero Saving a Design The following function is used to save the active design. 49

55 TSaveDesign(tContext) The active design will be written to disk in the same manner as if the File Save command was chosen from the P-CAD application menu Selecting Print Jobs Three functions select or deselect the print jobs in the active design. Selected print draw p-cad error dbx32.dll are those that are output during the next print operation. Print jobs are specified in the jobname string. TSelectPrintJob(tContext, draw p-cad error dbx32.dll, jobname) TDeselectPrintJob(tContext, jobname) TSelectAllPrintJob(tContext) the TSelectPrintJob and TDeselectPrintJob functions will select or deselect the print job specified by its name. The TSelectAllPrintJobs function will select all the draw p-cad error dbx32.dll jobs in the active design Printing Print Jobs Two functions print the print jobs of the active design to the current printer. Print jobs are specified in the jobname string. TOutputPrintJobByName(tContext, jobname) TOutputSelectedPrintJobs(tContext) The TOutputPrintJobByName function will print the job specified by its name, regardless of whether or not it has been selected for output. The TOutputSelectedPrintJobs function will print jobs that are selected for output Net Connectivity Issues When Modifying Objects When modifying an object in the editor you receive visual feedback about the operations you are performing on object, draw p-cad error dbx32.dll. This is extremely important when dealing with object draw p-cad error dbx32.dll have net connectivity (i.e. symbols, wires). When you place, flip, rotate, move or otherwise modify an object you have a visual cue as what happens to the objects net connectivity. Through DBX, however many times these visual cues will not be apparent to the DBX programmer. For example, if you flip a symbol so that one or more of its pins intersect a wire DBX has no way of knowing whether you wanted those pins to be connected to the wire. It would be inefficient for the DBX programmer to have to check every net to see if any of the pins on the symbol you flipped were added to a net. DBX s Approach to Adding, Modifying Wires When placing a wire through DBX, you must do so using an existing net ID. The following C++ example shows how to create a net and then place a wire using that net ID: 50

56 TNet anet; TWire awire; strcpy(anet.netname, NET1 ); status = TCreateNet(tContext, anet); if(status!= DBX_OK) { return error message here } awire.netid = anet.netid; set the rest of the wire properties TPlaceWire(tContext,aWire); create the net assign the wire to the net create the wire You could use the net ID to place more wires in the same net, however even if two of them intersected the visual cues (i.e. the Open Ends) will not be resolved. The following figure shows an example of the differences between parts placed through the editor and DBX. DBX s Approach to Adding, Modifying Symbols & Pins Wires are just the visible representation that a symbol or pin has been added to a net. In the editor to add a symbol or pin to an existing wire (and therefore to its underlying net) you would either place or move one of the symbols pins over the wire. Using DBX the same method is not applicable. To add a symbol so that it bes to a net: First determine where on the wire you want to place the symbol. Second place the part using 51

View more

1 P-CAD DBX Programmer's Interface User Guide and Reference This is the User Guide and Reference Manual for the P-CAD Database Exchange (DBX) Programmer's Interface. The P-CAD DBX interface allows you to create custom reports, CAM output, and utility functions by writing user programs that retrieve design data from an active P-CAD PCB or Schematic design session. The DBX interface also allows you to modify an P-CAD P-CAD PCB or Schematic design by placing new design objects or modifying properties of existing objects. Similarly, DBX provides the capability to read and write specific data from/to P-CAD Library Manager and P-CAD Library Executive. This User Guide and Reference includes general user information, programming hints, definition of the functional interface and its data structures, and some basic examples. Draw p-cad error dbx32.dll document is formatted so that it is suitable for both viewing on your screen and printing hardcopies. To print this document, choose the File Print command while this document is loaded in Microsoft Word or WordPad. The first-time user should read Section 1 for an overview of P-CAD DBX and its capabilities. Then, when you are ready to write your first user program, skim Sections 2 through 7 to learn the key aspects and features of the interface, what data is available, draw p-cad error dbx32.dll, and how to manipulate it. Section 8 provides an overview of project development, with Section 8.4 and 8.5 including Visual Basic and C++ specifics. Examples are provided in Section 8.6, and online. Referring to these examples, and copying the examples to use as a starting point is highly recommended. Important Information about P-CAD 2004 Version The supplied DBX32.H and DBX32.BAS source files have been updated. For your existing applications you need to recompile and relink your source programs using the supplied DBX32.H (for C or C++ programs) or DBX32.BAS (for Visual Basic programs). Layer Stackup Support (PCB): Support has been added for the new layer stackup data. This includes one new data structure TLayerStackup. Contained within are four char arrays; layername, layermaterial, layerthickness, layerdialectricconstant. With the data structure are two functions TGetFirstLayerStackup and TGetNextLayerStackup for fetching the data. Layer and Sheet Suppor (PCB/Schematic): Two new functions, TAddLayer and TAddSheet have been added to allow creation of layers/sheets in a design. Pad and Via Style Support: Four new functions were added to support retrieving pad and via style data. They are: TGetFirstPadStyle, TGetNextPadStyle, TGetFirstViaStyle, and TGetNextViaStyle. Copyright 2006 Altium Limited i

2 Contents 1 Introduction to DBX What is P-CAD DBX? Document Conventions Data Overview Functional Overview Retrieving Net Data - A Brief Example Modifying Components - A Brief Example Interface Summary Function Naming Conventions Status and Error Returns Stateful Functions Declaring User Data Using P-CAD DBX-Supplied Structures The P-CAD DBX TItem Using a TItem to Modify Design Data Database Units vs. User Units Default Item Origins for Modify Operations DBX Conversation Structure tcontext Opening, Closing, and Saving a Design Retrieving Data - PCB Extracting General Design Data Extracting Layers and Layer Data Extracting Layer Items Extracting Nets and Net Data Extracting NetClasses and NetClass Data Extracting ClassToClass Data Extracting Net Nodes and Net Items Extracting NetClassNets and Net Data Extracting Components and Component Data Extracting Component Pad and Pattern Data Extracting Pad, Via, and Text Style Data Extracting Pad and Via Shape Data Extracting Rooms and Room Data Extracting Room Points Extracting Room Components Extracting Grids and Grid Data Extracting Attributes Extracting Polygon Points Extracting Items from the Current Selection Set Extracting Print Jobs Extracting Layer Stackup ii

3 3.

4 5.

5 8 Building a User Program DBX32.H and DBX32.BAS Unit Conversion Utilities Status and Error values Using Visual Basic as a Development Environment for DBX Overview Creating a project Including DBX32.BAS Adding User Code Using Existing Basic Programs String Handling Executing the Program Using Visual Draw p-cad error dbx32.dll as a Development Environment for DBX Overview Installing Visual C Creating a project Setting the Project Options Including DBX32.H Linking to DBX32.DLL and DBX32.LIB Adding User Code Executing the Program Examples Opening and closing a design Retrieving layer and component data Retrieving specific item data Common Run-time Errors Running a DBX User Program with P-CAD Online Sample Programs Upgrading DBX Programs Appendix A: DBX Data Constants Appendix B: P-CAD DBX Data Types and Globals Appendix C: P-CAD DBX Functions v

6 1 Introduction draw p-cad error dbx32.dll DBX 1.1 What is P-CAD DBX? P-CAD DBX is a programmatic interface that allows you to retrieve or modify design data from an active P-CAD PCB or Schematic design using your own Visual Basic, C, or C++ programs. Data is retrieved from the design by making P-CAD DBX library function calls. Design data is modified by making DBX library function calls with PCB design data items as input. Similarly, there is a DBX interface to the Component Library Manager and Library Executive. By using the P-CAD DBX interface, you can create interactive design query functions, custom report generators, or custom design file output. You can also create custom applications that make modifications to the active design based on your own specific design needs. Since the interface communicates directly with an active P-CAD design session, your DBX user programs can perform custom database queries and modifications as you design, without the need to generate intermediate files that your program must then parse, interpret, and modify. Your DBX user program can extract or modify as much, or as little, detailed information as is needed. The P-CAD DBX Programmer's Interface includes a functional interface (a "function library"), pre-defined data structures, support files and utilities, examples, and a user guide. This interface may be called by any Windows application that can reference Windows Dynamic Link Libraries (DLLs). Developing DBX applications using either the Visual Basic or Visual C++ development environment is described in this draw p-cad error dbx32.dll. It is recommended that programmers less familiar with developing Windows applications use either Visual Basic or the Windows application development environment with which you are already familar. By using one of the Windows development environments available and the supplied code samples provided with P-CAD DBX, novice and experienced programmers alike will find this a convenient, yet extremely flexible tool to enhance your development process. This guide provides an overview that describes the use of two prevalent Windows development environments: Visual Basic and Visual C Document Conventions P-CAD supplied functions and datatype names are bolded. Function parameters, when referred to within the body of the text of this manual, are shown in italics. Filenames are shown in CAPITAL letters. User variables and structure member data are shown in lower case, with all words capitalized except the first word. 1.3 Data Overview The P-CAD DBX Programmer's Interface provides direct access to all key PCB, Schematic, and Library data. DBX programs may retrieve and modify PCB and Schematic design information about the current design: layers, sheets, nets, components, pads, vias, styles, symbols, component patterns, connections, routed 1

7 traces, polygons, pours, text items, netclasses, class to class rules, rooms, grids and attributes. DBX programs may retrieve and modify Library Manager or Library Executive library objects, including components, draw p-cad error dbx32.dll, symbols, and patterns. Predefined data structures and data types are provided for easy retrieval and access to the specific data defining these items. These data structures are provided as Visual Basic User Defined Types for Visual Basic user programs, and as C structures for C and C++ user programs. An example is the TNet structure defined in Visual Basic as the User Defined Structure TNet: Type TNet netid as Long netname as String*DBX_MAX_NAME_LEN nodecount draw p-cad error dbx32.dll Long; length as Long; isplane as Long; TNet; and in C as a structure Typedef TNet: typedef struct { netid; char netname[dbx_max_name_len]; nodecount; length; isplane; } TNet; TArc, TAttribute, TClassToClass, TComponent, TDesign, Tgrid, TLine, TLayer, TNetClass, TPad, TPadViaShape, TPadViaStyle, TPin, TPoly, TPour, TRoom, TSymbol, TText, TTextStyle, draw p-cad error dbx32.dll, and TVia are defined similarly. An overview of the data and functions to retrieve the data returned in these structures is provided in Sections 3 through 7 of this document. Note that many data items and function calls are shared between PCB, Schematic and Library Manager, with Library Manager and Library Executive being identical. This helps simplify the interface, and makes it possible for some DBX programs to be written such that they access multiple P-CAD products without any changes or a recompile. The actual structure definitions, types, and sizes are provided for reference in Appendix B. User programs reference the data in the predefined structures by declaring a DBX item and examining or assigning values to the individual data elements within the structure. An example of declaring a TNet item and accessing TNet data is given in Section Functional Overview The P-CAD Draw p-cad error dbx32.dll interface provides the ability to extract or modify complete design information, yet is still easy to use and flexible enough to satisfy a variety of user needs. Function input arguments are simple, with consistent, predefined data output formats returned by each function. Each function call returns a status value indicating success or failure, and if failure, what type of failure. The P-CAD DBX interface retrieves data in a top-down fashion. In other words, highlevel functions provide high level data, with subsequent calls available racoon error rejected enctype access more 2

8 detailed and in-depth data. The interface additionally uses a "get first", "get next" approach to return design data with a variable number of items. This approach eliminates the need to define large arrays and data structures within your program to hold potentially large amounts of data, where the size of the array would be dependent on the size of the design being accessed. For example, functions returning P-CAD PCB net data, net items, and net nodes are: TGetFirstNet TGetNextNet TGetNetById TGetNetByName TGetFirstNetItem TGetNextNetItem TGetFirstNetNode TGetNextNetNode Design modification and updates are performed by function calls that have a DBX item as input to the function. Input to these functions are the same DBX items that are returned by the data extraction function calls. For example, functions to modify an existing PCB component are: TFlipComponent TMoveComponent TRotateComponent THighlightComponent TUnHighlightComponent TModifyComponent TDeleteComponent and to place or delete a component: TPlaceComponent TDeleteComponent The next sections provide an example of how these functions and DBX data types may be used. 1.5 Retrieving Net Data - A Brief Example Retrieving data about an P-CAD PCB net is an example demonstrating this type of interface and how the interface is used. Function TGetFirstNet and TGetNextNet return general net data for a P-CAD PCB net including net length, number of nodes, and the net name. The output data is returned in a P-CAD DBX data structure called TNet. If you were interested in the length of the net, for example, your program would declare a DBX item anet as a TNet structure, and examine anet.length, a member of the DBX item anet. In addition, if your program needed to retrieve data on the nodes which define the net, a call maybe made to TGetFirstNetNode to retrieve the first node in the net, followed by 3

9 calls to TGetNextNetNode for each subsequent node in the net, until either all nodes have been retrieved or you have located a particular node of interest. In this way a user program may be written to access all nodes in a net (or all nets, draw p-cad error dbx32.dll, for that matter) without knowing in advance what the largest net to be handled is expected. The following examples find the length of the est net in the current P-CAD PCB design. Using Visual Basic: Dim mynet as TNet Dim maxnetlength as Long status = TGetFirstNet(tContext,myNet) maxnetlength = mynet.length Do While (tstatus == DBX_OK) tstatus = TGetNextNet(tContext,myNet) if (mynet.length > maxnetlength) then maxnetlength = mynet.length endif Loop Using C: TNet mynet; maxnetlength; status = TGetFirstNet(tContext,myNet); maxnetlength = mynet.length; while (tstatus == DBX_OK) { tstatus = TGetNextNet(tContext,myNet); if (mynet.length > maxnetlength) { maxnetlength = mynet.length; } } Variables tstatus and tcontext are explained in Section 2.2, 2.9 and Complete examples are provided in Section 8.6, and in the online sample programs included with your P-CAD DBX installation files. The online sample programs are described in Section 10 of this manual. 1.6 Modifying Components - A Brief Example Retrieving all of the components in a PCB design and flipping each component that meets a certain criteria is an example of modifying active design data. Functions TGetFirstComponet and TGetNextComponent return general component data for an P-CAD PCB component including component type, refdes, pattern name, number of pins, library, location and orientation. The output data is returned in a P-CAD DBX data structure called TComponent. If you were interested in the component type, 4

10 for example, your program would declare a DBX item acomponent as a TComponent structure, and examine acomponent.comptype, a member of the DBX item acomponent. In addition, if your program needed to retrieve and modify the component pads, calls to GetFirstCompPad and GetNextCompPad, followed by the appropriate function call to modify each pad would update the component's pads. The following example retrieves all of the design components, and flips the component if the component is of type Using Visual Basic: Dim mycomponent as TComponent status = TGetFirstComponent(tContext,myComponent) Do While (tstatus == DBX_OK) if (trim(mycomponent.comptype) = "7400") then status = TFlipComponent(tContext,myComponent) if (status <> DBX_OK) then go to ErrorHandler endif tstatus = TGetNextComponent(tContext,myComponent) Loop Using C or C++: TComponent mycomponent; status = TGetFirstComponent(tContext,myComponent); while (tstatus == DBX_OK) { if (stricmp(mycomponent.comptype,"7400")==0) { status = TFlipComponent(tContext,myComponent); if (status!= DBX_OK) { break; } tstatus = TGetNextComponent(tContext,myComponent) } } Variables tstatus and tcontext are explained in Sections 2.2, 2.9, and Complete examples are provided in Section 8.6, and in the online sample programs included with your P-CAD DBX installation files. The online sample programs are described in Section 10 of this manual. 5

11 2 Interface Summary This section provides an overview of some of the fundamental aspects and features of the P-CAD DBX interface. Specific details on item definitions, sizes, and values are listed in Appendix B. Function syntax and parameters are described in Appendix C. Mnemonic constants mentioned in this section are listed in Appendix A. All of the information presented in Appendices A-C may be found online in the file DBX32.H. 2.1 Function Naming Conventions All P-CAD DBX functions are prefaced with the capital letter 'T'. This convention helps draw p-cad error dbx32.dll distinguish P-CAD-supplied DBX functions from your user function and program names. In addition, the first letter of each word in the function name is capitalized. Visual Basic is not case sensitive, so this capitalization convention may be followed or ignored based on your own preference. For 'C' programs, however, the case must be observed or the functions will be listed as "undeclared" at compile time, draw p-cad error dbx32.dll. 2.2 Status and Error Returns All P-CAD DBX functions return a completion status value. This status is an integer value. For ease of use, each value is represented by a mnemonic constant declared in DBX32.H and DBX32.BAS, draw p-cad error dbx32.dll. All status constants are prefaced by "DBX_", (for example, DBX_ITEM_NOT_FOUND) and are grouped according to completion status and severity of the error. The value of DBX_OK is zero. All other return values are non-zero, beginning at This convention will allow non-zero status checking by 'C' programs, and direct use of the Visual Basic error handling tools without conflicting with pre-defined Visual Basic error return values. Note that many of these non-zero status values returned are not necessarily errors. They may indicate normal operating conditions, like DBX_NO_MORE_ITEMS, for example. A complete list of all status values may be found in DBX32.H or DBX32.BAS. A global variable tstatus has also been declared in both DBX32.H and DBX32.BAS. This variable may be used directly by your user program, as is shown in the following examples. 2.3 Stateful Functions Any function prefaced by "GetNext" indicates that it is a stateful function, retrieving the next sequential data item from the list of related data items being retrieved. Layer and Net functions return items in order of layer number and Net ID. Other functions return draw p-cad error dbx32.dll in the order the items are stored in the P-CAD database. Except for layers and nets, this order is design dependent and should not be assumed to be consistent from DBX program session to session. Function calls which set the internal program state to a particular item in the sequence are those prefaced by "GetFirst". A GetFirst function must be called prior to calling any GetNext function or the error status DBX_GETFIRST_NOT_CALLED will be returned. 6

12 GetNext functions can be called after a GetFirst function call and will return the next sequential item after the GetFirst or GetBy item returned. 2.4 Declaring User Data Using P-CAD DBX-Supplied Structures There are two P-CAD supplied files providing structure definitions you may use directly within your user program to define local variables and structures. The files are DBX32.H and DBX32.BAS. DBX32.H includes C structure typedefs, and is used by user programs written in C or C++. DBX32.BAS includes Visual Basic Declare Draw p-cad error dbx32.dll definitions, and is used by user programs written in Visual Basic. For example, to declare a local DBX item mynetdata to be used with the TGetFirstNet function, you would use: Dim mynetdata as TNet in the declarations section of a Visual Basic program, or TNet mynetdata; in the declarations section of a C program. In either language, the local DBX item and its member data are accessed and named identically. As in the previous example, to access the net length of a net after a Get*Net call, you would use the syntax: mynetlength = mynetdata.length; (no semi-colon in VB) As with other supported datatypes, you can declare arrays of DBX items. Continuing with the net data example, to declare an array of 100 TNet items, you would use the following syntax: Dim mynetarray as TNet(100) (from Visual Basic) TNet mynetarray[100]; (from C) 2.5 The P-CAD DBX TItem The P-CAD DBX structure TItem is used to create a special type of DBX item. It is used to declare a DBX item that can receive data from functions that may return one of many types of design items. For example, TGetFirstLayerItem and TGetNextLayerItem functions accessing a PCB design may return an arc, component, line, pad, point, polygon, copper pour, text, or a via on a single call. The P-CAD DBX TItem structure eliminates the need for your program to know in advance what type of item is about to be returned from a function by defining a structure gabbaplanet.clan.su this is terror can represent each of these different item types. It is also defined so that draw p-cad error dbx32.dll structure elements have easy to reference data elements with consistent meanings regardless of the type of item it contains. Dim myitem As TItem (for Visual Basic) TItem myitem; (for C) After extracting a DBX item, you can access the TItem data directly. To examine the 7

13 radius of an arc returned by TGetNextLayerItem, for example, you could use the following statement: status = TGetNextLayerItem(tContext, myitem) arcradius = myitem.arc.radius Alternatively, the item returned can be copied directly to a local DBX item, in this case an arc item, and the arc specific information retrieved from the local DBX item myarc by: Dim myitem As TItem (for Visual Basic) Dim myarc as TArc status = TGetNextLayerItem(tContext, myitem) myarc = myitem.arc arcradius = myarc.radius Either approach will generate identical results. The former is preferred if only a select amount of information is needed, while the latter is generally more convenient if you will be using the data from this particular arc in many places or referencing the data many times, since it requires less typing. The items returned by these functions are: arc attribute bus ClassToClass CompPin component Design detail diagram field grid layer line metafile net NetClass pad PadViaShape PadViaStyle Pattern pin point Poly port pour PrintJob Room symbol table text TextStyle via wire 8

14 The TItem structure includes a field which is present for all item types returned: itemtype. This field is an integer value indicating what type of item has been returned in the TItem structure, draw p-cad error dbx32.dll. By using this value after a get Item function call (e.g. GetFirstLayerItem), you can determine what type of item has been returned and process the data appropriately. These item types are enumerated in both DBX32.H and DBX32.BAS. For ease of use, readability, and future program compatibility, we strongly recommend that you use the mnemonic constants within your program and not the integer values they represent. For example, to determine if the item returned is an arc item: if myitem.itemtype = DBX_ARC if myitem.itemtype = 3 ' Right ' Wrong You can declare arrays of TItem items, but due to the size requirements for TItem, you should not declare large arrays of TItems, but declare arrays of the specific DBX draw p-cad error dbx32.dll type you intend draw p-cad error dbx32.dll keep instead, draw p-cad error dbx32.dll, an array of TLine items, for example. 2.6 Using a TItem to Modify Design Data Several functions are available to modify PCB design data using a TItem directly as an input argument. This provides a mechanism to generically retrieve and modify a set of items without specifically writing code to make different Draw p-cad error dbx32.dll Modify calls based on the type of item retrieved. This is especially useful when using calls that return a TItem like GetFirstNetItem and GetNextNetItem, draw p-cad error dbx32.dll, followed by a DBX Modify call to update those items regardless of the item type. For example, to retrieve all of the items in a specific net and highlight those items, draw p-cad error dbx32.dll, you would use the GetFirstNetItem/GetNextNetItem calls followed by a call to THighlightItem with the extracted TItem as input to the highlight call. The generic DBX Modify item functions are: TFlipItem TMoveItem TModifyItem TRotateItem THighlightItem TUnHighlightItem TDeleteItem 2.7 Database Units vs. User Units All functions returning or requiring size, location, length, width, or rotation values use values in database units. Using database units preserves database accuracy, and allows user programs to work in their unit of choice: database, mils, millimeter, or user defined. Database units are defined as 2540 database units per mil, and database units per mm. Rotation values are represented at the ratio of 10 database units per degree of rotation (in other words, 3600 database units is draw p-cad error dbx32.dll to 360 degrees). As a convenience, DBXUTILS.H (for C and C++user programs) and DBXUTILS.BAS (for Visual Basic user programs) provide utility functions that convert database units to and from mils and mm, draw p-cad error dbx32.dll, both as numbers and as strings. 9

15 2.8 Default Item Origins for Modify Operations DBX Flip and Rotate functions have an optional parameter to specify the point about which to flip or rotate the item. If this point is not specified (by setting the x and y coordinate values of the rotate or flip point to -1) a default item origin is used for the operation. The default origin depends on the type of the item being flipped or rotated and is as follows in the form (x,y): Arc: (centerpt.x, centerpt.y) Attribute: (refpoint.x, refpoint.y) Bus: (startpt.x, startpt.y) Component: (refpoint.x, refpoint.y) Field: (refpoint.x, refpoint.y) Line: (startpt.x, startpt.y) Free Pad or Via: (center.x, center.y) Pin: (refpoint.x, refpoint.y) Point: (point.x, point.y) Port: (point.x, point.y) Symbol: (refpoint.x, refpoint.y) Table: (refpoint.x refpoint.y) Text: (refpoint.x, refpoint.y) Wire: (startpt.x, starrtpt.y) The default flip or rotate point can be overridden by specifically setting the appropriate input argument to the function to have the coordinates of the flip or rotate point. See sections 5.1, 5.2, 6.1, and 6.2 for more information on how to do this. 2.9 DBX Conversation Structure tcontext P-CAD DBX user programs communicate with P-CAD applications using Windows Dynamic Data Exchange (DDE) protocols. Using this protocol allows DBX programs to communicate directly with an active P-CAD application during a design session, draw p-cad error dbx32.dll. The DDE protocol requires certain conversation identification information each time one process communicates with another. This information is returned by TOpenDesign (TOpenLibrary in P-CAD Library Manger) in a P-CAD supplied structure called TContext, and must be passed to each DBX function call after the TOpenDesign call. For convenience, a global variable tcontext is provided in DBX32.H and DBX32.BAS and may be used directly by your user program to receive and maintain this information. The global draw p-cad error dbx32.dll tcontext is used throughout this manual and in the samples provided with your P-CAD DBX installation. Opening and closing a library is detailed in section Opening, Closing, and Saving a Design You establish a connection between your user program and the PCB or Schematic design session by "opening" a design. To open the design, you use the function TOpenDesign, providing some basic draw p-cad error dbx32.dll the version of the P-CAD DBX software you are using, and the type of language you are using to write your user program, and the P-CAD application name, either "pcb" or "sch". TOpenDesign returns the P-CAD-supplied TContext structure tcontext, which describes the connection you just established. Draw p-cad error dbx32.dll TContext structure must be used in all subsequent DBX function 10

16 calls to identify the DBX conversation. For example, to open the current P-CAD PCB design: TOpenDesign(DBX_LANGUAGE, DBX_VERSION, pcb,tcontext) DBX_VERSION and DBX_LANGUAGE are constants provided by P-CAD DBX and may be used exactly as written here. Also defined in DBX32.H and DBX32.BAS is tcontext, a global variable which may also be used exactly as written here, and in subsequent function calls, to accept and maintain the conversation context information. The 3rd argument to TOpenDesign, the P-CAD Application:Design name, should have a value of either "pcb" or "sch" to signify which P-CAD application to open. To provide easier migration of TangoPRO DBX programs to P-CAD, using an empty string ("") for the application name will open P-CAD PCB by default. Optionally, a colon followed by the full path and design file name may be specified. For example, pcb:c:\p- CAD\files\demo2.pcb,may be used to open the c:\p-cad\files\demo2.pcb design file in P-CAD PCB. If no design file name is specified, then the current design in the P-CAD application is used. If the design file name matches an existing open design, then that design will become the current design. If the design file name does not specify an draw p-cad error dbx32.dll file or there are any errors while loading the design then DBX_FILE_OPEN_FAILURE will be returned. To save the current design, use TSaveDesign. This will write the current design to the file it was loaded from. If the current design is Untitled, you will be prompted by the P- CAD application for the file name to save to. The design will always be saved even if no changes have been made. To determine if the current design has been modified, see TGetDesignInfo s ismodified flag. To end your DBX session, use TCloseDesign. Note that tcontext is the global structure returned by TOpenDesign. TCloseDesign(tContext,"") If the empty string ( ) is specified for the second argument then the connection is closed but the design is left open in the P-CAD application. Optionally you may specify Draw p-cad error dbx32.dll as hlae failed with error 108 second argument to close the connection to the P-CAD application and close the design also. Important: TCloseDesign will not save the design even if changes have been made. A DBX conversation with P-CAD PCB or Schematic may also be terminated by clicking Cancel on the dialog which is presented in the design window when your DBX program begins executing. Using TCloseDesign is the preferred method, but the Cancel dialog is useful should your DBX program terminate abnormally or find itself in an infinite loop from which you cannot exit. The Cancel dialog will return P-CAD PCB or Schematic to a state from which you can safely continue your PCB design session. For information about Library DBX see sections 7.1 on opening and closing a component library. 11

17 3 Retrieving Data - PCB This section provides a summary of the interface functions and data returned by P-CAD DBX PCB functions when retrieving P-CAD PCB design information. The functions are grouped by the type of data they retrieve. For a detailed description of each function, its arguments, or P-CAD DBX structure contents, see DBX32.H, or the appendices at the end of this manual. To enable code sharing between DBX applications used for PCB, Schematic, and Library Manager or Library Executive, function calls and DBX items are intentionally similar where possible. 3.1 Extracting General Design Data General design information is retrieved using the function TGetDesignInfo(tContext,designInfo) where tcontext is the structure returned by TOpenDesign. Design data is returned the structure designinfo, which you declare as type TDesign. The TGetDesignInfo function returns general board information including the board size, workspace extents, relative grid origin, design name, title, author, version, date and modified flag. 3.2 Extracting Layers and Layer Data Four functions return layer data. Layer data is returned in the DBX item mylayerdata, which you declare as type TLayer. TGetFirstLayer(tContext,myLayerData) TGetNextLayer(tContext,myLayerData) TGetLayerById(tContext,layerId,myLayerData) TGetLayerByName(tContext,layerName,myLayerData) Layer functions GetFirstLayer, GetNextLayer, GetLayerById, and GetLayerByName return layer name, layerid, type and bias, clearances, and plane status. 3.3 Extracting Layer Items Two functions return the items being to a P-CAD PCB layer. Item data is returned in the DBX item myitem, which you declare as type TItem. See section 2.5 for a discussion of the TItem structure and its usage. TGetFirstLayerItem(tContext,layerId,myItem) TGetNextLayerItem(tContext,myItem) Layer Item functions GetFirstLayerItem and GetNextLayerItem return PCB design items located on a layer in a TItem data item. The items returned include arcs, attributes, components, connections, cutouts, details, draw p-cad error dbx32.dll, diagrams, keepouts, lines, metafiles, pads, polygons, points, copper pours, tables, text, and vias, draw p-cad error dbx32.dll. 12

18 3.4 Extracting Nets and Net Data Four functions return net data. Net data is returned in the DBX item mynetdata, which you declare as type TNet. TGetFirstNet(tContext,myNetData) TGetNextNet(tContext,myNetData) TGetNetById(tContext,netId,myNetData) TGetNetByName(tContext,netName,myNetData) Net functions GetFirstNet, GetNextNet, GetNetById, and GetNetByName return net name, netid, net length, number of nodes, and plane status. 3.5 Extracting NetClasses and NetClass Data Four functions return NetClass data. NetClass data is returned in the DBX item mynetclassdata, which you declare as type TNetClass. TGetFirstNetClass(tContext,myNetClassData) TGetNextNetClass(tContext,myNetClassData) TGetNetClassById(tContext,netClassId,myNetClassData) TGetNetClassByName(tContext,netClassName,myNetClassData) NetClass functions GetFirstNetClass, GetNextNetClass, GetNetClassById, draw p-cad error dbx32.dll, and GetNetClassByName return netclassname, netclassid, number of nets. 3.6 Extracting ClassToClass Data Three functions return ClassToClass data. ClassToClass data is returned in the DBX item myclasstoclassdata, which you declare as type TClassToClass. TGetFirstClassToClass(tContext,myClassToClassData) TGetNextClassToClass(tContext,myClassToClassData) TGetClassToClassById(tContext,netClassId1,netClassID2, myclasstoclassdata) ClassToClass functions GetFirstClassToClass, GetNextClassToClass and GetClassToClassById return NetClassName1, NetClassName2, NetClassID1 and NetClassID2, draw p-cad error dbx32.dll. Note that NetClassID1 must be less than or equal to NetClassID2 in function TGetClassToClassById. 3.7 Extracting Net Nodes and Net Items Four functions return the items and nodes defining a P-CAD PCB Net. Item data is returned in the DBX item myitem, which you declare as type TItem. See Section 2.5 for 13

19 a discussion of the TItem structure and its usage. TGetFirstNetItem(tContext,netId,myItem) TGetNextNetItem(tContext,myItem) TGetFirstNetNode(tContext,netId,myItem) TGetNextNetNode(tContext,myItem) Net Item functions GetFirstNetItem and GetNextNetItem return PCB design items defining a net in a TItem data item. The items returned include arcs, connections, lines, draw p-cad error dbx32.dll, and vias. Net Node functions GetFirstNetNode and GetNextNetNode return PCB 800b0100 windows update error items which are the nodes in the net in a TItem data item. These items include pads. 3.8 Extracting NetClassNets and Net Data Two functions return NetClassNet data. NetClassNet data is returned in the DBX item mynetdata, which you declare as type TNet. TGetFirstNetClassNet(tContext,netClassId,myNetData) TGetNextNetClassNet(tContext,myNetData) NetClassNet functions GetFirstNetClassNet and GetNextNetClassNet return net name, netid, net length, number of nodes, and plane status. 3.9 Extracting Components draw p-cad error dbx32.dll Component Data Three functions return component data. Component data is returned in the DBX item mycompdata, which you declare as type TComponent, draw p-cad error dbx32.dll. TGetFirstComponent(tContext,myCompData) TGetNextComponent(tContext,myCompData) TGetCompByRefDes(tContext,compRefDes,myCompData) Component hddscan ultra dma crc error count GetFirstComponent, GetNextComponent, draw p-cad error dbx32.dll, and GetCompByRefDes return Component ID, refdes, component type, value, pattern name, location, number of draw p-cad error dbx32.dll, bounding box, and orientation information in a TComponent data item Extracting Component Pad and Pattern Data Four functions return the pads and pattern items defining a PCB Component. Pad items are returned in the DBX item mypad, which you declare as type TPad. Pattern item data is returned in the DBX item myitem, which you declare as type TItem. See section 2.5 for a discussion of the TItem structure and its usage. TGetFirstCompPad(tContext,refDes,myPad ) TGetNextCompPad(tContext,myPad) 14

20 TGetFirstCompItem(tContext,refDes,myItem) TGetNextCompItem(tContext,myItem) Pad and Via data returned by Layer Item, Net Item, and Component Pad functions includes location, pad or via style ID, the net ID, rotation, and bounding box information. Data for pads and vias is returned in TPad and TVia data items, respectively. Pad data additionally includes the pad pin number, pin designator, pin type, and component refdes. Component Item functions GetFirstCompItem and GetNextNetCompItem return the PCB design items defining the component pattern in a TItem data item. The items returned include arcs, lines, points, polygons and text Extracting Pad, Via, and Text Style Data Pads, Vias, and Text items each include a StyleId as part of their definition. This StyleId value may be used to get information about a style in general, or more specific information about the current pad/via/text item being examined. There are three functions available to retrieve style information for pads, via, and text. Style information is returned in mypadstyle (or mytextstyle, myviastyle), which you declare as TPadStyle (or TTextStyle, TViaStyle). TGetPadStyle(tContext,padStyleId,myPadStyle) TGetTextStyle(tContext,textStyleId,myTextStyle) TGetViaStyle(tContext,viaStyleId,myViaStyle) Given a StyleId, GetPadStyle and GetViaStyle functions return the style type, style name, hole diameter, and x and y offsets in a TPadViaStyle data item. Note that valid style ids range from 0 to 99 each for text, pad, and via styles. The styles used may not be consecutive, however, so looping through the style ids from 0 until a DBX_STYLE_NOT_FOUND to find all valid styles may stop too soon if there are "holes" in the used style ids. The correct approach is to loop from 0 to 99, recording which styles are valid based on the status returned from the GetStyle function. Another draw p-cad error dbx32.dll to loop over pad or via styles is to use TGetFirstPadStyle and TGetNextPadStyle, or TGetFirstViaStyle and TGetNextViaStyle. These functions will skip any holes in the used style ids. Text Style function TGetTextStyle returns the style name, font type, pen width, and text height in a TTextStyle data item Extracting Pad and Via Shape Data There is a significant amount of design data which may be different for each pad, or more accurately, for each pad style on each of the active layers. This is also true for vias. There are two functions available to retrieve layer specific shape data from a pad or via style. Draw p-cad error dbx32.dll is returned in mypadshape for pad shapes, and myviashape for vias, which you declare as TPadShape and TViaShape, respectively. TGetPadShapeByLayer(tContext,padStyleId,layerId,myPadShape) TGetViaShapeByLayer(tContext,viaStyleId,layerId,myViaShape) TGetPadShapeByLayer or TGetViaShapeByLayer functions return pad or via style, 15

21 layer type, hole diameter, shape, width, and height (or for thermals: outer diameter, inner diameter and spoke width) in a TPadViaShape data item Extracting Rooms and Room Data Two functions return room data. Room data is returned in the DBX item myroomdata, which you declare as type TRoom. TGetFirstRoom(tContext,myRoomData) TGetNextRoom(tContext,myRoomData) Room functions TGetFirstRoom and TGetNextRoom return room name, draw p-cad error dbx32.dll, room ID, number of included components, boundary rectangle, placement side, is fixed, is flipped, is highlighted, room fill pattern, reference point and rotation angle Extracting Room Points Two functions return room point data. Room point data is returned in the DBX item mypointdata, which you declare as type TPoint. TGetFirstRoomPoint(tContext,roomId,myPointData) TGetNextRoomPoint(tContext,myPointData) Room Point functions TGetFirstRoomPoint and TGetNextRoomPoint return item ID, x, y, point type, number, text info string, layer Id, is flipped, is visible and is highlighted Extracting Room Components Two functions return room component data. Room component data is returned in the DBX item mycompdata, draw p-cad error dbx32.dll, which you declare as type TComponent. TGetFirstIncludedRoomComponent(tContext,roomId,myCompData) TGetNextIncludedRoomComponent(tContext,myCompData) Room component functions TGetFirstincludedRoomComponent and TGetNextIncludedRoomComponent return component Id, reference designator string, component type string, value string, pattern name, library name, reference point, boundary rectangle, rotation angle, number of pads, number of pins, number of parts, is alpha, is flipped, is highlighted, is heterogeneous, connection type and is fixed Extracting Grids and Grid Data Two functions return grid data. Grid data is returned in the DBX item mygriddata, which you declare as type TGrid. TGetFirstGrid(tContext,myGridData) TGetNextGrid(tContext,myGridData) Grid functions TGetFirstGrid and TGetNextGrid return grid ID and grid spacing which is 16

22 a string containing the spacing values separated by a comma Extracting Attributes Fourteen functions return the attributes which are associated with design, layer, net, net class, class to class, room or component. Attribute data is returned in myattr, which you declare as TAttribute. For components, you specify the component refdes using a string variable in Visual Basic, or a Char* in C or C++. For all others specify the ID declared as a. TGetFirstDesignAttribute(tContext, myattr) TGetNextDesignAttribute(tContext, myattr) TGetFirstLayerAttribute(tContext,layerId, myattr) TGetNextLayerAttribute(tContext, myattr) TGetFirstNetAttribute(tContext,netId, myattr) TGetNextNetAttribute(tContext, myattr) TGetFirstNetClassAttribute(tContext, NetClassId,myAttr) TGetNextNetClassAttribute(tContext, myattr) TGetFirstClassToClassAttribute(tContext, NetClassId1, NetClassId2, myattr) TGetNextClassToClassAttribute(tContext, myattr) TGetFirstRoomAttribute(tContext, RoomId,myAttr) TGetNextRoomAttribute(tContext, myattr) TGetFirstCompAttribute(tContext,refDes,myAttr) TGetNextCompAttribute(tContext, myattr) The above functions return type and value strings for each attribute associated with the class in a TAttribute data item. These attributes also include location, style, and orientation information. Additionally, the layer functions return pre-defined clearance information Extracting Polygon Points Two functions return the points defining a polygon. Point data is returned in mypoint, which you declare as type TPoint. TGetFirstPolyPoint(tContext,polyId,myPoint) TGetNextPolyPoint(tContext,myPoint) TGetFirstPolyPoint and TGetNextPolyPoint return the point location and layer id TPoint data item Extracting Items from the Current Selection Set Two functions return the draw p-cad error dbx32.dll in the active design selection set (items you have selected by Block Select or selecting individual items). Item data is returned in selectitem, which you declare as type TItem. TGetFirstSelectedItem(tContext,selectItem) TGetNextSelectedItem(tContext,selectItem) 17

23 Get Selection functions return selected items in a TItem data item. The item types returned in the TItem include arc, attribute, connection, component, cutout, detail, diagram, keepout, line, metafile, draw p-cad error dbx32.dll, pad, point, polygon, pour, table, text, and via Extracting Print Jobs Two functions return the print jobs in the active design, draw p-cad error dbx32.dll. Print job information is returned in ajob, which you declare as type TPrintJob. TGetFirstPrintJob(tContext, ajob) TGetNextPrintJob(tContext, ajob) Print Job functions TGetFirstPrintJob and TGetNextPrintJob return the name of the print job and if it is selected for output during a print operation Extracting Draw p-cad error dbx32.dll Stackup Two functions retrieve the layer stackup information in the active design. Layer stackup information is returned in pstackup, which you declare as type TLayerStackup. TGetFirstLayerStackup(tContext, pstackup) TGetNextLayerStackup(tContext, pstackup) Layer Stackup functions TGetFirstLayerStackup and TGetNextLayerStackup return a TLayerStackup struct that contains the layername, layermaterial, layerthickness, and layerdialectricconstant Extracting Variants These methods are used for retrieving draw p-cad error dbx32.dll the existing Variants in a design. TGetFirstVariant(DbxContext* pcontext, TVariant* pvariant) TGetNextVariant(DbxContext* pcontext, TVariant* pvariant) Variant functions TGetFirstVariant and TGetNextVariant return TVariant structure that contains the Variant name, description, and id. 18

24 4 Retrieving Data - Schematic This section provides a summary of the interface functions and data returned by P-CAD DBX functions when retrieving P-CAD Draw p-cad error dbx32.dll data. The functions are grouped by the type of data they retrieve. For a detailed description of each function, its arguments, or P-CAD DBX structure contents, see DBX32.H, or the appendices at the end of this manual. To enable code sharing between DBX applications used for PCB, Schematic, and Library Manager or Library Executive, function calls and DBX items are intentionally similar where possible. 4.1 Extracting General Design Data General design information is retrieved using the function TGetDesignInfo(tContext,designInfo) where tcontext is the structure returned by TOpenDesign. Design data is returned the structure designinfo, which you declare as type TDesign. The TGetDesignInfo function returns general design information including the design size, workspace extents, relative grid origin, design name, title, author, version, and date. 4.2 Extracting Sheets and Sheet Data Four functions return sheet data. To provide consistency between the PCB and Schematic interfaces, sheet and sheet data are referenced as Layers. Sheet data is returned in the DBX item mylayerdata, which you declare as type TLayer, draw p-cad error dbx32.dll. TGetFirstLayer(tContext,myLayerData) TGetNextLayer(tContext,myLayerData) TGetLayerById(tContext,layerId,myLayerData) TGetLayerByName(tContext,layerName,myLayerData) Layer functions TGetFirstLayer, TGetNextLayer, TGetLayerById, and TGetLayerByName return the sheet name (sheet description) as layer name and the sheet number as layerid. layerid zero is returned, but not useable. Schematic DBX applications should skip to layerid Extracting Sheet Items Two functions return the items on a Schematic sheet. To provide consistency between the PCB and Schematic interfaces, sheet and sheet data are referenced as Layers. Item data is returned in the DBX item myitem, which you declare as type TItem. See section 2.5 for a discussion of the TItem structure and its usage. TGetFirstLayerItem(tContext,layerId,myItem) TGetNextLayerItem(tContext,myItem) Layer Item functions TGetFirstLayerItem and TGetNextLayerItem return Schematic 19

25 design items located on a sheet in a TItem data item. The items returned include arcs, attributes, buses, fields, info points, lines, pins, ports, ref points, symbols, table, text, and wires. 4.4 Extracting Nets and Net Data Four functions return net data. Net data is returned in the DBX item mynetdata, which you declare as type TNet. TGetFirstNet(tContext,myNetData) TGetNextNet(tContext,myNetData) TGetNetById(tContext,netId,myNetData) TGetNetByName(tContext,netName,myNetData) Net functions Draw p-cad error dbx32.dll, TGetNextNet, TGetNetById, and TGetNetByName return net name, netid, and number of nodes. 4.5 Extracting NetClasses and NetClass Data Four functions return NetClass data. NetClass data is returned in the DBX item mynetclassdata, which you declare as type TNetClass. TGetFirstNetClass(tContext,myNetClassData) TGetNextNetClass(tContext,myNetClassData) TGetNetClassById(tContext,netClassId,myNetClassData) TGetNetClassByName(tContext,netClassName,myNetClassData) Net functions TGetFirstNetClass, TGetNextNetClass, TGetNetClassById, and TGetNetClassByName return netclassname, netclassid, number draw p-cad error dbx32.dll nets. 4.6 Extracting ClassToClass Data Three functions return ClassToClass data. ClassToclass data is returned in the DBX item myclasstoclassdata, which you declare as type TClassToClass. TGetFirstClassToClass(tContext,myClassToClassData) TGetNextClassToClass(tContext,myClassToClassData) TGetClassToClassById(tContext,netClassId1,netClassID2,myClassTo ClassData) Net functions TGetFirstClassToClass, TGetNextClassToClass and TGetClassToClassById return netclassname1, netclassname2, netclassid1 and netclassid2. Note that in function TGetClassToClassById NetClassID1 must be less than or equal to NetClassID2. 20

26 4.7 Extracting Net Nodes and Net Items Two functions return the items defining a P-CAD Schematic Net. Item data is returned in the DBX item myitem, which you declare as type TItem. See Section 2.5 for a discussion of the TItem structure and its usage. TGetFirstNetNode(tContext,netId,myItem) TGetNextNetNode(tContext,myItem) Net Node functions TGetFirstNetNode and TGetNextNetNode return Schematic design items which are the nodes in the draw p-cad error dbx32.dll in a TItem data item. These items are pins. 4.8 Extracting NetClassNets and Net Data Two functions return NetClassNet data. NetClassNet data is returned in the DBX item mynetdata, which you declare as type TNet. TGetFirstNetClassNet(tContext,netClassId,myNetData) TGetNextNetClassNet(tContext,myNetData) NetClassNet functions GetFirstNetClassNet and GetNextNetClassNet return net name, netid, net length, draw p-cad error dbx32.dll, number of nodes, and plane status. 4.9 Extracting Components and Component Data Three functions return component data. Component data is returned in the DBX item mycompdata, which you declare as type TComponent. TGetFirstComponent(tContext,myCompData) TGetNextComponent(tContext,myCompData) TGetCompByRefDes(tContext,compRefDes,myCompData) Component functions TGetFirstComponent, TGetNextComponent, and TGetCompByRefDes return Component ID, refdes, component type, value, pattern name, number of pins, number of parts, isalpha, ishetero, and connection type information in a TComponent data item Extracting Component Pin and Symbol Data Six functions return pin and symbol data. Symbol items are returned in the DBX item mysymbol, which you declare as type TSymbol. Pin data is returned in the DBX item mypin, which you declare as type TPin. The component is specified by a character string, refdes. This is the component, not the symbol, refdes (e.g. U1). TGetFirstCompPin(tContext,refDes,myPin) TGetNextCompPin(tContext,myPin) TGetFirstCompSymbol(tContext,refDes,mySymbol) TGetNextCompSymbol(tContext,mySymbol) 21

27 TGetCompSymbolByPartNumber(tContext,refDes,PartNo,mySymbol) TGetCompSymbolByRefDes (tcontext,refdes,mysymbol) Symbol data returned includes the symbol Id, name, symbol refdes (e.g. U1:A), number of pins, part number and alternate type. Pin data returned in mypin includes the pin item Id, pin number, symbol part number, draw p-cad error dbx32.dll, component refdes (e.g. U1), pin pindes (e.g. 1), pin type, outside and inside style and edge styles, net Id, gate equivalence value, and pin equivalence value Extracting Symbol Pin Data Two functions return symbol pin data. Pin data is returned in the DBX item mypin, which you declare as type TPin. The symbol is specified by a character string, refdes. This is the full symbol refdes (e.g. U1:A). TGetFirstSymbolPin(tContext,refDes,myPin) TGetNextSymbolPin(tContext,myPin) Pin data returned in mypin includes the pin item Id, pin number, symbol part number, component refdes (e.g. U1), pindes (e.g. 1), pin type, outside and inside style and edge styles, net Id, gate equivalence value, and pin equivalence value Extracting Style Data for Text Items Text items include a StyleId as part of their definition. This StyleId value may be used to get information about a style in general, or more specific information about the current text item being examined. There are three functions available to draw p-cad error dbx32.dll style information. Style information is returned in mytextstyle, which you declare as TTextStyle. TGetTextStyle(tContext,textStyleId,myTextStyle) Note that valid style ids range from 0 to 99 for text styles. The styles used may not be consecutive, however, so looping through the style ids from 0 until a DBX_STYLE_NOT_FOUND to find all valid styles may stop too soon if there are "holes" in the used style ids. The correct approach is to loop from 0 to 99, recording which styles are valid based on the status returned from the GetStyle function. Text Style function TGetTextStyle returns the style name, font type, pen width, and text height in a TTextStyle data item Extracting Grids and Grid Data Two functions return grid data. Grid data is returned in the DBX item mygriddata, which you declare as type TGrid. TGetFirstGrid(tContext,myGridData) TGetNextGrid(tContext,myGridData) Grid functions TGetFirstGrid and TGetNextGrid return grid ID and grid spacing which is 22

28 a string containing the spacing values separated by a comma Extracting Attributes Ten functions return the attributes which are associated with design, layer, net, net class, class to class, room or component. Attribute data is returned in myattr, which you declare as TAttribute. For components, you specify the component refdes using a string variable in Visual Basic, or a char* in C or C++. For all others specify the ID declared as a. TGetFirstDesignAttribute(tContext, myattr) TGetNextDesignAttribute(tContext, myattr) TGetFirstNetAttribute(tContext,netId, myattr) TGetNextNetAttribute(tContext, draw p-cad error dbx32.dll, myattr) TGetFirstNetClassAttribute(tContext,NetClassId, myattr) TGetNextNetClassAttribute(tContext, myattr) TGetFirstClassToClassAttribute(tContext, NetClassId1, NetClassId2, myattr) TGetNextClassToClassAttribute(tContext, myattr) TGetFirstCompAttribute(tContext,refDes,myAttr) TGetNextCompAttribute(tContext, myattr) The above functions return type and value strings for each attribute associated with the class in a TAttribute data item. These attributes also include location, style, and orientation information Extracting Symbol Attributes Two functions return the attributes which are associated with a symbol. Attribute data is returned in myattr, which you declare as TAttribute. For symbols, you specify the symbol, refdes (i.e. U1:A) using a string variable, in Visual Basic, or a Char*, draw p-cad error dbx32.dll, in C or C++. TGetFirstSymAttribute (tcontext, refdes, myattr) TGetNextSymAttribute (tcontext, myattr) Symbol Attribute functions TGetFirstCompAttribute and TGetNextCompAttribute return type and value strings for each attribute associated to a symbol in a TAttribute data item. These attributes also include location, style, and orientation information Extracting Items from the Current Selection Set Two functions return the items in the active design selection set (items you have selected by Block Select or selecting individual items). Item data is returned in selectitem, which you declare draw p-cad error dbx32.dll type Titem. See section 2.5 for a discussion of the TItem structure and its usage. TGetFirstSelectedItem(tContext,selectItem) TGetNextSelectedItem(tContext,selectItem) Get Selection draw p-cad error dbx32.dll return selected items in a TItem data item. The item types returned in thetitem include arcs, attributes, buses, fields, draw p-cad error dbx32.dll, info points, lines, pins, ports, 23

29 ref points, symbols, tables, text, and wires Extracting Print Job Two functions return the print jobs in the active design. Print job information is returned in ajob, draw p-cad error dbx32.dll you declare as type TPrintJob. TGetFirstPrintJob(tContext, ajob) TGetNextPrintJob(tContext, ajob) Print Job functions TGetFirstPrintJob and TGetNextPrintJob return the name of the print job and if it is selected for output during a print operation Extracting Variants These methods are used for retrieving all the existing Variants in a design. TGetFirstVariant(DbxContext* pcontext, TVariant* pvariant) TGetNextVariant(DbxContext* pcontext, TVariant* pvariant) Variant functions TGetFirstVariant and TGetNextVariant draw p-cad error dbx32.dll TVariant structure that contains the Variant name, description, and id. 24

30 5 Modifying Design Data - PCB This section provides a summary of the interface functions that add, modify, or delete PCB design data. Note that these functions are available only for P-CAD P-CAD PCB. For a detailed description of each function, its arguments, or P-CAD DBX structure contents, see DBX32.H, or the appendices at the end of this manual. Note that DBX items returned by a successful Modify operation will have a new dbid or compid database identifier. The old dbid or compid value will no er be a valid identifier; the modified DBX item returned by the function call should be used for subsequent DBX function calls. To enable code sharing between DBX applications used for PCB, Schematic, and Library Manager or Library Executive, function calls and DBX items are intentionally similar where possible. 5.1 Flipping Objects Nine functions flip Draw p-cad error dbx32.dll design objects. Input to the function is the item to be flipped, and the point about which the item is to be flipped. Items may be flipped using item type specific function calls, or by using a DBX TItem as input to TFlipItem. The item to be flipped is declared as a TArc, TAttribute, TComponent, draw p-cad error dbx32.dll, TField, TLine, TPad, TPoint, Ttable, TText, TVia or TItem, respectively. The point about which to flip, ppoint, is declared as a TCoord. If the TCoord coordinates are specified as (-1,-1), the item is flipped about its default origin. See Section 2.8, Default Item Origins for a listing of what item property is used as a default origin. TFlipArc(tContext, ppoint, parc) TFlipAttribute(tContext, ppoint, pattribute) TFlipComponent(tContext, ppoint, pcomponent) TFlipField(tContext, ppoint, pfield) TFlipLine(tContext, ppoint, pline) TFlipPad(tContext, ppoint, ppad) TFlipPoint(tContext, ppoint, ppoint2) TFlipTable(tContext, ppoint, ptable) TFlipText(tContext, ppoint, ptext) TFlipVia(tContext, ppoint, pvia) TFlipItem(tContext, ppoint, TItem) DBX Flip functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TFlipItem. The item is updated to have its isflipped field set appropriately. 5.2 Rotating Objects Ten functions rotate PCB design objects. Input to the function is the item to be rotated, the rotation angle, and the point about which the item is to be rotated. Items may be rotated using item type specific function calls, or by using a DBX TItem as input to TRotateItem. 25

31 The item to be rotated is declared as a TArc, TAttribute, TComponent, Tfield, TLine, TPad, draw p-cad error dbx32.dll, Tpoint, TTable, TText, TVia or TItem, respectively. The rotation angle angle, is declared as a and may range from to 3600 (recall that degree values are specified in 1/10 degrees). The point about which to rotate, ppoint, is declared as a TCoord. If the TCoord coordinates are specified as (-1,-1), the item is rotated about its default origin. See Section 2.8, Default Item Origins for a listing of what item property is used as a default origin. TRotateArc(tContext, angle, ppoint, parc) TRotateAttribute(tContext, angle, ppoint, pattribute) TRotateComponent(tContext, angle, ppoint, pcomponent) TRotateField(tContext, angle, ppoint, pfield) TRotateLine(tContext, angle, ppoint, pline) TRotatePad(tContext, angle, ppoint, ppad) TRotatePoint(tContext, angle, ppoint, ppoint2) TRotateTable(tContext, angle, ppoint, ptable) TRotateText(tContext, angle, ppoint, ptext) TRotateVia(tContext, angle, ppoint, pvia) TRotateItem(tContext, angle, ppoint, pitem) DBX Rotate functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TRotateItem. The item rotateangle or rotation fields are updated to reflect the item's new orientation. 5.3 Moving Objects Thirteen functions move PCB design draw p-cad error dbx32.dll. Input to the function is the item to be moved, and the distance in the x and y directions to move the item. Items may be moved using item type specific function calls, or by using a DBX TItem as input to TMoveItem. The item to be moved is declared as a TArc, TAttribute, TComponent, TDetail, TDiagram, TLine, TMetafile, TPad, TPoint, TTable, TText, TVia or TItem, draw p-cad error dbx32.dll, respectively. The distances to move, dx and dy, are declared as a s and are in database units. TMoveArc(tContext, dx, dy, parc) TMoveAttribute(tContext, dx, dy, pattribute) TMoveComponent(tContext, dx, dy, pcomponent) TMoveDetail(tContext, dx, dy, pdetail) TMoveDiagram(tContext, dx, dy, pdiagram) TMoveLine(tContext, dx, dy, pline) TMoveMetafile(tContext, dx, dy, pmetafile) TMovePad(tContext, dx, draw p-cad error dbx32.dll, dy, ppad) TMovePoint(tContext, dx, dy, ppoint) TMoveTable(tContext, dx, dy, draw p-cad error dbx32.dll, ptable) TMoveText(tContext, dx, dy, ptext) TMoveVia(tContext, dx, dy, pvia) TMoveItem(tContext, dx, dy, pitem) DBX Move functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TMoveItem. The item location information is updated draw p-cad error dbx32.dll reflect the item's new location after the Move operation. 26

32 5.4 Deleting Objects Seventeen functions delete PCB design objects. Input to the function is the item to be deleted. Items may be deleted using item type specific function calls, or by using a DBX TItem as input to TDeleteItem. The item to be deleted is declared as a TArc, TAttribute, TClassToClass, TComponent, TDetail, TDiagram, TLine, TMetafile, TPad, TPoint, TText, TVia or TItem respectively. TDeleteArc(tContext, parc) TDeleteAttribute(tContext, pattribute) TDeleteClassToClass(tContext, pclasstoclass) TDeleteComponent(tContext, pcomponent) TDeleteDetail(tContext, pdetail) TDeleteDiagram(tContext, pdiagram) TDeleteIncludedRoomComponent(tContext, roomid, pcomponent) TDeleteLine(tContext, pline) TDeleteNetClass(tContext, pnetclass) TDeleteNetClassNet(tContext,NetClassId, pnet) TDeleteMetafile(tContext, pmetafile) TDeletePad(tContext, ppad) TDeletePoint(tContext, ppoint) TDeleteTable(tContext, ptable) TDeleteText(tContext, ptext) TDeleteVia(tContext, pvia) TDeleteItem(tContext,pItem) DBX Delete functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TDeleteItem. The item is indicated as no er being a valid PCB design item by having its DBID property set equal to zero. 5.5 Highlighting Objects Twenty-five functions highlight and unhighlight PCB design objects. Input to each function is the item to be highlighted or unhighlighted, and a highlight color for highlight functions, draw p-cad error dbx32.dll. Items may be highlighted or unhighligted using item type specific function calls, or by using a DBX TItem as input to THighlightItem and TUnHighlightItem. All items in the active design may be unhighlighted using the TUnHighlightAll function. All items in a net may be highlighted or unhighlighted using the THighlightNet and TUnHighlightNet functions, respectively. The item to be highlighted is declared as a TArc, TAttribute, TComponent, TLine, TNet, TPad, TPoint, TRoom, TTable, TText, TVia or TItem, respectively. The highlight color color is declared as a value and specifies highlight colors 1 through 20. The 20 colors associated with the highlight color constants are listed in Appendix A, P-CAD DBX Data Constants under DBX Color Index Types. THighlightArc(tContext, color, parc) Loading error # 2032, color, pattribute) THighlightComponent(tContext, color, pcomponent) 27

33 THighlightLine(tContext, color, pline) THighlightPad(tContext, color, ppad) THighlightPoint(tContext, color, ppoint) THighlightTable(tContext, color, ptable) THighlightText(tContext, color, ptext) THighlightVia(tContext, color, pvia) TUnHighlightArc(tContext, parc) TUnHighlightAttribute(tContext, pattribute) TUnHighlightComponent(tContext, pcomponent) TUnHighlightLine(tContext, pline) TUnHighlightPad(tContext, ppad) TUnHighlightPoint(tContext, ppoint) TUnHighlightTable(tContext, ptable) TUnHighlightText(tContext, ptext) TUnHighlightVia(tContext, pvia) THighlightNet(tContext, color, pnet) TUnHighlightNet(tContext, pnet) THighlightRoom(tContext, color, proom) TUnHighlightRoom(tContext, proom) THighlightItem(tContext, color, pitem) TUnHighlightItem(tContext, pitem) TUnHighlightAll(tContext) DBX Highlight functions return a DBX draw p-cad error dbx32.dll return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from THighlightItem or TUnHighlightItem. Individual items highlighted or unhighlighted are returned having their ishighlighted field updated to indicate its highlight color. (ishighlighted is 0 to indicate that the item is not highlighted and ranges 1 through 20 to specify which highlight color is in use.) In addition, Details, Diagrams, and Metafiles can be highlighted or unhighlighted by using the THighlightItem or TUnHighlightItem with the apporiprate fields of the TItem structure filled in, draw p-cad error dbx32.dll. 5.6 Modifying Object Properties Twelve functions modify PCB design objects properties. Input to the function is the item to be modified. Items may be modified using item type specific function calls, or by using a DBX Titem as draw p-cad error dbx32.dll to TModifyItem. The modification to be performed is specified by setting one or more of the DBX item properties prior to calling the Modify function. The properties that may be modified by a DBX program are specific to the type of item being modified and are listed below. All modifications must conform to P-CAD PCB design rules. For example, component refdes values must be unique and contain no invalid characters; a location or rotation which would move the item outside the design workspace will return a DBX error value of DBX_ITEM_OUTSIDE_WORKSPACE; moving an item to an invalid layer will return an error value of DBX_INVALID_LAYER. The item to be modified is declared as a TArc, TAttribute, TComponent, TLine, TNet, TNetClass, TPad, Tpoint, TRoom, TText, TVia or TItem, respectively. 28

34The item properties are updated to reflect the item status after the Modify call. Item properties not legal for modification that were modified in the DBX item prior to the function call are overwritten with valid data representing the item's current state after the Modify call. Note: For information on modifying component and net attributes, see sections 5.13 and 5.14, respectively. 5.7 Placing Objects Eight functions place PCB design objects in an active PCB design. Input to the function is the item to be placed. There draw p-cad error dbx32.dll no generic TPlaceItem form. The properties for the item to be placed is specified by setting one or more of the DBX item properties prior to calling the Place function. The properties that must be specified during placement are specific to the type of item being placed and are listed below. All items to be placed, and the properties of those items, must conform to P-CAD PCB design rules. For example, component refdes values must be unique and contain no invalid characters; a draw p-cad error dbx32.dll or rotation which would place the item outside the design workspace will return a DBX draw p-cad error dbx32.dll value of DBX_ITEM_OUTSIDE_WORKSPACE; placing an item on an invalid layer will return an error value of DBX_INVALID_LAYER. The item to be placed is declared as a TArc, TAttribute, TComponent, TLine, TPad, TPoint, Ttext and TVia, respectively. 29

35 The specifiable properties for each DBX item are listed below. Note that except for component.libraryname, component.typename, and point.infotext, these are exactly the properties valid for DBX Modify operations. Note also that all properties listed must be specified to place a new design item. Arc: width, radius, centerpt, startang, sweepang, layerid Attribute: type, value, draw p-cad error dbx32.dll, refpoint, textstyleid, justpoint, isvisible, layerid Component: refdes, value, refpoint, libraryname, comptype Line: width, startpt, endpt, layerid Net: netname Free Pad: padstyleid, center, pinnumber Via: viastyleid, center Point: pointtype x, y (location), layerid; InfoText, rulecategory, ruletype (InfoPoint only) Text: text, refpoint, textstyleid, justpoint, isvisible, layerid Note: When placing a component component.libraryname, if specified, must include the complete library path and file name (e.g. c:\p-cad\demo.lib). If not specified by leaving the input property field blank, the open libraries will be searched in the current open library order for the input component type. TPlaceArc(tContext, parc) TPlaceAttribute(tContext, draw p-cad error dbx32.dll, pattribute) TPlaceComponent(tContext, pcomponent) TPlaceLine(tContext, pline) TPlacePad(tContext, ppad) TPlacePoint(tContext, ppoint) TPlaceText(tContext, ptext) TPlaceVia(tContext, pvia) DBX Place functions return a DBX error return status, and an updated DBX item. The item properties are updated to reflect the item status after the Place call. Item properties not legal to be specified during placement that were specified in the DBX item prior to the function call are overwritten with valid data representing the item's current state after the Place call. 5.8 Creating and Deleting Nets Two functions create and delete a PCB design net. Input to the TCreateNet function is a DBX TNet item. The net.netname field must specify the name draw p-cad error dbx32.dll the new net. The name must be a valid netname, and not be a duplicate of an existing net. All other TNet properties are ignored. A PCB net must contain no design items (lines, arcs, vias) and have no net nodes to be deleted. See Sections 5.4, Deleting Objects, and 5.9, Adding and Deleting Net Nodes for information on how to delete net items and net nodes. Note: When deleting a net, net objects (using TGetFirstNetItem and TGetNextNetItem) should be deleted first, then delete the net nodes (using TGetFirstNetNode and TGetNextNetNode). It is not necessary to delete all net attributes before deleting a net. TCreateNet(tContext, pnet) TDeleteNet(tContext, pnet) 30

36 DBX TCreateNet and TDeleteNet functions return a DBX error return status, and an updated DBX net item. If successful, a created TNet will be returned and indicate a valid net number in the net.netnumber field, draw p-cad error dbx32.dll. A deleted net will be indicated by a net.netnumber field value of zero. 5.9 Adding and Deleting Net Nodes Two functions add and delete PCB net nodes. Input to these functions is the net number, and the pad to be added or deleted. netid is declared as a, and must be a valid net number. pitem is the node to be added or deleted from the net, and is declared as a Titem with the pad structure filled in. TAddNetNode(tContext, netid, pitem) TDeleteNetNode(tContext, netid, pitem) DBX TAddNetNode and TDeleteNet functions return a DBX error return status, and an updated DBX Titem with the pin structure filled in. If a pad has been successfully added to a net, draw p-cad error dbx32.dll, the pad netid property will be updated to reflect the net number of the net to which it has been added. If a pad has been successfully deleted from a net, the pad netid property will be set to zero, indicating it bes to no nets Creating and Deleting NetClasses Two functions create and delete a PCB design NetClass. Input to the TCreateNetClass function is a DBX TNetClass item. The netclass.netclassname field must specify the name of the new NetClass. The name must be a valid netclassname, and not be a duplicate of an existing NetClass. All other TNet properties are ignored. TCreateNetClass(tContext, pnetclass) TDeleteNetClass(tContext, pnetclass) DBX TCreateNetClass and TDeleteNetClass functions return a DBX error return status, and an updated DBX net class item. If successful, a created TNetClass will be returned and indicate a valid net class number in the netclass.numberofnets field Adding and Deleting NetClassNets Two functions add and delete a PCB design net class net. Input to the TCreateNetClassNet function is a DBX netclassid and a TNet item. The netclassid is declared as a and must be a valid NetClass number. pnet is the net to be added or deleted from the net, and is declared as a TNet with the net structure filled in. TAddNetClassNet(tContext, netclassid, pnet) TDeleteNetClassNet(tContext, netclassid, pnet) DBX TAddNetClassNet and TDeleteNetClassNet functions return a DBX error return status and the number of nets in the net class is incremented or decremented. 31

37 5.12 Creating and Deleting ClassToClass Rules Two functions create and delete a PCB design ClassToClass rules. Input to the TCreateClassToClass function is a DBX TClassToClass item. TCreateClassToClass(tContext, pclasstoclass) TDeleteClassToClass(tContext, pclasstoclass) DBX TCreateClassToClass and TDeleteClassToClass functions return a DBX error return status Modifying Component Attributes Three functions modify component attributes. Input to these functions is the component refdes, which you declare as a string variable in Visual Basic, and as a char* in C or C++, and the attribute to be added, draw p-cad error dbx32.dll, modified, or deleted, pattribute, declared as a TAttribute. TAddCompAttribute(tContext, refdes, pattribute) TModifyCompAttribute(tContext, refdes, pattribute) TDeleteCompAttribute(tContext, refdes, pattribute) The following TAttribute properties are used when adding an attribute to a component: type, draw p-cad error dbx32.dll, value, refpoint, textstyleid, justpoint, isvisible, and layerid. All properties must be fully specified unless isvisible=0, draw p-cad error dbx32.dll, where the following defaults are used: refpoint: will be placed at the component reference point textstyleid: default justpoint: lower left justification layerid: Top Silk layer The following TAttribute properties may be modified using the TModifyCompAttribute function: value, refpoint, textstyleid, justpoint, isvisible, and layerid. Note that a component refdes is modifiable only by using TModifyComponent with the component refdes property updated. DBX Modify Component Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties updated. A deleted attribute will be returned with its DB ID set to zero Modifying Net Attributes Three functions modify net attributes. Input to these functions is the net number, netid, which you declare as a, draw p-cad error dbx32.dll, and the attribute to be added, modified, or deleted, pattribute, declared as a TAttribute. TAddNetAttribute(tContext, netid, pattribute) TModifyNetAttribute(tContext, netid, pattribute) TDeleteNetAttribute(tContext, netid, pattribute) The following TAttribute properties are used when adding an attribute to a net or modifying an existing net attribute: type, value, formula, comment and units. Net 32

38 attributes are not visible. All other properties are ignored when adding or modifying a net attribute. DBX Modify Net Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties updated. A deleted attribute will be returned with its DB ID set to zero Modifying Design Attributes Three functions draw p-cad error dbx32.dll design attributes. The attribute to be added, modified, or error mumaker 1.07, pattribute, is declared as a TAttribute. TAddDesignAttribute(tContext, pattribute) TModifyDesignAttribute(tContext, pattribute) TDeleteDesignAttribute(tContext, pattribute) The following TAttribute properties are used when adding an attribute to a design or modifying an existing design attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a design attribute. DBX Modify Design Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties updated. A deleted attribute will be returned with its DB ID set to zero Modifying Layer Attributes Three functions modify layer attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddLayerAttribute(tContext, draw p-cad error dbx32.dll, pattribute) TModifyLayerAttribute(tContext, pattribute) TDeleteLayerAttribute(tContext, pattribute) The following TAttribute properties are used when adding a layer attribute to a design or modifying an existing layer attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a layer attribute. DBX Modify Layer Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified layer attributes will be returned with all attribute properties updated. A deleted layer attribute will be returned with its DB ID set to zero Modifying NetClass Attributes Three functions modify NetClass attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddNetClassAttribute(tContext, netclassid, pattribute) TModifyNetClassAttribute(tContext, netclassid, pattribute) TDeleteNetClassAttribute(tContext, netclassid, pattribute) The following TAttribute properties are used when adding a netclass attribute to a 33

39 design or modifying an existing netclass attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a netclass attribute. DBX Modify NetClass Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified NetClass attributes will be returned with all attribute properties updated. A deleted NetClass attribute will be returned draw p-cad error dbx32.dll its DB ID set to zero Modifying ClassToClass Attributes Three functions modify ClassToClass attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) TModifyClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) TDeleteClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) The following TAttribute properties are used when adding a ClassToClass attribute to a design or modifying an existing ClassToClass attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a ClassToClass attribute. DBX Modify ClassToClass Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified ClassToClass attributes will be returned with all attribute properties updated. A deleted ClassToClass attribute will be returned with its DB ID set to zero Modifying Room Attributes Three functions modify Room attributes, draw p-cad error dbx32.dll. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddRoomAttribute(tContext, draw p-cad error dbx32.dll, roomid, pattribute) TModifyRoomAttribute(tContext, roomid, pattribute) TDeleteRoomttribute(tContext, roomid, pattribute) The following TAttribute properties are used when adding a Room attribute to a design or modifying an existing Room attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a Room attribute. DBX Modify Room Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified Room attributes will be returned with all attribute properties updated. A deleted Room attribute will be returned with its DB ID set to zero. 34

40 5.20 Saving a Design The following function is used to save the active design. TSaveDesign(tContext) The active design will be written to disk in the same manner as if the File Save command was chosen from the P-CAD application menu Selecting Print Jobs Three functions select or deselect the print jobs in the active design. Selected print jobs are those that are output during the next print operation. Print jobs are specified in the jobname string. TSelectPrintJob(tContext, jobname) TDeselectPrintJob(tContext, jobname) TSelectAllPrintJob(tContext) the TSelectPrintJob and TDeselectPrintJob functions will select or deselect the print job specified by its name. The TSelectAllPrintJobs function will select all the print jobs in the active design Printing Print Jobs Two functions print the print jobs of the active design to the current printer. Print jobs are specified in the jobname string. Draw p-cad error dbx32.dll, jobname) TOutputSelectedPrintJobs(tContext) The TOutputPrintJobByName function will print the job specified by its name, regardless of whether or not it has been selected for output. The TOutputSelectedPrintJobs function will print jobs that are selected for output Add Layers One function adds a layer to the active design TAddLayer(tContext, player) The TAddLayer function will add a layer with the specific data of layer name, layerid, type and bias, clearances, and plane status. If the layerid is already used it TAddLayer will use the next available number. If the layer name already exists then an error is returned. 35

41 5.24 Modifying Variants These three functions modify variants. The variant to be added, deleted or renamed, pvariant, is declared as a TVariant. TAddVariant(DbxContext* pcontext, TVariant* pvariant) TDeleteVariant(DbxContext* pcontext, TVariant* pvariant) TRenameVariant(DbxContext* pcontext, TVariant* pvariant) TAddVariant is used for adding a uniquely named Variant to a design. In the TVariant structure the name must be unique otherwise an error is returned of duplicate name. TVariant.description and TVariant.id are optional. TDeleteVariant is used for removing a Variant from a design, draw p-cad error dbx32.dll. The Variant must exist otherwise an error is returned. Description and id are draw p-cad error dbx32.dll. TRenameVariant method is used to rename a Variant. To use, first get the variant data by TGetFirstVariant and TGetNextVariant. When you have the one of interest change its name and call TRenameVariant. Be sure to not change the id as this is used to identify the variant for renaming purposes Modifying Pad Styles These three functions modify pad styles. Long TCreatePadStyle(DbxContext* pcontext, (i/o) dbx context info fromid (i) existing style Id to copy from - Use 0 for default const char* pnewname, (i) new style name TPadViaStyle* pstyle); (o) new style return The TCreatePadStyle function create a new pad style by copying from an existing style. The parameter fromid is the id of an existing pad style. You can use the TGetFirstPadStyle and TGetNextPadStyle functions to fetch the existing pad styles in the design. pnewname is the name for the newly create style. TPadViaStyle* is filled in if successful. It fills in the style id, name, hole diameter, etc. See TPadViaStyle type definition for more details. TDeletePadStyle(DbxContext* pcontext, (i/o) dbx context info padstyleid); (i) pad style Id to delete The TDeletePadStyle function is used to delete a pad style from the design. Default style or styles that are in-use in the design cannot be deleted. Use the padstyleid to specify the style to delete, draw p-cad error dbx32.dll. TModifyPadStyle(DbxContext* pcontext, (i/o) dbx context info TPadViaStyle* pstyle); (i) style info to modify 36

42 The TModifyPadStyle function is used to modify a pad style. pstyle is the pad style info to modify. The following fields need to be filled in: styleid name holedia xoffset yoffset holestartlayer holeendlayer 5.26 Modifying Pad Shapes These two functions modify pad shapes. TAddPadShape(DbxContext* pcontext, (i/o) dbx context info padstyleid, (i) Pad style Id to add shape to TPadViaShape* ppadshape); (i) Pad displaying bus initialization errors to add The TAddPadShape function is used to add or modify the pad shape (for a layer) of a pad style. Note that because polygon shape uses different property attributes, this function will not add a polygon pad shape. To add/modify polygon pad shapes for a layer, use the TAddPolyPadShape function. TDeletePadShape(DbxContext* pcontext, (i/o) dbx context info padstyleid, (i) pad style id layerid); (i) layer id The TDeletePadShape function is used to delete a pad style shape. Note that it cannot delete default shapes for the following layers: top, bottom, default non-signal, signal and plane Modifying Polygon Pad Shapes These two functions are used to add regular and irregular polygon pad shape definitions. TAddPadRegularPolyShape(DbxContext* pcontext, (i/o) dbx context info padstyleid, (i) pad style id TPadViaRegularPolyShape* pregpolyshape); (i) The TAddPadRegularPolyShape function is used to add or modify the regular polygon shape for a pad style. Use pregpolyshape to pass in the number of sides, draw p-cad error dbx32.dll, and rotation angle for the regular polygon. Long TAddPadIrregularPolyShape(DbxContext* pcontext, (i/o) dbx context info padstyleid, (i) pad style id layerid, (i) layer Id or 0 if add or modify default layer layertype, (i) use if layer Id is 0 37

43 ispournoconn, (i) Prohibit Cu pour thermalizing numberofpoints, (i) number of poly points const TCoord* ppoints); (i) point array. The size of the array is numberofpoints The TAddPadIrregularPolyShape function is used to add or modify a Irregular polygon shape for a pad style. Note that the array of points, the ppoints parameter, defines a polygon shape, draw p-cad error dbx32.dll. The X, Y coordinate of a point is relative to the "origin" of the polygon, not the PCB design. The coordinate is in database unit. The layerid is the layer number draw p-cad error dbx32.dll the pad shape. If the layer number is 0, the layertype can be used to modify the default shape of a pad style: DBX_LAYERTYPE_SIGNAL -shape for default Signal Layer DBX_LAYERTYPE_PLANE - shape for default Plane Layer, and DBX_LAYERTYPE_NON_SIGNAL - shape for default Non Signal layer 5.28 Modifying Via Styles and Shapes The following functions are duplicates of the Pad style and shape functions except they are used for Vias. TCreateViaStyle(DbxContext* pcontext, (i/o) dbx context info fromid, (i) existing style Id to copy from - Use 0 for default const char* pnewname, (i) new style name TPadViaStyle* pstyle). (o) new style return TDeleteViaStyle(DbxContext* pcontext, (i/o) dbx context info viastyleid); (i) via style Id to delete TModifyViaStyle(DbxContext* pcontext, (i/o) dbx context info TPadViaStyle* pstyle); (i) style info to modify TAddViaShape(DbxContext* pcontext, (i/o) dbx context info viastyleid, (i) Via style Id to add shape to TPadViaShape* pviashape); (i) via shape to add Long TAddViaRegularPolyShape(DbxContext* pcontext, (i/o) dbx context info viastyleid, (i) via style id TPadViaRegularPolyShape* pregpolyshape); (i) Regular draw p-cad error dbx32.dll shape definition TAddViaIrregularPolyShape(DbxContext* pcontext, (i/o) dbx context info viastyleid, (i) via style id layerid, (i) layer Id or 0 if add or modify default 38

44 layer layertype, (i) use if layer Id is 0 ispournoconn, (i) Prohibit Cu pour thermalizing numberofpoints, (i) number of poly points const TCoord* ppoints); (i) point array, draw p-cad error dbx32.dll. The size of the array is numberofpoints Modifying Text Styles Below are Text style functions. These are similar to those for Pad styles. TAddTextStyle(DbxContext* pcontext, (i/o) dbx context info fromid, (i) existing style Id to copy from TTextStyle* pstyle); (i/o) new text style return Description: Add a new text style by copying it from an existing style. TDeleteTextStyle(DbxContext* pcontext, (i/o) dbx context info styleid); (i) style to delete Description: Delete an existing text style. Use the styleid to specify the style to be removed. Note that Default style or styles that are in-used cannot be deleted. DLLX TModifyTextStyle(DbxContext* pcontext, TTextStyle* pstyle); (i/o) dbx context info (i) style info to modify Description: Modify various fields of a text style. Use the styleid to specify the text style to modify. Valid fields that can be modified are: name strokeheight strokepenwidth istruetypeallowed isdisplaytruetype ttypeheight Note: This function returns DBX_BAD_INPUT when one of the following possible errors happened: 1) The name is a duplicate of another text style. 2) Height or width of the text are out of range Note: This function returns DBX_ILLEGAL_OP when one of the following possible errors happened: 1) The style to be modified is a default style (i.e. (Default), (DefaultTTF)) 2) The new font height and width might make the text fall out of the workspace. 39

45 6 Modifying Design Data - Schematic This section provides a summary of the interface functions that add, modify, or delete Schematic design data. For a detailed description of each function, its arguments, or P-CAD DBX structure contents, see DBX32.H, or the appendices at the end of this manual. Note that DBX items returned by a successful Modify operation will have a new dbid or compid database identifier. The old dbid or compid value will no er be a valid identifier; the modified DBX item returned by the function call should be used for subsequent DBX function calls. Before placing or modifying a symbol or wire, read section 6.22; the section discusses net connectivity issues. To enable code sharing between DBX applications used for PCB, Schematic, and Library Manager or Library Executive, function calls and DBX items are intentionally similar where possible. 6.1 Flipping Objects Twelve functions flip Schematic design objects. Input to the function is the item to be flipped, and the point about which the item is to be flipped. Items may be flipped using item type specific function calls, or by using a DBX TItem as input to TFlipItem. The item to be flipped is declared as a TArc, TAttribute, TBus, TField, TLine, TPin, TPort, TSymbol, TTable, TText, TWire or TItem, respectively. The point about which to flip, ppoint, is declared as a TCoord. If the TCoord coordinates are specified as (-1,-1), the item is flipped about its default origin. See Section 2.8, Default Item Origins for a listing of what item property is used as a default origin. TFlipArc(tContext, ppoint, parc) TFlipAttribute(tContext, ppoint, pattribute) TFlipBus(tContext, ppoint, pbus) TFlipField(tContext, ppoint, pfield) TFlipLine(tContext, ppoint, pline) TFlipPin(tContext, draw p-cad error dbx32.dll, ppoint, ppin) TFlipPort(tContext, ppoint, pport) TFlipSymbol(tContext, ppoint, psymbol) TFlipTable(tContext, ppoint, ptable) TFlipText(tContext, draw p-cad error dbx32.dll, ppoint, ptext) TFlipWire(tContext, ppoint, pwire) TFlipItem(tContext, ppoint, TItem) DBX Flip functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TFlipItem, draw p-cad error dbx32.dll. The item is updated to have its isflipped field set appropriately. 6.2 Rotating Objects Twelve functions rotate Schematic design objects. Input to the function is the item to be rotated, the rotation angle, and the point about which the item is to be rotated. Items may 40

46 be rotated using item type specific function calls, or by using a DBX TItem as input to TRotateItem. The item to be rotated is declared as a TArc, TAttribute, TBus, TField, TLine, TPin, TPort, TSymbol, TTable, TText, draw p-cad error dbx32.dll, TWire or TItem, respectively. The rotation angle angle, is declared as a and may range from to 3600 (recall that degree values are specified in 1/10 degrees). The point about which to rotate, ppoint, is declared as a TCoord. If the TCoord coordinates are specified as (-1,-1), the item is rotated about its default origin. See section 2.8, Default Item Origins for a listing of what item property is used as a default origin. TRotateArc(tContext, angle, ppoint, parc) Draw p-cad error dbx32.dll, angle, ppoint, pattribute) TRotateBus(tContext, angle, ppoint, pbus) TRotateField(tContext, angle, ppoint, pfield) TRotateLine(tContext, angle, ppoint, pline) TRotatePin(tContext, angle, ppoint, draw p-cad error dbx32.dll, ppin) TRotatePort(tContext, angle, ppoint, pport) TRotateSymbol(tContext, angle, ppoint, psymbol) TRotateTable(tContext, angle, ppoint, ptable) TRotateText(tContext, angle, ppoint, ptext) TRotateWire(tContext, angle, ppoint, pwire) TRotateItem(tContext, angle, ppoint, pitem) DBX Rotate functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TRotateItem. The item rotateangle or rotation fields are updated to reflect the item's new orientation. 6.3 Moving Objects Thirteen functions move Schematic design objects. Input to the function is the item to be moved, and the distance in the x and y directions to move the item. Items may be moved using item type specific function calls, or by using a DBX TItem as input to TMoveItem. The item to be moved is declared as a TArc, TAttribute, TBus, TField, TLine, TPin, TPoint, TPort, TSymbol, TTable, TText, TWire or TItem, respectively. The distances to move, dx and dy, are declared as a s and are in database units. TMoveArc(tContext, dx, dy, parc) TMoveAttribute(tContext, dx, dy, pattribute) TMoveBus(tContext, dx, dy, pbus) TMoveField(tContext, dx, dy, pfield) TMoveLine(tContext, dx, dy, pline) TMovePin(tContext, dx, dy, ppin) TMovePoint(tContext, dx, dy, ppoint) TMovePort(tContext, dx, dy, pport) TMoveSymbol(tContext, dx, dy, psymbol) TMoveTable(tContext, dx, dy, ptable) Networkerror 500 internal server error - http, dx, dy, ptext) TMoveWire(tContext, dx, dy, pwire) TMoveItem(tContext, dx, dy, pitem) DBX Move functions return a DBX error return status, and an updated DBX item, either in 41

47 an item type specific DBX item structure, or as a TItem from TMoveItem. The item location information is updated to reflect the item's new location after the Move operation. 6.4 Deleting Objects Seventeen functions delete Schematic design objects, draw p-cad error dbx32.dll. Input to the function is the item to be deleted. Items may be deleted using item type specific function calls, or by using a DBX TItem as input to TDeleteItem. The item to be deleted is declared as a TArc, TAttribute, TBus, TClassToClass, TField, TLine, TNet, TNetClass, TPin, TPoint, TPort, TSymbol, TTable, TText, TWire or TItem, respectively. TDeleteArc(tContext, parc) TDeleteAttribute(tContext, pattribute) TDeleteBus(tContext, pbus) TDeleteClassToClass(tContext, pclasstoclass) TDeleteField(tContext, pfield) TDeleteLine(tContext, pline) TDeleteNet(tContext, pnet) TDeleteNetClass(tContext, pnetclass) TDeleteNetClassNet(tContext,NetClassId, pnet) TDeletePin(tContext, ppin) TDeletePoint(tContext, ppoint) TDeletePort(tContext, pport) TDeleteSymbol(tContext, psymbol) TDeleteTable(tContext, ptable) TDeleteText(tContext, ptext) TDeleteWire(tContext, pwire) TDeleteItem(tContext,pItem) DBX Delete functions return a DBX error return status, and an updated DBX item, either in an item type specific DBX item structure, or as a TItem from TDeleteItem. The item is indicated as no er being a valid Schematic design item by having its DBID property set equal to zero. 6.5 Highlighting Objects Twenty-nine functions highlight and unhighlight Schematic design objects. Input to each function draw p-cad error dbx32.dll the item to be highlighted or unhighlighted, and a highlight color for highlight functions. Items may be highlighted or unhighligted using item type specific function calls, or by using a DBX TItem as input to THighlightItem and TUnHighlightItem. All items in the active design may be unhighlighted using the TUnHighlightAll function. All items in a net may be highlighted or unhighlighted using the THighlightNet and TUnHighlightNet functions, respectively. The item to be highlighted or unhighlighted is declared as a TArc, TAttribute, TBus, TField, TLine, TNet, TPin, TPoint, TPort, TSymbol, draw p-cad error dbx32.dll, TTable, TText, TWire or TItem, respectively. The highlight color color is declared as a value and specifies highlight colors 1 through 20. The 20 colors associated with the highlight color constants are listed 42

48 in Appendix A, P-CAD DBX Data Constants under DBX Color Index Types. Individual items highlighted or unhighlighted are returned having their ishighlighted field updated to indicate its highlight color. (ishighlighted is 0 to indicate that the item is not highlighted and ranges 1 through 20 to specify which highlight color is in use.) 6.6 Modifying Object Properties Fourteen functions modify Schematic design objects properties. Input to the function is the item to be modified. Items may be modified using item type specific function calls, or by using a DBX Titem as input to TModifyItem. The modification to be performed is specified by setting one or more of the DBX item properties prior to calling the Modify draw p-cad error dbx32.dll. The properties that may be modified by a DBX program are specific to the type of item being modified and are listed below. All modifications must conform to P-CAD Schematic design rules. For example, component refdes values must be unique and contain no invalid characters; a location or rotation which would move the item outside the design workspace will return a DBX error value of DBX_ITEM_OUTSIDE_WORKSPACE; moving an item to an invalid layer will return an error value of DBX_INVALID_LAYER. 43

49 The item to be modified is declared as a TArc, TAttribute, TBus, TField, TLine, TNet, TNetClass, TPin, Tpoint, TPort, TSymbol, TText, TWire or TItem, respectively. The item properties are updated to reflect the item status after the Modify call. Item properties not legal for modification that were modified in the DBX item prior to the function call are overwritten with valid data representing the item's current state after the Modify call, draw p-cad error dbx32.dll. The function TModifyPin is only applicable to free pins only. Modifing a symbol s refdes may result in components being created and deleted. If you change refdes to an existing component, it must be of the same type and the gate must be unused. Note: For information on modifying component, symbol and net attributes, see sections 6.13, 6.14 and 6.15, respectively. Note: For information on net conectivity issues, see section Placing Objects 44

50 Eleven functions place Schematic design objects in an active Schematic design, draw p-cad error dbx32.dll. Input to the function is the item to be placed. There is no generic TPlaceItem form. The properties for the item to be placed is specified by setting one or more of the DBX item properties prior to draw p-cad error dbx32.dll the Place function. The properties that must be specified during placement are specific to the type of item being placed and are listed below. All items to be placed, and the properties of those items, draw p-cad error dbx32.dll, must conform to P-CAD Schematic design rules. For example, component refdes values must be unique and contain no invalid characters; a location or rotation which would place the item outside the design workspace will return a DBX error value of DBX_ITEM_OUTSIDE_WORKSPACE; placing an item on an invalid layer will return an error value of DBX_INVALID_LAYER. The item to be placed is declared as a TArc, TAttribute, TBus, TField, TLine, TPin, TPoint, TPort, TSymbol, Ttext and TWire, respectively. The specifiable properties for each DBX item are listed below. Note that except for component.libraryname, component.typename, and point.infotext, these are exactly the properties valid for DBX Modify operations, draw p-cad error dbx32.dll. Note also that all properties listed must be specified to place a new design item. Arc: width, radius, centerpt, startang, sweepang, layerid Attribute: type, value, refpoint, textstyleid, justpoint, isvisible, layerid Bus: startpt, endpt, busname, layerid Field: fieldkeytype, refpoint, textstyleid, layerid, justpoint Line: width, startpt, endpt, style, layerid Pin: refpoint, style, pinnumber, layerid, pinlength Point: pointtype, x, y (location), layerid; textinfo, rulecategory, ruletype (InfoPoint only) Port: porttype, pinlength, refpoint, layerid, netid Symbol: comptype, refdes, partnumber, alttype, draw p-cad error dbx32.dll, refpoint, libraryname, layerid Text: text, refpoint, textstyleid, justpoint, layerid Wire: startpt, endpt, netid, layerid, width DesignInfo: ismodified Note: When placing a symbol, symbol.libraryname, if specified, must include the complete library path and file name (e.g. c:\p-cad\demo.lib). If not specified by leaving the input property field blank, the open libraries will be searched in the current open library order for the input component type. TModifyDesignInfo(tContext, pdesigninfo) TPlaceArc(tContext, parc) TPlaceAttribute(tContext, pattribute) TPlaceBus(tContext, pbus) TPlaceField(tContext, pfield) TPlaceLine(tContext, pline) TPlacePin(tContext, ppin) TPlacePoint(tContext, ppoint) TPlacePort(tContext, pport) TPlaceSymbol(tContext,pSymbol) TPlaceText(tContext, ptext) TPlaceWire(tContext, pwire) DBX Place functions return a DBX error return status, and an updated DBX item. The item properties are updated to reflect the item status after the Place call. Item properties not legal to be specified during placement that were specified in the DBX item prior to the function call are overwritten with valid data representing the item's current state after the 45

51 Place call. When placing a symbol, if the component doesn t exist it will be created otherwise the comptype field must be the same as the existing component. Note: For information on net connectivity issues concerning placing a wire or symbol, see section Creating and Deleting Nets Two functions create and delete a Schematic net. Input to the TCreateNet function is a DBX TNet item. The net.netname field must specify the name of the new net. The name must be a valid netname, and not be a duplicate of an existing net. All other TNet properties are ignored. A Schematic net must contain no design items (lines, arcs, vias) and have no net nodes to be deleted. See Sections 6.4, Deleting Objects, and 6.9, Adding and Deleting Net Nodes for information on how to delete net items and net nodes. Note: When deleting a net, net objects (using GetFirstNetItem and GetNextNetItem) should be deleted first, then delete the net nodes (using GetFirstNetNode and GetNextNetNode). It is not necessary to delete all net attributes before deleting a net. TCreateNet(tContext, draw p-cad error dbx32.dll, pnet) TDeleteNet(tContext, pnet) DBX TCreateNet and TDeleteNet functions return a DBX error return status, and an updated DBX net item. If successful, a created TNet will be returned and indicate a valid net number in the net.netnumber field. A deleted net will be indicated by a net.netnumber field value of zero. 6.9 Adding and Deleting Net Nodes Two functions add and delete Schematic net nodes. Input to these functions is the net number, and the pin to be added or deleted. netid is declared as a, and must be a valid net number. pitem is the node to be added or deleted from the net, and is declared as a TItem with the pin structure filled in. TAddNetNode(tContext, netid, draw p-cad error dbx32.dll, pitem) TDeleteNetNode(tContext, netid, pitem) DBX TAddNetNode and TDeleteNetNode functions return a DBX error return status, and an updated DBX TItem with the pin structure filled in. If a pin has been successfully added to a net, the pin netid property will be updated to reflect the net number of the net to which it has been added. If a pin has been successfully deleted from a net, the pin netid property will be set to zero, indicating it bes to no nets Creating and Deleting NetClasses Two functions create and delete a Schematic design net class. Input to the TCreateNetClass function is a DBX TNetClass item. The netclass.netclassname field must specify the name of the new net class, draw p-cad error dbx32.dll. The name must be a valid netclassname, and not be a duplicate of an existing netclass. All other TNet properties are ignored. 46

52 TCreateNetClass(tContext, pnetclass) TDeleteNetClass(tContext, pnetclass) DBX TCreateNetClass and TDeleteNetClass functions return a DBX error return status, and an updated DBX net class item. If successful, a created TNetClass will be returned and indicate a valid net class number in the netclass.numberofnets field Adding and Deleting NetClassNets Two functions add and delete a Schematic design net class net. Input to the TCreateNetClassNet function is a DBX netclassid and a TNet item. The netclassid is declared as a and must be a valid NetClass number. pnet 12505 oracle error the net to be added or deleted from the net, and is declared as a TNet with the net structure filled in. TAddNetClassNet(tContext, netclassid, pnet) TDeleteNetClassNet(tContext, netclassid, pnet) DBX TAddNetClassNet and TDeleteNetClassNet functions return a DBX error return status and the number of nets in the net class is incremented or decremented Creating and Deleting ClassToClass Rules Two functions create and delete a Schematic design class to class rules, draw p-cad error dbx32.dll. Input to the TCreateClassToClass function is a DBX TClassToClass item. TCreateClassToClass(tContext, pclasstoclass) TDeleteClassToClass(tContext, pclasstoclass) DBX TCreateClassToClass and TDeleteClassToClass functions return a DBX error return status Modifying Component Attributes Three functions modify component attributes. Input to these functions is the component refdes, which you declare as a string variable in Visual Basic, and as a Char* in C or C++, and the attribute to be added, modified, or deleted, draw p-cad error dbx32.dll, pattribute, declared as a TAttribute. TAddCompAttribute(tContext, draw p-cad error dbx32.dll, refdes, pattribute) TModifyCompAttribute(tContext, refdes, pattribute) TDeleteCompAttribute(tContext, refdes, pattribute) The following TAttribute properties are used when adding an attribute to a component: type, value. The component attribute is added, modified, or deleted to/from all symbols of that component instance. Use TModifySymbolAttribute to modify the graphical representation of each individual symbol. The following TAttribute properties may be modified using the TModifyCompAttribute function: value. 47

53 DBX Modify Component Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties updated, draw p-cad error dbx32.dll. A deleted attribute will be returned with its DB ID set to zero Modifying Symbol Attributes Draw p-cad error dbx32.dll function is available to modify a symbol s attributes. Input to this function is the symbol object s reference designator (e.g. U1:A) and the attribute to be modified declared as a TAttribute. status = TModifySymbolAttribute(tContext,SymbolRefDes, TAttribute) Only the graphical representation of a symbol is modifiable by this function, including refpoint, textstyle, justification, and visibility. The user can not change its value. Use TModifyCompAttribute to change a symbol s attribute value (note that this value is shared by all symbols in the component). DBX Modify Symbol Attribute function returns any of the following DBX error return status (DBX_ITEM_NOT_FOUND if the target symbol is not found and DBX_MODIFY_ERROR for others). If successful, the function returns an updated DBX TAttribute item. Modified attributes will be returned with all attribute properties updated Modifying Net Attributes Three functions modify net attributes. Input to these functions is the net number, netid, which you declare as a, and the attribute to be added, modified, or deleted, pattribute, declared as a TAttribute. TAddNetAttribute(tContext, netid, pattribute) TModifyNetAttribute(tContext, netid, pattribute) TDeleteNetAttribute(tContext, netid, pattribute) The following TAttribute properties are used when adding an attribute to a net or modifying an existing net attribute: type, and value. Net attributes are not visible. All other properties are ignored when adding or modifying a net attribute. DBX Modify Net Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties updated. A deleted attribute will be returned with its DB ID set to zero Modifying Design Attributes Three functions modify design attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddDesignAttribute(tContext, pattribute) TModifyDesignAttribute(tContext, pattribute) TDeleteDesignAttribute(tContext, pattribute) The following TAttribute properties are used when adding an attribute to a design or 48

54 modifying an existing design attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a design attribute. DBX Modify Design Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified attributes will be returned with all attribute properties 79 error power power off. A deleted attribute will be returned with its DB ID set to zero Modifying NetClass Attributes Three functions modify NetClass attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddNetClassAttribute(tContext, netclassid, pattribute) TModifyNetClassAttribute(tContext, netclassid, pattribute) TDeleteNetClassAttribute(tContext, netclassid, pattribute) The following TAttribute properties are used when adding a NetClass attribute to a design or modifying an existing NetClass attribute: type, draw p-cad error dbx32.dll, value, formula, comment and units. All other properties are ignored when adding or modifying a NetClass attribute. DBX Modify NetClass Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified NetClass attributes will be returned with all attribute properties updated. A draw p-cad error dbx32.dll NetClass attribute will be returned with its DB ID set to zero Modifying ClassToClass Attributes Three functions modify ClassToClass attributes. The attribute to be added, modified, or deleted, pattribute, is declared as a TAttribute. TAddClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) TModifyClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) TDeleteClassToClassAttribute(tContext, netclassid1, netclassid2, pattribute) The following TAttribute properties are used when adding a ClassToClass attribute to a design or modifying an existing ClassToClass attribute: type, value, formula, comment and units. All other properties are ignored when adding or modifying a ClassToClass attribute. DBX Modify ClassToClass Attribute functions return a DBX error return status, and an updated DBX TAttribute item. Added or modified ClassToClass attributes will be returned with all attribute properties updated. A deleted ClassToClass attribute will be returned with its DB ID set to zero Saving a Design The following function is used to save the active design. 49

55 TSaveDesign(tContext) The active design will be written to disk in the same manner as if the File Save command was chosen from the P-CAD application menu Selecting Print Jobs Three functions select or deselect the print jobs in the active design. Selected print jobs are those that are output during the next print operation. Print jobs draw p-cad error dbx32.dll specified in the jobname string. TSelectPrintJob(tContext, jobname) TDeselectPrintJob(tContext, jobname) TSelectAllPrintJob(tContext) the TSelectPrintJob and TDeselectPrintJob functions will select or deselect the print job specified by its name. The TSelectAllPrintJobs function will select all the print jobs in the active design Printing Print Jobs Two functions print the print jobs of the active design to the current printer. Print jobs are specified in the jobname string. TOutputPrintJobByName(tContext, jobname) TOutputSelectedPrintJobs(tContext) The TOutputPrintJobByName function will print the job specified by its name, regardless of whether or not it has been selected for output. The TOutputSelectedPrintJobs function will print jobs that are selected for output Net Connectivity Issues When Modifying Objects When modifying an object in the editor you receive visual feedback about the operations you are performing on object. This is extremely important when dealing with object that have net connectivity (i.e. symbols, wires). When you place, flip, rotate, move or otherwise modify an object you have a visual cue as what happens to the objects net connectivity. Through DBX, however many times these visual cues will not be apparent to the DBX programmer. For example, if you flip a symbol so that one or more of its pins intersect a wire DBX has no way of knowing whether you wanted those pins to be connected to the wire. It would be inefficient for the DBX programmer to have to check every net to see if any of the pins on the symbol you flipped were added to a net. DBX s Approach to Adding, Modifying Wires When placing a wire through DBX, you must do so using an existing net ID. The following C++ example shows how to create a net and then place a wire using that net ID: 50

56 TNet anet; TWire awire; strcpy(anet.netname, NET1 ); status = TCreateNet(tContext, anet); if(status!= DBX_OK) { return error message here } awire.netid = anet.netid; set the rest of the wire properties TPlaceWire(tContext,aWire); create the net assign the wire to the net create the wire You could use the net ID to place more wires in the same net, however even if two of them intersected the visual cues (i.e. the Open Ends) will not be resolved. The following figure shows an example of the differences between parts placed through the editor and DBX. DBX s Approach to Adding, Modifying Symbols & Pins Wires are just the visible representation that a symbol or pin has been added to a net. In the editor to add a symbol or pin to an existing wire (and therefore to its underlying net) you would either place or move one of the symbols pins over the wire. Using DBX the same method is not applicable. To add a symbol so that it bes to a net: First determine where on the wire you want to place the symbol. Second place the part using 51

View more

watch the thematic video

AUTOCAD CRACK AUTODESK AUTOCAD 2022 HOW TO INSTALL AUTOCAD 2022

0 Comments

Leave a Comment