Example #1
0
def initialise():
    """

    :return:
    """
    catia = CATIAApplication()
    documents = catia.documents()

    return catia, documents
Example #2
0
def test_new_from():
    catia = CATIAApplication()
    documents = catia.documents()
    document = documents.new_from(cat_part)

    assert document.name is not os.path.basename(cat_part)

    document.close()

    with pytest.raises(FileNotFoundError):
        documents.new_from('lala')
Example #3
0
def test_activate_document():
    catia = CATIAApplication()
    documents = catia.documents()
    documents.open(cat_part)
    document_part = catia.document()
    documents.open(cat_product)
    document_product = catia.document()

    assert document_part.name == os.path.basename(cat_part)
    assert document_product.name == os.path.basename(cat_product)

    document_part.activate()
    document = catia.document()

    assert document.name == os.path.basename(cat_part)

    document_part.close()
    document_product.close()
Example #4
0
    .. note::

        Please see :class:`HybridShapeFactory` and method add_new_point_coord()
        for caveats regarding large csv files.


    Formatting of csv data should be:
        <point_name>,<x coordinate>,<y coordinate>,<z coordinate>

"""

from pycatia import CATIAApplication
from pycatia import create_points

catia = CATIAApplication()
# disable display refreshing to try tp speed up point generation.
catia.refresh_display(False)
# hide catia window
catia.visible(False)

documents = catia.documents()
# create a new part.
documents.add('Part')

document = catia.document()
part = document.part()

# full path name to csv file.
file = r'tests\Sample_Point_CSV_File1_small.csv'
Example #5
0
def test_no_such_file():
    with pytest.raises(FileNotFoundError):
        catia = CATIAApplication()
        documents = catia.documents()
        documents.open('lala')
Example #6
0
"""

    Example 1:

    Access the CATIA COM object with a .CATPart open and get the center
    of gravity for the part body 'PartBody'.

"""

from pycatia import CATIAApplication
from pycatia import CATIAMeasurable
from pycatia import create_measurable
from pycatia import create_spa_workbench

catia = CATIAApplication()

documents = catia.documents()
documents.open(r'tests\CF_catia_measurable_part.CATPart')

document = catia.document()

part = document.part()

spa_workbench = create_spa_workbench(document.document)

bodies = part.get_bodies()
body_names = part.get_bodies_names()
# body_names = ['PartBody', 'EmptyPartBody']

# gets first body in bodies list.
Example #7
0
#! /usr/bin/python3.6

from pycatia import CATIAApplication

catia = CATIAApplication()
cat_part = r'tests/CF_catia_measurable_part.CATPart'


def test_application():
    assert 'CATIAApplication' in catia.__repr__()


def test_refresh():

    documents = catia.documents()
    documents.open(cat_part)
    document = catia.document()

    catia.refresh_display(state=False)
    assert catia.refresh_display() is False

    catia.refresh_display(state=True)
    assert catia.refresh_display() is True

    document.close()


def test_visible():

    documents = catia.documents()
    documents.open(cat_part)