User Tools

Site Tools


snapping_in_pcb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
snapping_in_pcb [2018/06/03 19:06]
cparker [Details]
snapping_in_pcb [2018/06/10 10:52] (current)
cparker
Line 88: Line 88:
   * tests   * tests
  
-===Adding Snaps===+====Adding Snaps====
  
 TODO: TEST THIS! TODO: TEST THIS!
Line 94: Line 94:
 Under this configuration,​ it is fairly easy to add snaps or change the snapping behavior using plugins. Let's examine how that could work with an example. Let's change how the element snapping works. Presently, it snaps to the location of the element mark. Let's snap to the center of the bounding box instead. Under this configuration,​ it is fairly easy to add snaps or change the snapping behavior using plugins. Let's examine how that could work with an example. Let's change how the element snapping works. Presently, it snaps to the location of the element mark. Let's snap to the center of the bounding box instead.
  
-First, get the plugin template from [pcb_developer_introduction_2]. In a real plugin, you would probably want to write some actions to enable and disable your features, but, for the sake of this example, we'll skip that. So, delete that stuff. Then, let's grab the existing code for snapping to elements out of crosshair.c,​ and copy it into the plugin file. There are two parts, the snapping function, and the ''​SnapSpecType''​ definition. Here they are (more or less). The snapping function should be fairly easy to read:+First, get the plugin template from [[geda:pcb_developer_introduction_2]]. In a real plugin, you would probably want to write some actions to enable and disable your features, but, for the sake of this example, we'll skip that. So, delete that stuff. Then, let's grab the existing code for snapping to elements out of crosshair.c,​ and copy it into the plugin file. There are two parts, the snapping function, and the ''​SnapSpecType''​ definition. Here they are (more or less). The snapping function should be fairly easy to read:
  
 <code C> <code C>
snapping_in_pcb.txt ยท Last modified: 2018/06/10 10:52 by cparker