示例#1
0
 def Set_SDir_Mirror(self) :
     view_point_3D = catia().active_window.active_viewer.create_viewer_3d().viewpoint_3d
     sdir=[0,0,0]
     sdir[0] = float(self.View_Ctrl_Line_Edit_S_x.text())
     sdir[1] = - float(self.View_Ctrl_Line_Edit_S_y.text())
     sdir[2] = float(self.View_Ctrl_Line_Edit_S_z.text())
     view_point_3D.put_sight_direction(sdir)
示例#2
0
 def Set_UpDir_Mirror(self) :
     view_point_3D = catia().active_window.active_viewer.create_viewer_3d().viewpoint_3d
     updir=[0,0,0]
     updir[0] = float(self.View_Ctrl_Line_Edit_U_x.text())
     updir[1] = - float(self.View_Ctrl_Line_Edit_U_y.text())
     updir[2] = float(self.View_Ctrl_Line_Edit_U_z.text())
     view_point_3D.put_up_direction(updir)
示例#3
0
 def Set_Origin_Mirror(self) :
     view_point_3D = catia().active_window.active_viewer.create_viewer_3d().viewpoint_3d
     origin=[0,0,0]
     origin[0] = float(self.View_Ctrl_Line_Edit_O_x.text())
     origin[1] = - float(self.View_Ctrl_Line_Edit_O_y.text())
     origin[2] = float(self.View_Ctrl_Line_Edit_O_z.text())
     view_point_3D.put_origin(origin)
示例#4
0
def test_new_from():
    caa = catia()
    documents = caa.documents
    document = documents.new_from(cat_part_measurable)

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

    document.close()

    with pytest.raises(FileNotFoundError):
        documents.new_from('lala')
示例#5
0
def test_visible():
    caa = catia()
    documents = caa.documents
    documents.open(cat_part_measurable)
    document = caa.active_document

    caa.visible = False
    assert caa.visible is False

    caa.visible = True
    assert caa.visible is True

    document.close()
示例#6
0
def test_refresh():
    caa = catia()
    documents = caa.documents
    documents.open(cat_part_measurable)
    document = caa.active_document

    caa.refresh_display = False
    assert caa.refresh_display is False

    caa.refresh_display = True
    assert caa.refresh_display is True

    document.close()
示例#7
0
def test_activate_document():
    caa = catia()
    documents = caa.documents
    documents.open(cat_part_measurable)
    document_part = caa.active_document
    documents.open(cat_product)
    document_product = caa.active_document

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

    document_part.activate()
    document = caa.active_document

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

    document_part.close()
    document_product.close()
    def __init__(self):
        self.catia = None
        self.catia_process = False
        self.catia_process_list = ["cnext", "catia"]
        self.active_doc = None
        self.active_file = None
        self.count_item = 0
        self.parts = []
        self.products = []
        self.children = {}

        if not self.catia_process:
            self.set_catia_process()

        if self.catia_process:
            self.catia = catia()

        if self.catia and self.catia.documents.count_types(["catpart", "catproduct"]) > 0:
            self.set_active_document()
            self.set_active_file()
示例#9
0
#! /usr/bin/python3.6
"""

    Example 14:

    Logging.

"""
from pycatia import catia

caa = catia()

caa.logger.info('Hello world!')
caa.logger.warning('Stay alert, stay safe, bee kind!')

# [2020-06-13 11:12:09,096] INFO in example_14: Hello world!
# [2020-06-13 11:12:09,096] WARNING in example_14: Stay alert, stay safe, bee kind!
示例#10
0
def test_application():
    caa = catia()
    assert 'Application(name="CNEXT")' in caa.__repr__()
示例#11
0
def test_no_such_file():
    with pytest.raises(FileNotFoundError):
        caa = catia()
        documents = caa.documents
        documents.open('lala')
示例#12
0
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout, QVBoxLayout, QLabel, QCheckBox, QSizePolicy, QGridLayout, QGroupBox, QLineEdit, QTextBrowser
import win32com.client
from PyQt5.QtCore import QCoreApplication, Qt
from PyQt5.QtGui import QPalette, QColor

#pycatia!!!
from pycatia import catia

# Catia 연결
CATIA = win32com.client.Dispatch('CATIA.application')
# pycatia 버전 카티아 연결
pycatia = catia()


def detact_CATIA():
    try:
        t = CATIA.ActiveDocument.Name
        return True
    except:
        return False


class MyApp(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        #닫기 버튼
        btn_close_main = QPushButton('Close')  #QPushButton 클래스 생성
示例#13
0
 def Get_SDir(self) :
     view_point_3D = catia().active_window.active_viewer.create_viewer_3d().viewpoint_3d
     sdir = view_point_3D.get_sight_direction()
     self.View_Ctrl_Line_Edit_S_x.setText(str(sdir[0]))
     self.View_Ctrl_Line_Edit_S_y.setText(str(sdir[1]))
     self.View_Ctrl_Line_Edit_S_z.setText(str(sdir[2]))
示例#14
0
 def Get_UpDir(self) :
     view_point_3D = catia().active_window.active_viewer.create_viewer_3d().viewpoint_3d
     updir = view_point_3D.get_up_direction()
     self.View_Ctrl_Line_Edit_U_x.setText(str(updir[0]))
     self.View_Ctrl_Line_Edit_U_y.setText(str(updir[1]))
     self.View_Ctrl_Line_Edit_U_z.setText(str(updir[2]))
示例#15
0
 def Get_Origin(self) :
     view_point_3D = catia().active_window.active_viewer.create_viewer_3d().viewpoint_3d
     origin = view_point_3D.get_origin()
     self.View_Ctrl_Line_Edit_O_x.setText(str(origin[0]))
     self.View_Ctrl_Line_Edit_O_y.setText(str(origin[1]))
     self.View_Ctrl_Line_Edit_O_z.setText(str(origin[2]))