|  | 
 
| 
Hi all,
x
EDA365欢迎您登录!您需要 登录 才可以下载或查看,没有帐号?注册  I want share with you some script.
 /*
 ; FILE NAME: bbv_xsection.il
 ; VERSION: 2.0
 ;
 ;AUTHOR: eba
 ;DATE: March 10,2009
 ;
 ; COMMAND NAME: gen_xsection
 ; DESCRIPTION:
 ;   This allegro skill routine reads the current Allegro drawing extracting
 ;   all blind/buried vias, sorts the vias into various catagories, the creates
 ;   a graphical image of the via structure in a simple cross section diagram
 ;   that is added to the drawing in a group named "BBV-XSECTION".
 ;
 ;   This command askes the user to pick an XY location for the placement of
 ;   the cross section diagram.
 ;
 ;   This Command also create two SUBCLASSES ( CROSS_SECTION and CROSS_SECTION_VIAS)
 ;   under the MANUFACTURING class. The basic cross section geometry is placed on
 ;   the MANUFACTURING/CROSS_SECTION layer, and Drill graphics are placed on the
 ;   MANUFACTURING/CROSS_SECTION_VIAS layer.
 ;
 ;   DISCLAIMER:
 ;   It is the resposibility of the user to maintain and alter this software. This
 ;   Software is not supported by cadence Design Systems. The User runs this software
 ;   at his or her own risk. Cadence Design Systems claims no responsibility for the
 ;   results of running this software.
 ;   You copy it, you use it, you own it.
 ;
 ; REVISIONS:
 ; 1.0   10-mar-09  eba  Initial Version
 ; 2.0   05-jan-10  eba  corrected outer dielectric layer issue and created a high
 ;                       sort to display via stack in more of an order. Removed the
 ;                        for a seed symbol, added x-seciton graphics and associated
 ;                        with a group named "BBV-XSECTION".
 ;
 */
 
 
 axlCmdRegister( "gen_xsection" '_XSECGEN_Start ?cmdType "general")
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_Start
 
 SYNOPSIS:
 _XSECGEN_Start(
 )->
 
 DESCRIPTION:
 This is the main function call for creating the cross section graphic data
 with display of various used via configurations.
 
 ARGUMENTS:
 
 RETURNS:
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_Start ()
 let( ( units xsec_table used_bbvias subclass_def stack_count bbvia_list)
 when( axlOKToProceed() && upperCase( axlDBGetDesign()->objType) == "DESIGN"; make sure no other command is still running.
 units = car(axlDBGetDesignUnits()) ; get the current drawing units
 xsec_table = _XSECGEN_buildLayerData() ; get the board cross section data
 bbvia_list = _XSECGEN_getUsedBBVias() ;get bbvias
 if( bbvia_list then; make sure blind and buried vias exist.
 ;; build the master used via table list
 master_via_list = _XSECGEN_buildUsedLayerVias(
 _XSECGEN_buildViaTable( bbvia_list xsec_table)
 )
 ;; are the via graphics to be minumized
 when( _XSECGEN_getSetValues("MINIMAL_LAYOUT")
 master_via_list = _XSECGEN_getStackedBBVias(master_via_list)
 )
 
 stack_count = length( master_via_list) ;; get the number of conductor/plane layers
 xsect_grp = _XSECGEN_grpCreate()
 ; create the cross section graphics
 _XSECGEN_addXsectionGraphics(master_via_list stack_count xsec_table units xsect_grp )
 else
 sprintf( msg "Warning: No blind-buried vias found:/n")
 sprintf( msg "%sUnable to find blind-buried vias in design/n" msg)
 sprintf( msg "%sCommand will exit." msg)
 axlUIConfirm( msg )
 )
 
 )
 axlMsgPut( "Done")
 ))
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getSetValues
 
 SYNOPSIS:
 _XSECGEN_getSetValues(
 prop_name
 )-> value
 
 DESCRIPTION:
 This function returns the assignd values to properties names passed
 to it.
 Current Properties are:
 "XSECTIONCLASSSUBCLASS" : the CLASS/SUBCLASS to add cross section
 graphics to
 "VIACLASSSUBCLASS"      : the CLASS/SUBCLASS to add via stacking
 graphics to
 "TEXTBLOCK"            : The text block size for conductor/plane
 layer labels in the cross section
 "MINIMAL_LAYOUT"        : t , reduces the via stack display to minimal
 nil, maximizes via stack display
 
 ARGUMENTS:
 prop_name   A string of property name.
 
 RETURNS:
 value   The value for the given property
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_getSetValues ( prop_name )
 prog( ()
 
 case( upperCase(prop_name)
 ("XSECTIONCLASSSUBCLASS"
 return( "MANUFACTURING/CROSS_SECTION" ) ; must conatain a legal CLASS and SUBCLASS NAME
 )
 ("VIACLASSSUBCLASS"
 return( "MANUFACTURING/CROSS_SECTION_VIAS" ) ; must conatain a legal CLASS and SUBCLASS NAME
 )
 ("TEXTBLOCK"
 return("4" ); Text block number in String format
 )
 ("MINIMAL_LAYOUT"
 return( t ); Use only "t" or "nil"
 )
 )
 return(nil)
 ))
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getCrossHatch
 
 SYNOPSIS:
 _XSECGEN_getCrossHatch(
 xhatch_type units
 )-> value
 
 DESCRIPTION:
 This function returns a list of cross hatch definitions for
 a shape definition.
 "DBDIAG"
 "LDIAG"
 "RDIAG"
 "HORIZ"
 "VERT"
 "HORZVERT"
 "SOLID"
 "NONE"
 
 ARGUMENTS:
 xhatch_type   A string for the requested cross hatch type
 
 units         The current drawing user units
 
 RETURNS:
 xhatch   xhatch_list/t/nil values for the cross hatching of a shape
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_getCrossHatch ( xhatch_type units )
 prog( ( xhatch_list spacing width)
 xhatch_list = list()
 
 case( xhatch_type
 ("DBDIAG"
 spacing =  axlMKSConvert( .010 "inches" units)
 width =  axlMKSConvert( .001 "inches" units)
 xhatch_list = list(
 make_axlFill( ?spacing spacing ?width width ?origin '(0.0 0.0) ?angle 45.0)
 make_axlFill( ?spacing spacing ?width width ?origin '(0.0 0.0) ?angle 135.0)
 )
 )
 ("LDIAG"
 spacing =  axlMKSConvert( .150 "inches" units)
 width =  axlMKSConvert( .001 "inches" units)
 xhatch_list = list(
 make_axlFill( ?spacing spacing ?width width ?origin '(0.0 0.0) ?angle 135.0)
 )
 )
 ("RDIAG"
 spacing =  axlMKSConvert( .150 "inches" units)
 width =  axlMKSConvert( .001 "inches" units)
 xhatch_list = list(
 make_axlFill( ?spacing spacing ?width width ?origin '(0.0 0.0) ?angle 45.0)
 )
 )
 ("HORIZ"
 spacing =  axlMKSConvert( .050 "inches" units)
 width =  axlMKSConvert( .001 "inches" units)
 xhatch_list = list(
 make_axlFill( ?spacing spacing ?width width ?origin '(0.0 0.0) ?angle 90.0)
 )
 )
 ("VERT"
 spacing =  axlMKSConvert( .050 "inches" units)
 width =  axlMKSConvert( .001 "inches" units)
 xhatch_list = list(
 make_axlFill( ?spacing spacing ?width width ?origin '(0.0 0.0) ?angle 0.0)
 )
 )
 ("HORZVERT"
 spacing =  axlMKSConvert( .050 "inches" units)
 width =  axlMKSConvert( .001 "inches" units)
 xhatch = list(
 make_axlFill( ?spacing spacing ?width width ?origin '(0.0 0.0) ?angle 0.0)
 make_axlFill( ?spacing spacing ?width width ?origin '(0.0 0.0) ?angle 90.0)
 )
 )
 ("SOLID"
 xhatch_list = t
 )
 ("NONE"
 xhatch_list = nil
 )
 ( t
 xhatch_list = nil
 )
 )
 
 return( xhatch_list )
 ))
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getDielectricHeight
 
 SYNOPSIS:
 _XSECGEN_getDielectricHeight(
 units
 )-> value
 
 DESCRIPTION:
 This function is where the dielectirc layer cross section
 height/thickness value is defined. The thickness value
 is set here in inches. The function is passed the current
 drawing and the value returned is in current drawing units.
 
 ARGUMENTS:
 units   The current drawing user units.
 
 RETURNS:
 value   Floating value in current user units.
 ------------------------------------------------------------------------
 */
 
 defun( _XSECGEN_getDielectricHeight (units)
 prog( ()
 return( axlMKSConvert( .150 "inches" units))
 ))
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getPlaneHeight
 
 SYNOPSIS:
 _XSECGEN_getPlaneHeight(
 units
 )-> value
 
 DESCRIPTION:
 This function is where the default plane layer cross section
 layer height/thickness value is defined. The thickness value
 is set here in inches. The function is passed the current
 drawing and the value returned is in current drawing units.
 
 ARGUMENTS:
 units   The current drawing user units.
 
 RETURNS:
 value   Floating value in current user units.
 ------------------------------------------------------------------------
 */
 
 defun( _XSECGEN_getPlaneHeight (units)
 prog( ()
 return(  _XSECGEN_getConductorHeight(units)); keep same as conductor layer
 ))
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getConductorHeight
 
 SYNOPSIS:
 _XSECGEN_getConductorHeight(
 units
 )-> value
 
 DESCRIPTION:
 This function is where the default conductorlayer cross section
 height/thickness value is defined. The thickness value
 is set here in inches. The function is passed the current
 drawing and the value returned is in current drawing units.
 
 ARGUMENTS:
 units   The current drawing user units.
 
 RETURNS:
 value   Floating value in current user units.
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_getConductorHeight (units)
 prog( ()
 return( axlMKSConvert( .075 "inches" units))
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_buildLayerData
 
 SYNOPSIS:
 _XSECGEN_buildLayerData(
 )->layer_data_list
 
 DESCRIPTION:
 This function reads the current cross section data of the design and
 generates a list of layer definitions.
 The layer definitions are defined as
 layer_code      "C"= conductor, "
  " Plane , "D" = dielectric, "M" = mask subclass name   The subclass name of the layer under the ETCH class. Dielectrics
 are not contains within the ETCH class.
 material name   The Material name derived from the cross section definition
 thickness       The material thickness derived from the cross section definition
 layer number    Numbered in sequence read from cross section definition
 1-300: conductor or plane layer
 301 - 500: Dielectric layer number
 501 - ~: Mask layer number
 
 ARGUMENTS:
 
 RETURNS:
 layer_data_list     A list of layer data lists
 
 list(
 list(
 "<Layer Code>"
 "<subclass name>"
 "<material name>"
 <thickness>
 <layer number>
 )
 .
 .
 .
 )
 EXAMPLE OUTPUT:
 (
 ( (
 ("C" "TOP" "0.5_OZ_CU+.025MM_PL" "1.614173 mil" 1)
 ("D" "-" "G10" "3.307087 mil" 301)
 ("C" "LAYER_2" "0.5_OZ_CU+.025MM_PL" "1.614173 mil" 2)
 ("D" "-" "G10" "3.307087 mil" 302)
 ("C" "LAYER_3" "0.5_OZ_CU+.025MM_PL" "1.614173 mil" 3)
 ("D" "-" "G10" "3.307087 mil" 303)
 ("C" "BOTTOM" "0.5_OZ_CU+.025MM_PL" "1.614173 mil" 4)
 )
 ------------------------------------------------------------------------
 */
 defun(  _XSECGEN_buildLayerData ()
 prog( ( de msk layer_data_list lyr_data ltype lname lMaterial lThickness layer_number)
 ;;Set the starting layer interger numbers to identify the layer type.
 de = 301; Dielectric layers
 msk = 501; Mask Layers
 
 layer_data_list = list()
 foreach( lyr axlGetXSection(); extract the xsection and read each layer
 unless( nth(2 lyr) == "AIR" ; Ignore the AIR layer
 case( nth(1 lyr)
 ; Dielectric data
 ("DIELECTRIC"
 ltype = "D"
 lname = "-"
 lMaterial = nth(2 lyr)
 lThickness = nth(3 lyr)
 layer_number = de++
 )
 
  lane layer ( a conductor layer) ("
  LANE" ltype = "P"
 lname = nth(0 lyr)
 lMaterial = nth(2 lyr)
 lThickness = nth(3 lyr)
 layer_number= axlLayerGet(strcat("ETCH/" nth(0 lyr)))->number + 1
 )
 ;Conductor layer
 ("CONDUCTOR"
 ltype = "C"
 lname = nth(0 lyr)
 lMaterial = nth(2 lyr)
 lThickness = nth(3 lyr)
 layer_number = axlLayerGet(strcat("ETCH/" nth(0 lyr)))->number + 1
 )
 ; undesignated layer or mask layer if defined.
 ( t
 ltype = "M"
 lname = "mask"
 lMaterial = nth(2 lyr)
 lThickness = nth(3 lyr)
 layer_number =  msk++
 )
 );case
 
 ;build layer data list
 lyr_data = list( ltype lname lMaterial lThickness layer_number)
 layer_data_list = append1(layer_data_list lyr_data)
 )
 )
 return( layer_data_list)
 
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getUsedBBVias
 
 SYNOPSIS:
 _XSECGEN_getUsedBBVias(
 )->layer_data_list
 
 DESCRIPTION:
 This function sets visibility of all vias layers then selects
 all the vias in the drawing. Each via is the examined to verify
 it is not a Through via, but a bbvia. These bbvia dbids are then
 added to the list tht is returned. the graphics are then returned
 to the previous state.
 
 ARGUMENTS:
 
 RETURNS:
 l_bbvs     A list of blind/burried via dbids
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_getUsedBBVias ()
 prog( (l_bbvs)
 _XSECGEN_fndFltrVias(); set find filter
 visible_layers = axlVisibleGet() ; get current graphics data
 axlVisibleDesign(t); set entire graphics visible
 
 l_bbvs = list(); intialize used via list
 design_vias = axlGetSelSet( axlAddSelectAll()); select all via in design
 axlVisibleSet( visible_layers ) ; return to origin graphics visibility
 
 ;; find and save the dbids of all bbvias
 foreach( bbv design_vias
 unless( car(bbv->startEnd) == cadr(bbv->startEnd)
 l_bbvs = cons( bbv l_bbvs)
 )
 )
 ; clear the select table
 axlClearSelSet()
 
 ; return the list
 return( l_bbvs)
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_fndFltrVias
 
 SYNOPSIS:
 _XSECGEN_fndFltrVias(
 )->layer_data_list
 
 DESCRIPTION:
 This function sets find filter for vias only
 ARGUMENTS:
 
 RETURNS:
 success     t/nil
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_fndFltrVias ()
 prog( (success)
 
 success = axlSetFindFilter(
 ?enabled '("NOALL" "VIAS")
 ?onButtons '("VIAS")
 )
 return( success)
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_buildViaTable
 
 SYNOPSIS:
 _XSECGEN_buildViaTable(
 l_bbvias
 xsec_table
 )->l_via_table
 
 DESCRIPTION:
 This function reads the used bbvia list and sorts the vias by xy
 coordinates. The vias defined at each xy coordinate is saved as a
 sub list of start/end layer numbers. The list is thern returned.
 A progress meter is displayed displaying the number of vias
 processed.
 
 ARGUMENTS:
 l_bbvia      A list of blind buried via dbids
 
 xsec_table  The List of cross section data create by the
 _XSECGEN_buildLayerData function call.
 RETURNS:
 l_via_table     A list of xy coodrinates with one or more pairs of
 start/end layer numbers representing the start/end
 layer definition of a via.
 
 list(
 list( (X Y)
 list(
 list( start_layer_number  end_layer_number )
 )
 )
 .
 .
 .
 )
 
 EXAMPLE OUTPUT:
 (
 (
 (1.975 42.425)
 (
 (1 2)
 )
 )
 (
 (5.275 42.175)
 (
 (1 2)
 (2 3)
 )
 )
 (
 (4.275 40.75)
 (
 (1 2)
 (2 3)
 (3 6)
 (6 7)
 )
 )
 )
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_buildViaTable ( l_bbvias xsec_table)
 prog( (l_via_table l_via_xy max_count via_number via_array i x found last_used v_data lxy start_layer
 end_layer z)
 l_via_table = list() ; initalize the return list
 l_via_xy = list() ; initalize the via xy coordinate list
 max_count = length(l_bbvias); get the total number of vias
 via_number = 0 ; set the via counter
 ;; start the progress meter
 axlMeterCreate("Building via table." "" nil)
 
 ;initalize the via table
 declare( via_array[max_count])
 
 i = 0 ;intialize the index
 
 ;; walk through the bb via list
 foreach( bvia l_bbvias
 via_number++ ; increment the via count
 ; updated the progress meter.
 axlMeterUpdate( (100 * via_number)/max_count sprintf( nil "Read %d of %d vias." via_number max_count))
 lxy = bvia->xy; get via instance XY
 if( i > 0 then ; is this the first one?
 x=0
 found = nil
 ;;Walk throught the current array looking for matching xy coodrdinates
 while( x < max_count
 if( via_array[x] == 'unbound then
 last_used = x
 x = max_count + 1
 else
 v_data = via_array[x]
 when( car(v_data) == lxy
 ;;xy coordinate found, add a new entry into the via layer pair list
 l_via_xy = car( v_data)
 start_layer = _XSECGEN_getLayerNumber( car( bvia->startEnd) xsec_table )
 end_layer = _XSECGEN_getLayerNumber( cadr( bvia->startEnd) xsec_table)
 via_array[x] = list( l_via_xy cons( sort(list(start_layer end_layer) 'lessp) cadr( v_data ) ))
 found = t
 x = max_count
 )
 )
 x++
 )
 ;; xy coordinate not found, add a new entry into the table
 unless( found
 start_layer = _XSECGEN_getLayerNumber( car( bvia->startEnd) xsec_table )
 end_layer = _XSECGEN_getLayerNumber( cadr( bvia->startEnd) xsec_table)
 via_array[i] = list( bvia->xy  list( sort(list( start_layer end_layer) 'lessp)) )
 i++
 )
 
 else
 ;create a table entry for the first via.
 start_layer = _XSECGEN_getLayerNumber( car( bvia->startEnd) xsec_table )
 end_layer = _XSECGEN_getLayerNumber( cadr( bvia->startEnd) xsec_table)
 via_array[i] = list( bvia->xy  list( sort(list( start_layer end_layer) 'lessp)) )
 i++
 )
 )
 
 ;;close progress meter
 axlMeterDestroy()
 
 ;; convert array into a readable list.
 z = 0
 while( z < max_count
 unless(  via_array[z] == 'unbound
 l_via_table = cons( via_array[z] l_via_table)
 )
 z++
 )
 ;; return the list
 return( l_via_table)
 ))
 
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_buildUsedLayerVias
 
 SYNOPSIS:
 _XSECGEN_buildUsedLayerVias(
 used_bbvias
 )-> via_table
 
 DESCRIPTION:
 This function reads the used bbvia listreduces the list by via layering
 and stacking resulting in one list entry for each layer pair and stack.
 A progress meter is displayed displaying the number of vias entries
 processed.
 
 ARGUMENTS:
 used_bbvias      A list of blind buried via dbids creatde by the
 _XSECGEN_buildViaTable function call.
 RETURNS:
 via_table       A list lists containg via start/end layer numbers.
 list(
 list(
 list( start_layer_number  end_layer_number )
 )
 list(
 list( start_layer_number  end_layer_number )
 list( start_layer_number  end_layer_number )
 )
 )
 .
 .
 .
 )
 
 EXAMPLE OUTPUT:
 (
 (
 (1 2)
 )
 (
 (1 2)
 (2 3)
 )
 (
 (2 3)
 (3 6)
 (6 7)
 )
 )
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_buildUsedLayerVias ( used_bbvias )
 prog( (max_count via_table layer_set via_count max_index index match_found match_count)
 
 ;; intialize lists
 via_table = list()
 layer_set = list()
 
 ;; start the progress meter
 axlMeterCreate( "Sorting via layer sets" " " nil)
 
 ;;initalize via count
 via_count = 0
 max_count = length( used_bbvias)
 foreach( item used_bbvias
 via_count++;; increment via count
 ;; update meter
 axlMeterUpdate( (100 * via_count)/max_count sprintf( nil "Read %d of %d vias." via_count max_count))
 
 if( via_table == nil then
 ;; add inital via entry.
 layer_set = cadr( item )
 via_table = cons( layer_set via_table)
 else
 layer_set = cadr( item )
 max_index = length(via_table)
 index = 0
 match_found = nil
 while(index < max_index
 lyr_def= nth(index  via_table)
 when( length( lyr_def ) == length( layer_set)
 match_count = 0
 foreach( lyr layer_set
 when( member( lyr lyr_def) match_count++)
 )
 when( match_count == length(lyr_def )
 index = max_index
 match_found = t
 )
 )
 index++
 )
 unless( match_found
 layer_set = cadr( item )
 via_table = cons( layer_set via_table)
 )
 
 )
 
 )
 ;; close the meter
 axlMeterDestroy()
 
 ;; return the master list
 return( via_table )
 ))
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getLayerNumber
 
 SYNOPSIS:
 _XSECGEN_getLayerNumber(
 lyrClassSubclass
 xsec_table
 )->layer_number
 
 DESCRIPTION:
 This function returns the layer number integer of the ECTH subclass name
 defined in the cross section table created by the _XSECGEN_buildLayerData
 function
 
 ARGUMENTS:
 lyrClassSubclass The layer name in the form of "CLASS/SUBCLASS"
 xsec_table       The List of cross section data create by the
 _XSECGEN_buildLayerData function call.
 RETURNS:
 layer_number    Integervalue of the layer number. -1 returned if layer
 name not found
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_getLayerNumber ( lyrClassSubclass  xsec_table)
 prog( (subclass)
 subclass = cadr(parseString( lyrClassSubclass "/"))
 foreach( item xsec_table
 when( nth(1 item) == subclass return( nth(4 item)))
 )
 return(-1)
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getStackedBBVias
 
 SYNOPSIS:
 _XSECGEN_getStackedBBVias(
 stack_list
 )->master_via_list
 
 DESCRIPTION:
 This function taks in a list of stacked via lists and begins the sort process
 to define specific stacked via types, or individual via types.
 
 ARGUMENTS:
 stack_list   A list of via stacks created by the _XSECGEN_buildUsedLayerVias
 function.
 RETURNS:
 master_via_list    A list containing lists of via start/end layer numbers as
 individual or stacked vias.
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_getStackedBBVias ( stack_list )
 prog( (  master_via_list  list_via_set )
 master_via_list = list()
 list_via_set = list()
 ; unstacked_via_list = list()
 ; last_via = list()
 foreach( item stack_list
 list_via_set = _XSECGEN_build_stackedEntry( item )
 foreach( vs list_via_set
 unless( member( vs master_via_list)
 master_via_list = append1( master_via_list vs)
 )
 )
 )
 
 return( master_via_list )
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_build_stackedEntry
 
 SYNOPSIS:
 _XSECGEN_build_stackedEntry(
 via_stack_set
 )->layer_number
 
 DESCRIPTION:
 This functiontakes in a list of via start/end lists, determins if via sets
 are sequencial. New lists are created to separate sequencial via stacks from
 non-sequencial via stacks and returns the list data
 function
 
 ARGUMENTS:
 via_stack_set    A list of paired lists. Each paired list represents the start/end
 layer number for a via.
 
 RETURNS:
 via_set_list    A list of new via stacks
 
 EXAMPLE:
 INPUT:
 list(
 list( 1 2)
 list( 2 3)
 list( 3 4)
 list( 5 6)
 list( 7 8)
 list( 8 9)
 )
 OUTPUT:
 list(
 list(
 list( 1 2)
 list( 2 3)
 list( 3 4)
 )
 list(
 list( 5 6)
 )
 list(
 list( 7 8)
 list( 8 9)
 )
 )
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_build_stackedEntry ( via_stack_set )
 prog( ( via_set via_set_list via_count via_stack v x)
 via_set = list()
 via_set_list = list()
 via_count = length( via_stack_set)
 via_stack_set = sortcar( via_stack_set 'lessp)
 v = 0
 while( v < via_count
 via_set = append1( via_set nth(v via_stack_set))
 x = v + 1
 while( x < via_count
 if( car( nth( x via_stack_set)) == cadr( nth( (x - 1) via_stack_set)) then
 via_set = append1( via_set nth(x via_stack_set))
 x++
 v++
 else
 ;;via_set_list= append1( via_set_list via_set )
 ;;
 x = via_count
 )
 )
 via_set_list= append1( via_set_list via_set )
 via_set = list()
 v++
 )
 return( via_set_list )
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_addXsectionGraphics
 
 SYNOPSIS:
 _XSECGEN_addXsectionGraphics(
 master_via_list
 stack_count
 xsection_table
 units
 xsect_group
 )->
 
 DESCRIPTION:
 This is the main function call for creating the cross section graphic data
 
 ARGUMENTS:
 master_via_last     List of used via types and stacks created by the
 _XSECGEN_getStackedBBViasfunction
 num_cond_layers     Integer of the number of actual exlectrical layers
 (conductor and plane)
 xsection_table      List of Cross section data created by the
 _XSECGEN_buildLayerData function
 units               The current drawing units type
 xsect_grp                The groupd dbid for cross section generation.
 
 RETURNS:
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_addXsectionGraphics (master_via_list stack_count xsection_table units xsect_grp)
 let( (start_xy  XSectionClassSubclass ViaClassSubclass txt_blk xsec_length xsec_length msg
 grp_id)
 
 ;; get the placement origin for the cross section graphics
 start_xy = axlEnterPoint(?prompts "Pick Cross Section Detail Location" ?gridSnap t)
 
 ;; get subclass names
 XSectionClassSubclass = _XSECGEN_getSetValues("XSectionClassSubclass")
 ViaClassSubclass = _XSECGEN_getSetValues("ViaClassSubclass")
 
 ;;create the subclass(es)  as needed
 _XSECGEN_createXsectionSubclass( XSectionClassSubclass )
 _XSECGEN_createXsectionSubclass(ViaClassSubclass )
 
 ;; get the placement location and add the base symbol geometry
 ;; sym_dbid = _XSECGEN_addSymbolBasic( start_xy )
 
 ;; define the text block, and calculate width of xsection drawing and get max number of conductor layers.
 txt_blk = _XSECGEN_getSetValues("TextBlock")
 xsec_length = (stack_count * axlMKSConvert( .200 "inches" units)) + axlMKSConvert( .300 "inches" units)
 max_cond_layers = _XSECGEN_getConductorLayerCount( xsection_table )
 when( xsec_length < axlMKSConvert( 1.500 "inches" units) xsec_length = axlMKSConvert( 1.500 "inches" units))
 
 ;; build and draw the cross section and vias.
 _XSECGEN_buildStackup( xsection_table start_xy xsec_length units txt_blk XSectionClassSubclass xsect_grp)
 _XSECGEN_buildViaStructure( master_via_list start_xy units txt_blk ViaClassSubclass max_cond_layers xsect_grp)
 axlMsgPut( "bbv Cross section diagram created")
 
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_buildStackup
 
 SYNOPSIS:
 _XSECGEN_buildStackup(
 xsection_table
 start_xy
 xsec_length
 units
 txt_blk
 classSubclass
 xsect_grp
 )->
 DESCRIPTION:
 Walks through the cross section table, verifies the layer type,
 then calls the function to draw the layer into the cross-section
 symbol
 
 ARGUMENTS:
 xsection_table  List of Cross section data
 start_xy    The XY coordinate from the inital user pick
 xsec_length The calculated length of the cross section drawing
 units       The current drawing units type
 txt_blk     The Text block used for adding text
 classSubclass   The String of the drawing layer for the cross section
 drawing in the form of "CLASS/SUBCLASS"
 
 RETURNS:
 none
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_buildStackup ( xsection_table start_xy xsec_length units txt_blk classSubclass xsect_grp)
 prog( (sx sy grp_id lyr_data)
 ;; get the X and Y coordinate of the user picked origin
 
 sx = car(start_xy)
 sy = cadr(start_xy)
 
 ;;Set the number of layers counter
 item_count = 0
 
 ;; walk through each layer and draw the subclass
 foreach( lyr xsection_table
 case( car(lyr)
 ( "C"   ; conductor layer
 lyr_data = _XSECGEN_Draw_conductorLayer(sx sy units xsec_length txt_blk nth( 4 lyr) classSubclass xsect_grp)
 sy = cadr(lyr_data)
 )
 ( "P" ;plane layer
 lyr_data = _XSECGEN_Draw_planeLayer(sx sy units xsec_length txt_blk nth( 4 lyr) classSubclass xsect_grp)
 sy = cadr(lyr_data)
 )
 ( "D" ;Dielectric layer
 lyr_data = _XSECGEN_Draw_dielectricLayer(sx sy units xsec_length txt_blk nth( 4 lyr) classSubclass xsect_grp )
 sy = cadr(lyr_data)
 )
 ( t
 axlMsgPut("Undefined Layer Type: %s" car(lyr))
 )
 )
 item_count++
 )
 return( t )
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_buildViaStructure
 
 SYNOPSIS:
 _XSECGEN_buildViaStructure(
 master_via_list
 start_xy
 units
 txt_blk
 classSubclass
 num_cond_layers
 xsect_grp
 )->
 
 DESCRIPTION:
 This function Walks through the mater via list, determining if a via id defined
 between two layers, or more that two layers, then launches the graphic creation
 tools to create a graphical via stackup of used vias on the cross-section
 symbol.
 
 ARGUMENTS:
 master_via_last List of used via types and stacks created by the
 _XSECGEN_getStackedBBViasfunction
 start_xy    The XY coordinate from the inital user pick
 units       The current drawing units type
 txt_blk     The Text block used for adding text
 classSubclass   The String of the drawing layer for the cross section
 drawing in the form of "CLASS/SUBCLASS"
 num_cond_layers Integer of the number of actual exlectrical layers ( conductor and plane)
 xsect_grp
 
 RETURNS:
 (none)
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_buildViaStructure (master_via_list start_xy units txt_blk classSubclass num_cond_layers xsect_grp)
 let( ()
 ;get the starting  xy y coordinates after the layer title text offset.
 sx = car(start_xy) + _XSECGEN_getTextXOffset(txt_blk units) + axlMKSConvert( .125 "inches" units)
 sy = cadr(start_xy)
 ;; define the gap space between each drill graphic
 vgap = axlMKSConvert( .05 "inches" units)
 ;;Walk through the via list
 lyr_count = 1
 while( lyr_count < num_cond_layers
 foreach( via_set  master_via_list
 if( length( via_set ) == 1 then
 ; single node via so draw this via
 when( car( car( via_set)) == lyr_count
 new_xy = _XSECGEN_DrawSingleVia( via_set
 ( sx + vgap )  sy
 units classSubclass
 num_cond_layers xsect_grp
 )
 sx = car( new_xy )
 )
 else
 ;; stack vias
 when( car( car( via_set)) == lyr_count
 foreach( via via_set
 ;draw each via
 new_xy = _XSECGEN_DrawSingleVia( list( via ) ( sx + vgap )
 sy units classSubclass
 num_cond_layers xsect_grp
 )
 )
 sx = car( new_xy )
 )
 )
 )
 lyr_count++
 )
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_Draw_conductorLayer
 
 SYNOPSIS:
 _XSECGEN_Draw_conductorLayer(
 sx
 sy
 units
 xsec_length
 txt_blk
 lyr_number
 classSubclass
 xsect_grp
 )-> l_xy
 
 DESCRIPTION:
 This function creates the conductor layer graphic for the cross section
 ad attaches this graphic element (shape) to the input symbol dbid.
 
 ARGUMENTS:
 sx              The starting graphic x coordinate
 sy              The starting graphic y coordinate
 units           The current drawing units type
 xsec_length     The calculated length of the cross section drawing
 
 txt_blk         The Text block used for adding text
 lyr_number      An integer definiting the conductor layer number.
 classSubclass   The String of the drawing layer for the cross section
 drawing in the form of "CLASS/SUBCLASS"
 xsect_grp            DBID of the X-section Group
 
 RETURNS:
 l_xy            A List of the geometry's lower left xy coordinates
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_Draw_conductorLayer (sx sy units xsec_length txt_blk lyr_number classSubclass xsect_grp)
 prog( (left right top bottom  path_array shape_id)
 ;;Add the layer text label to the drawing and get t's XY position
 EndXY = _XSECGEN_addLayerTitle( sx sy classSubclass txt_blk lyr_number units xsect_grp)
 
 
 left = car( EndXY ) + axlMKSConvert( .025 "inches" units) ; derive the left x coordinate
 right = left + xsec_length ; derive the right x coordinate
 top = sy ; derive the top y coordinate
 bottom = sy - _XSECGEN_getConductorHeight(units) ; derive the bottom y coordinate
 
 ;; build the graphic figure and add to the drawing.
 path_array = axlPathStart( list( left : top) 0.0)
 axlPathLine( path_array 0.0 list( right  top) )
 axlPathLine( path_array 0.0 list( right bottom) )
 axlPathLine( path_array 0.0 list( left  bottom) )
 axlPathLine( path_array 0.0 list( left top ))
 
 ;; add the shape to the drawing
 axlDBAddGroupObjects( xsect_grp
 axlDBCreateShape(
 path_array
 _XSECGEN_getCrossHatch( "NONE" units ) ;; get cross-hatching
 classSubclass nil nil
 )
 )
 ;;axlDBCreateCloseShape( shape_id)
 
 ;; return the lower left xy coordinate
 return( list(left bottom))
 ))
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_Draw_planeLayer
 
 SYNOPSIS:
 _XSECGEN_Draw_planeLayer(
 sx
 sy
 units
 xsec_length
 txt_blk
 lyr_number
 classSubclass
 xsect_grp
 )-> l_xy
 
 DESCRIPTION:
 This function creates the plane layer graphic for the cross section
 ad attaches this graphic element (shape) to the input symbol dbid.
 
 ARGUMENTS:
 sx              The starting graphic x coordinate
 sy              The starting graphic y coordinate
 units           The current drawing units type
 xsec_length     The calculated length of the cross section drawing
 txt_blk         The Text block used for adding text
 lyr_number      An integer definiting the conductor layer number.
 classSubclass   The String of the drawing layer for the cross section
 drawing in the form of "CLASS/SUBCLASS"
 xsect_grp            DBID of the X-section Group
 
 RETURNS:
 l_xy            A List of the geometry's lower left xy coordinates
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_Draw_planeLayer (sx sy units xsec_length txt_blk lyr_number classSubclass xsect_grp)
 prog( (left right top bottom path_array shape_id)
 
 ;;Add the layer text label to the drawing and get t's XY position
 EndXY = _XSECGEN_addLayerTitle( sx sy classSubclass txt_blk lyr_number units xsect_grp )
 
 left = car( EndXY ) + axlMKSConvert( .025 "inches" units); set the left side x coordinate
 right = left + xsec_length ; set the right side x coordinate
 top = sy ; set the top y coordinate
 bottom = sy - _XSECGEN_getPlaneHeight(units); set the bottom y coordinate
 
 ;; build the graphic figure and add to the drawing.
 path_array = axlPathStart( list( left : top) 0.0)
 axlPathLine( path_array 0.0 list( right  top) )
 axlPathLine( path_array 0.0 list( right bottom) )
 axlPathLine( path_array 0.0 list( left  bottom) )
 axlPathLine( path_array 0.0 list( left top ))
 
 ;; add the shape to the drawing
 axlDBAddGroupObjects( xsect_grp
 axlDBCreateShape(
 path_array
 _XSECGEN_getCrossHatch( "DBDIAG" units ) ;; get cross-hatching
 classSubclass nil nil
 )
 )
 ;;axlDBCreateCloseShape( shape_id)
 
 ;; return the lower left xy coordinate
 return( list(left bottom ))
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_Draw_dielectricLayer
 
 SYNOPSIS:
 _XSECGEN_Draw_dielectricLayer(
 sx
 sy
 units
 xsec_length
 txt_blk
 lyr_number
 classSubclass
 xsect_grp
 )-> l_xy
 
 DESCRIPTION:
 This function creates the dielectric layer graphic for the cross section
 ad attaches this graphic element (shape) to the input symbol dbid.
 
 ARGUMENTS:
 sx              The starting graphic x coordinate
 sy              The starting graphic y coordinate
 units           The current drawing units type
 xsec_length     The calculated length of the cross section drawing
 txt_blk         The Text block used for adding text
 lyr_number      An integer definiting the conductor layer number.
 classSubclass   The String of the drawing layer for the cross section
 drawing in the form of "CLASS/SUBCLASS"
 xsect_grp            DBID of the X-section group
 
 RETURNS:
 l_xy            A List of the geometry's lower left xy coordinates
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_Draw_dielectricLayer (sx sy units xsec_length txt_blk lyr_number classSubclass xsect_grp)
 prog( (left right top bottom path_array xhatch shape_id)
 
 ;; get the text offset to find the actual graphic starting point
 left = sx + _XSECGEN_getTextXOffset(txt_blk units) + axlMKSConvert( .025 "inches" units); set the left side x coordinate
 right = left + xsec_length; set the right side x coordinate
 top = sy; set the top y coordinate
 bottom = sy - _XSECGEN_getDielectricHeight(units) ; set the bottom y coordinate
 
 ;; build the graphic figure and add to the drawing.
 path_array = axlPathStart( list( left : top) 0.0)
 axlPathLine( path_array 0.0 list( right  top) )
 axlPathLine( path_array 0.0 list( right bottom) )
 axlPathLine( path_array 0.0 list( left  bottom) )
 axlPathLine( path_array 0.0 list( left top ))
 
 ;; determine the layer number to alternate the cross-hatching
 if( mod(lyr_number 2) > 0 then
 xhatch = _XSECGEN_getCrossHatch( "LDIAG" units ) ;; get cross-hatching
 else
 xhatch = _XSECGEN_getCrossHatch( "RDIAG" units ) ;; get cross-hatching
 )
 
 ;; add the shape to the drawing
 axlDBAddGroupObjects( xsect_grp
 axlDBCreateShape( path_array xhatch classSubclass nil nil)
 )
 ;;axlDBCreateCloseShape( shape_id )
 
 ;; return the lower left xy coordinate
 return( list(sx bottom))
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getTextXOffset
 
 SYNOPSIS:
 _XSECGEN_getTextXOffset(
 
 txt_blk
 units
 )-> offset
 
 DESCRIPTION:
 This function gets the character width and spacing for the text block entered
 and returns the combined value .
 
 ARGUMENTS:
 txt_blk         A String of the Text blocknumber
 units           The current drawing units type
 
 RETURNS:
 offset          The combined character width and spacing values.
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_getTextXOffset (txt_blk units)
 prog( (offset blkId txtPARM)
 txtParm = sprintf( txtParm "paramTextBlock:%s" txt_blk)
 blkId= axlGetParam( txtParm )
 offset = (blkId->width + blkId->charSpace) * 8
 return( offset )
 ))
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getTextHeigth
 
 SYNOPSIS:
 _XSECGEN_getTextHeight(
 
 txt_blk
 units
 )-> offset
 
 DESCRIPTION:
 This function gets the character height for the text block entered
 and returns the combined value .
 
 ARGUMENTS:
 txt_blk         A String of the Text blocknumber
 units           The current drawing units type
 
 RETURNS:
 offset          The combined character height value.
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_getTextHeight (txt_blk units)
 prog( (offset blkId txtParm)
 txtParm = sprintf( txtParm "paramTextBlock:%s" txt_blk)
 blkId= axlGetParam( txtParm )
 offset = blkId->height
 return( offset )
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_addLayerTitle
 
 SYNOPSIS:
 _XSECGEN_addLayerTitle(
 sx
 sy
 classSubclass
 txt_blk
 lyr_number
 units
 xsect_grp
 )-> symbol_dbid
 
 DESCRIPTION:
 This function creates the dielectric layer graphic for the cross section
 ad attaches this graphic element (shape) to the input symbol dbid.
 
 ARGUMENTS:
 sx              The starting graphic x coordinate
 sy              The starting graphic y coordinate
 classSubclass   The String of the drawing layer for the cross section
 drawing in the form of "CLASS/SUBCLASS"l
 txt_blk         The Text block used for adding text
 lyr_number      An integer definiting the conductor layer number.
 units           The current drawing units type
 xsect_grp            The DBID of the x-section group
 
 
 RETURNS:
 l_xy            A List of the layer title xy  coordinates
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_addLayerTitle ( sx sy classSubclass txt_blk lyr_number units xsect_grp)
 prog( (xoff yoff txt_id)
 
 ;; set the text offset for right justification
 xoff = sx + _XSECGEN_getTextXOffset(txt_blk units)
 yoff = sy - _XSECGEN_getTextHeight(txt_blk units)
 
 ;; create the layer title text
 sprintf( layerTitle "LAYER %d" lyr_number)
 
 ;; add text label to graphics
 axlDBAddGroupObjects( xsect_grp caar( axlDBCreateText( layerTitle
 list( xoff yoff)
 make_axlTextOrientation( ?textBlock txt_blk ?rotation 0.0 ?mirrored nil ?justify "RIGHT")
 classSubclass
 nil
 )
 )
 )
 ;; return the coordinate pair
 return(list( xoff yoff ))
 )) /*End of _XSECGEN_addLayerTitle */
 
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_createXsectionSubclass
 
 SYNOPSIS:
 _XSECGEN_createXsectionSubclass(
 layerName
 )-> t
 
 DESCRIPTION:
 Creates and makes visible the inputed CLASS/SUBCLASS. The input
 String for the names must be legal definitions
 
 
 ARGUMENTS:
 start_x       String of the layer name in the form of "CLASS/SUBCLASS"
 
 RETURNS:
 t
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_createXsectionSubclass (layerName )
 let( ()
 unless( axlIsLayer(layerName)
 axlLayerCreateNonConductor( layerName )
 axlVisibleLayer( layerName  t )
 axlVisibleUpdate(nil)
 )
 
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_DrawSingleVia
 
 SYNOPSIS:
 _XSECGEN_DrawSingleVia(
 via_set
 sx
 sy
 units
 classSubclass
 max_layer
 xsect_grp
 )-> newXY
 
 DESCRIPTION:
 This takes in a list of via start layer numbers. It the numbers are
 sequencial, then a call to the uvia graphic is called, otherewise
 the core via function is called.
 
 ARGUMENTS:
 via_set         A list of the via start/end layer numbers
 sx              The starting graphic x coordinate
 sy              The starting graphic y coordinate
 units           The current drawing database units
 classSubclass   the class subclass layer to which the graphics are drawn on
 in the form of "CLASS/SUBCLASS"
 max_layer       the number of conductor/plane layers.
 xsect_grp            dbid of the xsection group
 
 RETURNS:
 newXY       The graphics right most xy coordinate pair
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_DrawSingleVia ( via_set sx sy units classSubclass max_layer xsect_grp)
 prog( (x y)
 x=0.0
 y=0.0
 isTop = t
 first_lyr = car(car(via_set))
 second_lyr = cadr(car(via_set))
 if( (second_lyr - first_lyr ) > 1 then
 newXY = _XSECGEN_Draw_coreVia(  sx sy units classSubclass first_lyr second_lyr xsect_grp)
 else
 when( first_lyr > (max_layer/2) isTop = nil )
 newXY = _XSECGEN_Draw_uVia( sx sy units classSubclass first_lyr isTop xsect_grp)
 )
 return( newXY)
 ))
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_Draw_uVia
 
 SYNOPSIS:
 _XSECGEN_Draw_uVia(
 start_x  start_y units classSubclass start_lyr isTop xsect_grp
 )-> list(right_x : start_y)
 
 DESCRIPTION:
 This function draws the uvia figure into the cross section symbol. This
 figure represents a via passing from one layer to the next layer displaying
 the start and end layer of the drill.
 
 This graphic is currently drawn as a squared dog bone figure.
 
 _______           ___
 \     /          /   \
 \   /    or    /     \
 ---           ------
 
 ARGUMENTS:
 start_x       The starting x coordinate for the graphic location.
 start_y       The starting x coordinate for the graphic location.
 units         The current drawing user units
 classSubclass The drawing CLASS/SUBCLASS string to where the graohics are
 to be drawn
 start_lyr     The integer representation of the starting layer number
 end_lyr       The integer representation of the ending layer number
 isTop         t if uvia is on the top half of the xsection, nil if on the
 bottom half of the xsection
 xsect_grp     dbid of the xsection group
 RETURNS:
 right_x:start_y   The XY coordinate pair where of the right most side.
 ------------------------------------------------------------------------
 */
 
 defun(  _XSECGEN_Draw_uVia (sx sy units classSubclass first_lyr isTop xsect_grp)
 prog( ( xsec_table xOne xTwo xThree xFour yOne yTwo lyrHght path_array )
 ;; is this a uvia drill from top side or bottom side
 xsec_table = _XSECGEN_buildLayerData()
 xOne = sx ; X-plane 1
 xTwo = xOne + axlMKSConvert( .025 "inches" units); X-plane 2
 xThree = xOne + axlMKSConvert( .125 "inches" units); X-plane 3
 xFour = xOne + axlMKSConvert( .150 "inches" units);X-plane 4
 
 
 lyrHght = sy
 foreach( lyrDef xsec_table
 when( nth( 4 lyrDef) == first_lyr
 if( isTop then
 yOne = lyrHght ; Y-plane 1
 else
 yOne = lyrHght - _XSECGEN_getConductorHeight(units)
 )
 )
 when( nth( 4 lyrDef) == (first_lyr + 1)
 if( isTop then
 yTwo = lyrHght   ; Y-plane 2
 else
 yTwo = lyrHght - _XSECGEN_getConductorHeight(units); Y-plane 2
 )
 )
 case( nth(0 lyrDef)
 ( "D"  lyrHght = lyrHght - _XSECGEN_getDielectricHeight(units)) ; set Dielectric graphic layer thickness
 ( "C" lyrHght = lyrHght - _XSECGEN_getConductorHeight(units))
 ( "P" lyrHght = lyrHght - _XSECGEN_getConductorHeight(units))
 )
 )
 if( isTop then
 path_array = axlPathStart( list( xOne : yOne ) 0.0)
 axlPathLine( path_array 0.0 list(xFour yOne) )
 axlPathLine( path_array 0.0 list(xThree yTwo) )
 axlPathLine( path_array 0.0 list(xTwo yTwo) )
 axlPathLine( path_array 0.0 list(xOne yOne) )
 else
 path_array = axlPathStart( list( xTwo : yOne ) 0.0)
 axlPathLine( path_array 0.0 list(xThree yOne) )
 axlPathLine( path_array 0.0 list(xFour yTwo) )
 axlPathLine( path_array 0.0 list(xOne yTwo) )
 axlPathLine( path_array 0.0 list(xTwo yOne) )
 )
 axlDBAddGroupObjects( xsect_grp
 axlDBCreateShape( path_array
 _XSECGEN_getCrossHatch("SOLID" units)
 classSubclass
 nil nil)
 )
 return( list( xFour sy )); return the starting y and right most coordinates
 ))
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_Draw_coreVia
 
 SYNOPSIS:
 _XSECGEN_Draw_coreVia(
 start_x  start_y  units classSubclass start_lyr end_lyr xsect_grp
 )-> (right_x : start_y)
 
 DESCRIPTION:
 This function draws the core via figure into the cross section symbol. This
 figure represents a multi-layered via displaying the start and end layer
 based o the input arguments
 
 This graphic is currently drawn as a squared dog bone figure.
 
 _______
 |_     _|
 |   |
 |   |
 _|   |_
 |_______|
 
 ARGUMENTS:
 start_x       The starting x coordinate for the graphic location.
 start_y       The starting x coordinate for the graphic location.
 units         The current drawing user units
 classSubclass The drawing CLASS/SUBCLASS string to where the graohics are
 to be drawn
 start_lyr     The integer representation of the starting layer number
 end_lyr       The integer representation of the ending layer number
 xsect_grp     The x-sextion group dbid
 
 RETURNS:
 right_x:start_y   The XY coordinate pair where of the right most side.
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_Draw_coreVia (start_x start_y units classSubclass first_lyr second_lyr xsect_grp)
 prog( ( xsec_table xOne xTwo xThree xFour yOne yTwo yThree yFour lyrHght path_array)
 xsec_table = _XSECGEN_buildLayerData()
 
 xOne = start_x ; X-Plane 1
 xTwo = xOne + axlMKSConvert( .025 "inches" units) ; X-plane 2
 xThree = xOne + axlMKSConvert( .125 "inches" units);X-Plane 3
 xFour = xOne + axlMKSConvert( .150 "inches" units); X-plane 4
 
 lyrHght = start_y
 foreach( lyrDef xsec_table
 when( nth( 4 lyrDef) == first_lyr
 yOne = lyrHght ; Y-plane 1
 yTwo = lyrHght - _XSECGEN_getConductorHeight(units) ; Y-plane 2
 )
 when( nth( 4 lyrDef) == second_lyr
 yThree = lyrHght ; Y-plane 3
 yFour = lyrHght - _XSECGEN_getConductorHeight(units) ; Y-plane 4
 )
 case( nth(0 lyrDef)
 ( "D"  lyrHght = lyrHght - _XSECGEN_getDielectricHeight(units)) ; set Dielectric graphic layer thickness
 ( "C" lyrHght = lyrHght - _XSECGEN_getConductorHeight(units))
 ( "P" lyrHght = lyrHght - _XSECGEN_getConductorHeight(units))
 )
 )
 
 path_array = axlPathStart( list( xOne : yOne) 0.0)
 axlPathLine( path_array 0.0 list(xFour yOne))
 axlPathLine( path_array 0.0 list(xFour yTwo))
 axlPathLine( path_array 0.0 list(xThree yTwo))
 axlPathLine( path_array 0.0 list(xThree yThree))
 axlPathLine( path_array 0.0 list(xFour yThree))
 axlPathLine( path_array 0.0 list(xFour yFour))
 axlPathLine( path_array 0.0 list(xOne yFour))
 axlPathLine( path_array 0.0 list(xOne yThree))
 axlPathLine( path_array 0.0 list(xTwo yThree))
 axlPathLine( path_array 0.0 list(xTwo yTwo))
 axlPathLine( path_array 0.0 list(xOne yTwo))
 axlPathLine( path_array 0.0 list(xOne yOne))
 
 
 axlDBAddGroupObjects( xsect_grp axlDBCreateShape( path_array t classSubclass nil nil))
 
 return( list( xFour start_y ));;  return the starting y and right most coordinates
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_getConductorLayerCount
 
 SYNOPSIS:
 _XSECGEN_getConductorLayerCount(
 xsection_table
 )-> layer_count
 
 DESCRIPTION:
 This function reads the cross section table list and returns
 the total number of combined conductor and plane layers
 
 ARGUMENTS:
 xsection_table   The cross section list created by the
 _EBA_CXS_buildLayerData function .
 
 RETURNS:
 layer_count   The total number of combined conductor and plane layers.
 
 ------------------------------------------------------------------------
 */
 defun(  _XSECGEN_getConductorLayerCount ( xsection_table )
 prog( (layer_count)
 layer_count = 0
 foreach( i xsection_table
 when( nth( 4 i) > 0 &&  nth( 4 i) < 100  layer_count++)
 )
 return( layer_count )
 ))
 
 /*
 ------------------------------------------------------------------------
 NAME: _XSECGEN_grpCreate
 
 SYNOPSIS:
 _XSECGEN_grpCreate( )-> grp_dbid
 
 DESCRIPTION:
 This function check for the existance of a BBV-XSECTION group. If it does
 not exist, it will create the group. If the group already exists, any objects
 attched to the group are deleted, and the blank group dbid is returned.
 
 ARGUMENTS:
 xsection_table   The cross section list created by the
 _EBA_CXS_buildLayerData function .
 
 RETURNS:
 grp_dbid   returns the bbv x-section group dbid.
 
 ------------------------------------------------------------------------
 */
 defun( _XSECGEN_grpCreate ()
 prog( ( lst_grps grp_dbid )
 
 axlDBRefreshId(nil)
 lst_grps = axlDBGetDesign()->groups
 foreach( grp_id lst_grps
 when( upperCase( grp_id->name ) == "BBV-XSECTION"
 when( grp_id->groupMembers axlDeleteObject( grp_id->groupMembers))
 return( grp_id )
 )
 )
 return( axlDBCreateGroup( "BBV-XSECTION" "generic" nil) )
 ))
 
 
 
 | 
 |