Package: axisvm
PyAxisVM- The official python package forAxisVMLatest ReleaseLicenseOverviewThePyAxisVMproject offers a high-level interface toAxisVM, making its operations available directly from Python. It builds on top of Microsoft's COM technology and supports all the features of the originalAxisVMCOM type library, making you able tobuild, manipulate and analyseAxisVMmodelsfind better solutions with iterative methodscombine the power ofAxisVMwith third-party Python librariesbuild extension modulesOn top of that,PyAxisVMenhances the type library with Python's slicing mechanism, context management and more, that enables writing clean, concise, and readable code.InstallationThis is optional, but we suggest you to create a dedicated virtual enviroment at all times to avoid conflicts with your other projects. Create a folder, open a command shell in that folder and use the following command>>> python -m venv venv_nameOnce the enviroment is created, activate it via typing>>> .\venv_name\Scripts\activateTheAxisVMpython package can be installed (either in a virtual enviroment or globally) from PyPI usingpipon Python >= 3.7 <= 3.10:>>> pip install axisvmor chechkout with the following command over HTTPS viahttps://github.com/AxisVM/pyaxisvm.gitor by using the GitHub CLIgh repo clone AxisVM/pyaxisvmand install from source by typing>>> pip install .If you want to run the tests, you can install the package along with the necessary optional dependencies like this>>> pip install ".[test]"Development modeIf you are a developer and want to install the library in development mode, the suggested way is by using this command:>>> pip install "-e .[test, dev]"If you plan to touch the docs, you can install the requirements for that as well:>>> pip install "-e .[test, dev, docs]"Documentation and IssuesTheAxisVM API Reference Guideis available in pdf format,  you can download ithere.The documentation of this library is availablehere.Please feel free to post issues and other questions atPyAxisVMIssues. This is the best place to post questions and code related to issues with this project.DependenciesYou will need a local licenced copy ofAxisVMversion >= 13r2. To get a copy ofAxisVM, please visit ourhomepage.Getting StartedRegister the AxisVM Type LibraryIf this is not your first time usingAxisVMthrough a COM interface on your machine, you should already have a registered type library and you can skip this step. Otherwise, follow the instructions at the beginning of theAxisVM API Reference Guide.Launch AxisVMTheaxisvm.com.clientsubmodule implements various tools to handle the client side operations of creating a COM connection. Import the module and start a new application instance with thestart_AxisVMmethod:fromaxisvm.com.clientimportstart_AxisVMaxapp=start_AxisVM(visible=True)To test the connection, you can query the path of the executable being run by typingaxapp.FullExePath.Basic UsageIf the connection is complete, create a new model and get an interface to it:modelId=axapp.Models.New()axmodel=axapp.Models.Item[modelId]Every time you create a newAxisVMinstance with thestart_AxisVMcommand, an attempt is made to import the type library as a python module, or to generate one if necessary. The generated module is then accessible asaxisvm.com.tlb.The next block of commands adds a line to the scene:fromaxisvm.com.tlbimportlgtStraightLine,RLineGeomDatan1=axmodel.Nodes.Add(0,0,0)n2=axmodel.Nodes.Add(1,1,1)l1=axmodel.Lines.Add(n1,n2,lgtStraightLine,RLineGeomData())PutAxisVMon top and scale model to fill up the current view:axapp.BringToFront()axmodel.FitInView()At the end of your session, release the connection and close the application simply by typingaxapp.UnLoadCOMClients()axapp.Quit()Take a look at the jupyter notebooks in theexamplesfolder of this repository for more use cases.Tips and TricksPyAxisVMwraps up the COM type library, allowing users to exploit the elegant and concise syntax that Python provides, while still leaving everything on the table for legacy code. If for example, we wanted to calculate areas of surface elements, the out of box solution would be something likeareas=[]foriinrange(axmodel.Surfaces.Count):areas.append(axmodel.Surfaces.Item[i+1].Area)or using a list comprehensionareas=[axmodel.Surfaces.Item[i+1].Areaforiinrange(axmodel.Surfaces.Count)]WithPyAxisVM, evaluation of single item properties over collections is as easy asareas=[s.Areaforsinaxmodel.Surfaces]or simplyareas=axmodel.Surfaces[:].AreaClickhereto get a full overview about the pythonic usage of the library.LicensePyAxisVMis licensed under theMIT license.This module,PyAxisVMmakes no commercial claim over AxisVM whatsoever. This tool extends the functionality ofAxisVMby adding a Python interface to theAxisVMCOM service without changing the core behavior or license of the original software. The use ofPyAxisVMrequires a legally licensed local copy ofAxisVM.