Skip to content. | Skip to navigation

Personal tools

convertToHimetrics – PDK Tool

The tool convertToHimetrics.py is a python script which is very useful for calculating the himetric measurements inside the partdescription.xml file.

Usage

Simply go to the folder where the script is located and run the convertToHimetric.py script in your command line from there.
In the following code FrizingPDK/Tools is our sample directory we change directory (cd command) to; in your case change directory to wherever you downloaded the PDK to.

    % cd FrizingPDK/Tools
% python convertToHimetrics.py KIND PIXELS

KIND and PIXELS are the arguments of this script:
KIND defines what kind of conversion you want calculated (bounds, offset or leg)
PIXELS is the x by y measurement, written n x n where n is a number in pixels

Simple Example

We measure 100 x 40 pixels in our drawing application

    % python convertToHimetrics.py bounds 100 x 40

converts it to himetric and returns a bounds tag which you can just copy into the partdescription.xml file.


Full Reference

The convertToHimetric.py is a simple script to convert pixel measurements into highmetric. For use in the Fritzing partdescription.xml files. It takes a pixel vector e.g. 5x12 and converts this into a <tag> which can be placed in your partdescription.xml file directly.

Usage:

	python convertToHimetrics.py KIND PIXELS

Arguments:

KIND
the kind of conversion which is performed and the kind of tag which is returned. Possible kinds are:
bounds
creates <bounds> tag.
Use 100% view pixels as measurement
offset
creates <gridOffset> tag.
Use 400% view pixels as measurement
leg
creates <point> tag which can be used as a child of <connector>.
Use 400% view pixels as measurement
hibounds
creates <bounds> tag.
Use 400% view pixels as measurement
pixeloffset
creates <gridOffset> tag.
Use 100% view pixels as measurement
pixelleg
creates <point> tag which can be used as a child of <connector>.
Use 100% view pixels as measurement
hioffset
equal to 'offset'
hileg
equal to 'leg'
PIXELS
the size or offset measured in pixels.
The pattern for this must follow: 'n x n', where
n
is the number in pixels.
It should be an integer, but can also be negative (e.g. -40)

Example:

You want to create a <gridOffset> tag. In the 400% view of your drawing application you are measuring a 50 x 349 square between the top-left corner of your 400% part and the grid point that should be the grid origin (where x="0" and y="0"). Then use the following command:

	python convertToHimetrics.py offset 50 x 349

it returns

	<gridOffset x="318" y="2216" units="himetric"/>

which you can paste into your partdescription.xml file.

Document Actions
© 2007- 2008 University of Applied Sciences Potsdam \ Powered by Plone