Welcome to the CADSTARguys Blog - Information, hints, tips and my waffle on the CADSTAR Printed Circuit Board design suite.

Please note that all names used are completely fictitious and any thing written is my own personal opinion or knowledge and not related in any way to either my employers or their customers (or Zuken).
Also this is not a replacement for proper Maintenence/support and you should read the help files before asking anything techy:).

Friday, 14 August 2015

Routing with incremental track widths in P.R.Editor.




When routing within P.R.Editor we route using Necked, Optimal and Typed track widths.

How would you like a variable track width that allows you to increment/decrement the track width while routing between the min & max values of the route code?

A Python script has come to light that when placed in the Preditor Configurations\Macros\.init.py file allows you to increase/decrease the track width by a specific amount during routing to anywhere between the min/max width – on the fly.

Copy\Paste the following (between the lines) in your .init.py at the bottom of the file:

----------------------------------------------------------------------
incrementBy = {'m': 0.0001, 'cm': 0.001, 'mm': 0.1, 'um': 100, 'in': 0.005, 'ml': 5, 'th': 5, 'ds': 10000}

def calculateIncrementBy():
   currentUnit = getSetting("units.length")
   increment = incrementBy[currentUnit]
   return increment

# Function to increase routing width
def increaseRoutingWidth():
  increment = calculateIncrementBy()
  currentSetting = getSetting("tool.track_width_type")
  currentVal = getSetting("tool.user-defined_track_width")
#only change the value if we are already at the typed width
  if currentSetting=="user-defined":
      currentVal = currentVal + increment
  setSetting("tool.track_width_type", "user-defined")
  setSetting("tool.user-defined_track_width", currentVal)

# Function to decrease routing width
def decreaseRoutingWidth():
  increment = calculateIncrementBy()
  currentSetting = getSetting("tool.track_width_type")
  currentVal = getSetting("tool.user-defined_track_width")
#only change the value if we are already at the typed width
  if currentSetting=="user-defined":
      if currentVal>increment:
          currentVal = currentVal - increment
  setSetting("tool.track_width_type", "user-defined")
  setSetting("tool.user-defined_track_width", currentVal)


remap("setkey", "+", "increaseRoutingWidth()")
remap("setkey", "-", "decreaseRoutingWidth()")

----------------------------------------------------------------------


Your .init.py can be found at "C:\Program Files (x86)\Zuken\CADSTAR 16.0\PREditor Configurations\macros\.init.py" and can be edited using notepad.exe.


If you use the +/- keys for zooming in/out then the bottom 2 lines should be changed from +/- to your preferred keys.
Or perhaps Q\W for us Right handers and +/- for the lefties. (Or use one of those cheap USB numeric keyboard extensions to get these keys on the left, then you can define the other keys to run macro's).


Which would be:
remap("setkey", "w", "increaseRoutingWidth()")
remap("setkey", "W", "increaseRoutingWidth()")

remap("setkey", "q", "decreaseRoutingWidth()")
remap("setkey", "Q", "decreaseRoutingWidth()")

Not to forget further up the list where the original +\- key remaps are to comment those out.
#remap("setkey", "+", "zoomIn()")
#remap("setkey", "-", "zoomOut()")

Using this requires you to move the cursor when tracking to implement it and its changing the typed width so if you stop and start another track the typed width will be set at whatever value you just used.

Simply hit "n" or "o" to return to the necked or optimal routing width.
Back in the Design Editor- ensure that you have an ample range between min & max in your route code assignments - i.e. 3th to 200th.

Now I wish I had known about this years ago, it would have made my life easier.

0 comments:

Post a Comment