Skip to main content

Cadwork Math Utilities

Project description

Logo

Cadwork Math Utilities

PyPI PyPI - Python Version RTD Issues Pulls GitHub

This is the Cadwork Math Utilities library in Python.

Installation

Install with pip:

  pip install cwmath

Contributing

Contributions are always welcome! Before contributing, please check contributing agreement.

Roadmap

  • Guides
  • Examples
  • API Documentation

Authors

License

MIT

Style Guide

Please follow the style guide below when adding functions. Guidelines

# imports:
import math
import sys
from myclass import MyClass

# example function
def add_one(number:int) -> int:
    """Increase number by one.
    Function written by John Doe.

    Args:
        number (int): a number

    Returns:
        int: number increased by one
    """
    return number + 1


# Aligned with opening delimiter.
foo = long_function_name(var_one, var_two,
                         var_three, var_four)

if foo == 'blah':
    do_blah_thing()
do_one()
do_two()
do_three()

Examples

import cadwork
import element_controller as ec
import geometry_controller as gc

import sys

sys.path.append("...\\...\cwmath\\src")

from cwmath import cwplane3d
from cwmath import cwvector3d

element_ids = ec.get_active_identifiable_element_ids()
if len(element_ids) > 0:
    point1 = gc.get_p1(*element_ids)
    point2 = gc.get_p2(*element_ids)
    yl = gc.get_yl(*element_ids)
    plane = cwplane3d.CwPlane3d(point1,yl)
    print(point1)
    print(yl)
    print(plane)

    distance = plane.distance_to_point(cadwork.point_3d(0.,0.,0.))
    print(distance)

    vector1 = cwvector3d.CwVector3d.from_point_3d(point1)
    vector2 = cwvector3d.CwVector3d.from_point_3d(point2)
    norm =(vector2 - vector1).normalize()
    print(norm)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cwmath-0.0.7.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

cwmath-0.0.7-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file cwmath-0.0.7.tar.gz.

File metadata

  • Download URL: cwmath-0.0.7.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cwmath-0.0.7.tar.gz
Algorithm Hash digest
SHA256 2dbe9be24815e5f514d370fa024a72e784a09d5d7a7ee05ca8348b9f9f6ef6ee
MD5 04c16ff9780e5651f159feca4637bc14
BLAKE2b-256 d8dc71e2256abf53fe586ed6e0addb3fc70f35b8f25e73f5d1c43d5daa48f51b

See more details on using hashes here.

File details

Details for the file cwmath-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: cwmath-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cwmath-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5dc01a979c87dd68c4c3864d551e82ad312dc9c52a5c9ef0e12de29ba80ceb13
MD5 7b3d52f9778032b8e7708bcf1c4dcc0a
BLAKE2b-256 a6134da0378891d9f2a140bf8c8e98fd900c14542d6d3d8af4123ccc9abb5687

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page