1. Home
  2. Docs
  3. Użyteczność
  4. Jednostki

Jednostki

Skrypt obsługuje różne jednostki. Mogą być one nawet mieszane w tym samym skrypcie. Przykład pokazuje w jaki sposób.

 

# demonstrates using multiple units in a script

# create a part and a sketch
MyPart = Part('My Part')
XYPlane = MyPart.GetPlane('Płaszczyzna XY')
Sketch = MyPart.AddSketch('Sketch', XYPlane)

# set units to mm - this is implied at the start of every script
Units.Current = UnitTypes.Millimeters

# create circle 50mm in diameter
Sketch.AddCircle(0, 0, 50, False)

# set units to inches
# all values from now on are in inches
Units.Current = UnitTypes.Inches

# create a circle 1.34 inches in diameter
Sketch.AddCircle(0, 0, 1.34, False)

# switch to cm
# now all values from this point until the next units change are in cm
Units.Current = UnitTypes.Centimeters

# create a circle 4.2cm in diameter
Sketch.AddCircle(0, 0, 4.2, False)