加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

pycatia

alpha software

This is alpha software. All the test cases and examples work but there will be many issues outside of the test framework. The CATIA com interface is huge and I'm currently just attacking the items I think will be most useful. The framework is in place for others to contribute so if you know CATIA and python please do contribute. Bonus points for adding tests too.

I have limited access to CATIA licences / workbenches I so will not be able to support those I can't test. If your company would like support for additional workbenches adding to pycatia and can provide a license please contact me.

Why was it made?

pycatia was initially created to access the CATIA Automation Measurable object and it's methods without the need of visual basic / CATScripts.

Some of the methods can be accessed directly using the pywin32 module but there are a number that just simply won't work using python. There are several questions on stack overflow and the pywin32 mailing list regarding this. But, they fail to provide any working examples with the Measurable object in python.

pycatia accesses these methods by running VBA scripts using the Dispatch('CATIA.Application').SystemService.Evaluate() function and passing a public function to it. Otherwise, pycatia uses the VB method directly but exposes it within the same python class.

There is now further functionality available which can be seen by looking at the examples provided and reading the API at pycatia.readthedocs.io.

Requirements

  • python >= 3.6
  • CATIA V5 running on Windows.
  • see requirements.txt

Installation

see installation.

Usage

See the introduction and examples provided via the documentation link.

Links

Releases: pycatia @ pypi.org

Examples

See the documentation @ examples.

Asking Questions

Please read the following with regards to raising questions: https://github.com/evereux/pycatia/issues/28

Please do not email me directly requesting support unless this is business related and you would like professional support.

Contributing

If you would like to help contribute to pycatia you should start by looking at the contents of the file v5automation-autogenerated.7z contained within this repository.

This archive was created by scraping through the contents of the V5Automation.chm help file to re-construct all the classes and methods for python. It's largely complete but won't work out the box without some tweaking. But these files should be the basis for any pull requests. They will save you sometime and effort and ensure some consistency for the project.

If you have written a script using pycatia you would like to share you can:

Running The Tests

On the first run, during the running of the tests, the test suite will create the CATIA drawing, products and part it requires to run in the folder tests/cat_files.

CATIA V5 should already be running and have NO documents already open.

To run the tests with coverage (-v is verbosity):

py.test -v --cov-report term-missing --cov=pycatia

To run a specific test:

py.test -v tests/test_product.py::test_move

To stop tests running after first failure.

py.test -vx

Release process

A reminder for @evereux. I don't do this often and forget ...

  • Run the tests.
    • Fix any issues.
  • Run the examples.
    • Fix any issues.
  • Build the docs.
    • Fix any issues.
  • Check version is correct.
  • Run mypy over module. mypy pycatia
  • Build source. python setup.py sdist bdist_wheel
    • Check source contents.
  • Build pycatia exe python -m nuitka --standalone pycatia-exe.py. * use 64 env. * rename pycatia-exe.exe. * copy build to win_32 folder and zip.
  • Merge changes with master branch and upload.
  • Upload to pypi. twine upload dist/*.
  • Update github releases.
MIT License Copyright (c) 2018 Paul Bourne Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

pycatia 展开 收起
Python
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化