Author Topic: Extracting global and local labels from a schematic?  (Read 3729 times)

0 Members and 1 Guest are viewing this topic.

Offline phil from seattleTopic starter

  • Super Contributor
  • ***
  • Posts: 1029
  • Country: us
Extracting global and local labels from a schematic?
« on: June 06, 2021, 06:04:48 am »
I need to extract global and local labels from a schematic. The end goal is some sort of script to produce a printable file with all of the labels.

I've looked at a number of ways to do it. Running a script on the .sch file directly is a real pita.  I can get pretty close with Orcad and cadstar netlists. Is there a better way?  This needs to work against 5.1.x for now.  Once 6.0 is released, I'll move up to that.

For those that are curious, I am using Kicad to do electrical cabinet design for CNC machines and want to print out a list of wire labels to be attached to both ends of all the interconnect wires. I know there are specific tools for electrical panels but want to use kicad as it dovetails with my other processes. 
« Last Edit: June 06, 2021, 02:21:38 pm by phil from seattle »
 

Offline phil from seattleTopic starter

  • Super Contributor
  • ***
  • Posts: 1029
  • Country: us
Re: Extracting global and local labels from a schematic?
« Reply #1 on: June 06, 2021, 07:09:34 pm »
For what it's worth, an awk script to create a CSV with the labels.

#
#  AWK script to filter out a list of labels (global and local) from a
#  CADStar net list exported from KiCad.
#
#   Produces a CSV file with 2 columns of the labels.
#   Strips out CR from the end of the netlist lines
#   and puts it back at the end of the output line.
#   Should work with any awk flavor but not tested.
#

BEGIN {print "Label,Label"}
{
if(match($1,".ADD_TER")) {
   sub("/.*/", "",$4)
   sub("\015", "", $4)
   print $4 "," $4 "\015"
   }
}
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf