Coder Social home page Coder Social logo

kmolyuan / pyslvs-ui Goto Github PK

View Code? Open in Web Editor NEW
182.0 7.0 37.0 50.53 MB

An open source planar linkage mechanism simulation and mechanical synthesis system.

Home Page: https://pyslvs-ui.readthedocs.io

License: GNU Affero General Public License v3.0

Python 99.09% Shell 0.81% Batchfile 0.11%
pyslvs pyqt5 gui mechanical-engineering solvespace algorithm 2d python

pyslvs-ui's Introduction

PyPI Language grade: Python

Documentation Status sourceforge GitHub repo size in bytes Downloads

kernel kernel

pyslvs-icon Pyslvs-UI

A GUI-based (PyQt5) tool used to design 2D linkage mechanism.

  • Planar Linkages Simulation
  • Mechanical Synthesis
    • Number Synthesis: Combine the attributes of mechanism.
    • Structural Synthesis: Cython algorithm used to find out structural possibilities of the mechanism.
    • Dimensional Synthesis: Kernel from the three Cython algorithms (rewrite).
  • Websites
  • Others
    • Cross three platforms.
    • CAD-like user interface.
    • Auto layout of generalized chain.
    • The code is following with Python Enhancement Proposals (PEP):

If you have any question, please post on GitHub issue or contact [email protected].

Getting Started

Executables

Download portable executable file of your platform.

PyPI

pip install pyslvs-ui

Source

Branch master is in development, use stable branch to install stable dependencies directly.

git checkout stable
pip install -e .

There are more detailed instructions in the documentation.

Libraries

Pyslvs has a solver backend that can works without the GUI:

from pyslvs import example_list, parse_vpoints, t_config, expr_solving

# Get example with name
expr, inputs = example_list("Jansen's linkage (Single)")
# Parse the mechanism expression into a list of joint data
vpoints = parse_vpoints(expr)
# Config joint data and control data for the solver
exprs = t_config(vpoints, inputs)
# Solve the position
result = expr_solving(exprs, vpoints, {pair: 0. for pair in inputs})
# Get the result from joint 7
x, y = result[7]
print(x, y)  # -43.170055 -91.753226

Please see the documentation for more information.

Documentation

The documentation of Pyslvs and kernel API. Start it from sources:

pip install mkdocs
pip install -r doc-requirements.txt
mkdocs serve

Cite

Please see the reference.

pyslvs-ui's People

Contributors

kmolyuan avatar probonopd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyslvs-ui's Issues

Compilation error using MSYS2

Traceback (most recent call last):
  File "launch_pyslvs.py", line 12, in <module>
    main()
  File "Y:\tmp\Pyslvs-UI\pyslvs_ui\__init__.py", line 49, in main
    from .core.main_window import MainWindow
  File "Y:\tmp\Pyslvs-UI\pyslvs_ui\core\main_window\__init__.py", line 24, in <module>
    from .io import IOMethodInterface
  File "Y:\tmp\Pyslvs-UI\pyslvs_ui\core\main_window\io.py", line 57, in <module>
    from .actions import ActionMethodInterface
  File "Y:\tmp\Pyslvs-UI\pyslvs_ui\core\main_window\actions.py", line 21, in <module>
    from .storage import StorageMethodInterface
  File "Y:\tmp\Pyslvs-UI\pyslvs_ui\core\main_window\storage.py", line 27, in <module>
    from .solver import SolverMethodInterface
  File "Y:\tmp\Pyslvs-UI\pyslvs_ui\core\main_window\solver.py", line 24, in <module>
    from pyslvs import (
ImportError: cannot import name 'SolverSystem' from 'pyslvs' 

[DOC] The docs don't seem to display well in Safari, Firefox, and Chrome (haven't tried more yet)

When I open the documentation (https://pyslvs-ui.readthedocs.io/en/stable/python-solvespace-api/) I mostly see some huge search and code icons, it does show a menu but returns 404 errors as I navigate through it. I would love to dig in to this documentation though as I'm eager/curious to use the library for a course I am teaching on Algorithmic Folding (lecture = linkage folding)

so far I tested with Chrome, Firefox, and Safari, happy to test more if that helps

I love this project, thanks so much for putting this together!

[BUG] release v20.08.0 Mac OS 10.15.1 版本启动闪退

Describe the bug
A clear and concise description of what the bug is.
v20.08.0 Mac Release 版本 在 Mac OS 10.15.1 上启动后会直接崩溃退出,没有任何提示.

PS. 如果哪位恰巧看到这条信息,并想在北京找一份机械设计师的工作请跟看看我们公司,想必喜欢这个软件的人都是能力极强的.
http://www.autolabor.com.cn/join

To Reproduce
Steps to reproduce the behavior:

  1. 解压下载的安装包
  2. 点击启动程序
  3. 程序直接退出

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Mac OS
  • Version: 10.15.1

Additional context
Add any other context about the problem here.

[ENH] Extract calculation functions from GUI

Hi! First of all I would like to say that this system is amazing, it works great!

I would like to use this in my thesis with Reinforcement learning in which I am creating mechanism (1-DOF, derived from a fourbar linkage) from python and I need to get the trajectories of those mechanism as fast as possible (3trajectories /second). Is there any way of defining the mechanism in a script and get the trajectories there without using the GUI interface ?

This is how I define the linkages in python currently
image

Thanks in advance for your help!

[ENH] Plotting time histories of positions, velocities and accelerations

Hi,

this software is really great, thank you for sharing it. I just want to suggest an improvement to make it even better. Would it be possible to add an option to plot time histories of positions, velocities and accelerations for selected points ? It seems that currently these variables can be plotted only with respect to position. Such a feature would be very useful in my opinion.

Can't Maximize program window

When try Maximize (Ctrl+Alt+5) program window size of it just freezed.

The only way to change window is manually drag each windowborder or use "Filex -> Full screen (Shift+F1)"

Pyslvs: v0.9.0(beta3)
OS: Linux Mint 18 Xfce (64bit)

[BUG] Slider Lifter example gives an error

Loading the example slider lifter gives the following error

Pyslvs 19.10.0.post0
OS Type: Linux 4.19.0-6-cloud-amd64 [x86_64]
Python Version: 3.7.3(final)
Python Compiler: GCC 7.3.0
Qt wrapper: PyQt5 5.13.2
Qt Version: 5.13.2

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-jovyan'
Connect to GUI console.
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/site-packages/pyslvs_ui/widgets/canvas_base.py", line 501, in paintEvent
self.__draw_path()
File "/opt/conda/lib/python3.7/site-packages/pyslvs_ui/widgets/canvas_base.py", line 319, in __draw_path
elif self.vpoints[i].color is None:
IndexError: list index out of range
Aborted

[BUG] can not delete point

  1. Start pyslvs-19.09.0.post0.mscv1916-amd64.exe.
  2. Bring up Arm example.
  3. Try to delete Point 8 and system stop working.

arm_example_crash_while_delete_point_8

[BUG] DXF/Solvespace Export

Describe the bug
I am unable to get DXF export to work (nor Solvespace export either).
I normaly run on Linux, but have also tested on Windows 10 and the symptoms appear to be the same.
On Linux Pyslvs-UI was installed via pip in a virtual-env (version 22.7.0), and on windows the "pyslvs-22.07.0.mscv1929-amd64.exe" was executed.

To Reproduce
Steps to reproduce the behavior:

  1. Run Pyslvs-UI
  2. Open 'File->Example->Arm'
  3. Go to 'Proyect' Tab.
  4. Click export DXF
  5. Leave default options:
    • Export to folder with project name.
    • DXF vversion: AC1032 - R2018
    • Assembly
    • ... etc.
  6. Click SAVE.
  7. Pyslvs crashes.

Expected behavior
DXF (and Solvespace) Export to work, and not crash.

Desktop (please complete the following information):

  • OS: [Arch Linux (6.5.8), Windows 10]
  • Pyslvs Version: [22.7.0]

Additional context
Starting pyslvs with debug-mode (via pyslvs -d) gave no further info:
Aborted (core dumped).

P.S
Thank you for taking the time for sharing this great software.
I'm still learning it, but very happy it exists in the midst of the other not as open alternatives.

Avoid signals caused crash.

Some times GUI load function will crash when the slot function that was trigger by widget signal is not ending well.

The sender must be add a signal from QEventLoop object to avoid error happen.

Or be sure not to send so lot of signal that is connecting to interdependent functions. Try to calling the slot function directly.

[BUG] Pyslvs crashed on import SLVS saved with nightly SolveSpace 3.0

Describe the bug

Pyslvs crashed on import SLVS saved with nightly SolveSpace 3.0

To Reproduce

Steps to reproduce the behavior:

  1. Create SLVS file using nightly build of SolveSpace 3.0;
  2. Launch Pyslvs
  3. Go to "File > Load File"
  4. Select "Solvespace module"; (NOTE: Typo mistake - should be named as "SolveSpace 2.0")
  5. Select SLVS file created using nightly build of SolveSpace 3.0;
  6. Push "Open" button;
  7. Pyslvs silently crashed immediately.

Terminal Log

$ ./pyslvs-19.09.0.post0.glibc2.3.3-x86_64.AppImage
Pyslvs 19.09.0.post0
OS Type: Linux 4.15.0-1-amd64 [x86_64]
Python Version: 3.8.0(beta)
Python Compiler: GCC 5.4.0 20160609
Qt wrapper: PyQt5 5.13.1
Qt Version: 5.13.0
-------

Startup with: 7.31s
Connect to GUI console.
Traceback (most recent call last):
  File "/var/tmp/.mount_pyslvswdOJEE/usr/bin/pyslvs_ui/core/main_window/io.py", line 319, in __load_file
    self.__read_slvs(file_name)
  File "/var/tmp/.mount_pyslvswdOJEE/usr/bin/pyslvs_ui/core/main_window/io.py", line 108, in __read_slvs
    self.parse_expression(parser.parse(group.split('@')[0]))
  File "/var/tmp/.mount_pyslvswdOJEE/usr/bin/pyslvs_ui/core/io/slvs/read.py", line 111, in parse
    entity['Entity.actPoint.x'],
KeyError: 'Entity.actPoint.x'
Aborted

Expected behavior

Pyslvs should load SolveSpace 3.0 file format.

Possibly, need create separate import options for "SolveSpace 2.0 module" and "SolveSpace 3.0 module"

Desktop

  • OS: Linux (Debian 9.x, x86_64)
  • Version: 19.09.0

Additional context

Sample SLVS - https://gist.github.com/Symbian9/cdc817e7f33f3eabd66ea04e032b3342

Nightly builds of SolveSpace 3.0:

Can't run v0.9.0

Pyslvs-PyQt5 version: 0.9.0
OS: MX Linux MX-17 (Debian 9 "Stretch"), x86_64 (64-bit)

$ ./pyslvs-0.9.0.glibc2.17-x86_64.AppImage
zenity, kdialog, Xdialog missing. Skipping /var/tmp/.mount_bbVPnT/usr/bin//pyslvs.wrapper.
Traceback (most recent call last):
  File "/var/tmp/.mount_bbVPnT/usr/bin/pyslvs", line 6, in <module>
    from core.info.info import INFO, args
  File "/var/tmp/.mount_bbVPnT/usr/bin/core/info/info.py", line 21, in <module>
    import platform
  File "/usr/lib/python3.5/platform.py", line 117, in <module>
    import sys, os, re, subprocess
  File "/usr/lib/python3.5/subprocess.py", line 50, in <module>
    import signal
  File "/usr/lib/python3.5/signal.py", line 3, in <module>
    from functools import wraps as _wraps
  File "/var/tmp/.mount_bbVPnT/usr/lib/python3.5/functools.py", line 23, in <module>
    from weakref import WeakKeyDictionary
  File "/var/tmp/.mount_bbVPnT/usr/lib/python3.5/weakref.py", line 12, in <module>
    from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
$ 

[BUG]

Not sure if this is the correct place to report this, but

pip install python-solvespace

does not install on Ubuntu22.04

In file included from python_solvespace/src/constraint.cpp:7:
      python_solvespace/src/solvespace.h:39:10: fatal error: Eigen/SparseCore: No such file or directory
         39 | #include <Eigen/SparseCore>
            |          ^~~~~~~~~~~~~~~~~~
      compilation terminated.

Linkage operational functions

Let the linkage has more interactions on main canvas just like points.

  • Merge function to move points to another linkage, then delete the original linkage.
  • Select function.
    • Switch selection mode by entities tab widget.
    • Save selected item for each table.
  • Free move function for adjust dimension of linkages.

[AppImage] v18.2.0.glibc2.17 does not work on Debian Stretch 9.3

I downloaded the most recent release, pyslvs-18.2.0.glibc2.17-x86_64.AppImage. It does not work on Debian Stretch 9.3.

$> ./pyslvs-18.2.0.glibc2.17-x86_64.AppImage 

Traceback (most recent call last):
  File "/tmp/.mount_J3kT0G/usr/bin/pyslvs", line 6, in <module>
    from core import *
  File "/tmp/.mount_J3kT0G/usr/bin/core/__init__.py", line 10, in <module>
    from .info import *
  File "/tmp/.mount_J3kT0G/usr/bin/core/info/__init__.py", line 9, in <module>
    from .info import (
  File "/tmp/.mount_J3kT0G/usr/bin/core/info/info.py", line 23, in <module>
    import requests
  File "/tmp/.mount_J3kT0G/usr/lib/python3.5/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/tmp/.mount_J3kT0G/usr/lib/python3.5/site-packages/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/tmp/.mount_J3kT0G/usr/lib/python3.5/site-packages/urllib3/connectionpool.py", line 11, in <module>
    from .exceptions import (
  File "/tmp/.mount_J3kT0G/usr/lib/python3.5/site-packages/urllib3/exceptions.py", line 2, in <module>
    from .packages.six.moves.http_client import (
  File "/tmp/.mount_J3kT0G/usr/lib/python3.5/site-packages/urllib3/packages/__init__.py", line 3, in <module>
    from . import ssl_match_hostname
  File "/tmp/.mount_J3kT0G/usr/lib/python3.5/site-packages/urllib3/packages/ssl_match_hostname/__init__.py", line 9, in <module>
    from ssl import CertificateError, match_hostname
  File "/usr/lib/python3.5/ssl.py", line 135, in <module>
    PROTOCOL_SSLv23 = _SSLMethod.PROTOCOL_SSLv23 = _SSLMethod.PROTOCOL_TLS
  File "/usr/lib/python3.5/enum.py", line 274, in __getattr__
    raise AttributeError(name) from None
AttributeError: PROTOCOL_TLS

Maybe you want to reach out to the IRC channel #AppImage on Freenode. There you'll find AppImage developers who are willing to help fix any problems you may have with packaging and testing your AppImage.

Compilation error on Mac OSX - symbol(s) not found

Hi,

I would like to try your software but I get the following error during compilation (make build-kernel):

[...]
 slvs_wrap.o
      SWIG_Py_Void() in slvs_wrap.o
      SWIG_Python_NewShadowInstance(SwigPyClientData*, _object*) in slvs_wrap.o
      SWIG_Python_AppendOutput(_object*, _object*) in slvs_wrap.o
  "__Py_NotImplementedStruct", referenced from:
      SwigPyObject_richcompare(SwigPyObject*, SwigPyObject*, int) in slvs_wrap.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [_slvs.so] Error 1
make: *** [build-solvespace] Error 2

I tried few workaround with no success. Any idea ?

发现一个bug,pr滑块在y方向会来回跳动

Generate by Pyslvs 22.04.0

Project "Untitled"

M[
J[R, color[Blue], P[20, 90], L[ground, link_3]],
J[R, color[Blue], P[-0, -0], L[ground, link_1]],
J[R, color[Green], P[-20.35, 0], L[link_1, link_2]],
J[R, color[Green], P[49.2829, 32.8673], L[link_2, link_3]],
J[R, color[Green], P[-47.3601, -75.3024], L[link_2, link_4]],
J[RP, A[90.0], color[Blue], P[0, -145.8858], L[ground, link_4]]
]
模型见上放,滑块在运行时会上下跳动

[BUG]

Describe the bug
I cannot load the mechanism on the canvas after synthesis. I tried the appimage and from source.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Synthesis
  2. Click on Optimizer
  3. From the Structure tab, click on 'Load profile from triangular iteration database'
  4. I load a four bar linkage mechanism
  5. Create a target path and launch the synthesis. Wait for the results to be shown in the upper section.
  6. Click on the results to select, usually : Differential evolution. Double click to validate, everything seems ok.
  7. Click on the button to merge the results into canvas. Nothing happens.

Expected behavior
I expect the synthesized mechanism to be shown on the canvas.

Screenshots
Here is a little video.

Desktop (please complete the following information):
Pyslvs 22.07.0
OS Type: Linux 6.5.0-35-generic [x86_64]
Python Version: 3.10.12 (final)
Python Compiler: GCC 11.4.0
Qt: PyQt5 5.15.7

Additional context
I would like to get the detail of the synthesized mechanism, overall dimensions. That is all.

"bata" (typo mistake in versioning)

Version 0.9 bata 1

This typo mistake should be fixed to "Version 0.9 beta 1". But I also recommend write it as "Pyslvs-PyQt5 0.9-beta.1", and as tag use v0.9-beta.1

Also recommend you read the guide "Semantic Versioning"

"Semantic Versioning" now is most popular versioning sheme for user software.

REFERENCE

[ENH] Simplify project management

Instead of setup.py and requirements.txt, use pyproject.toml to build all the things.

Build the wheel to dist:

pip wheel . --no-deps -w dist

[BUG] Slider-crank mechanism doesn't work with aligned points

Hi,

I think that I've encountered a bug. I followed this tutorial: https://www.youtube.com/watch?v=cB5wYyc0J0c

and modeled a simple slider-crank mechanism:

slider crank

The problem is that it doesn't work properly - you can see that the curves showing paths of points belonging to the mechanism are very short and motion of this linkage can't be simulated. However, it happens only when point 0 and point 2 have the same Y coordinate. When I move one of them slightly above or below the other, it starts working:

slider crank 2

I also attached the .pyslvs file packed to zip below. Would it be possible to fix this bug ?

Crank slider problem.zip

Trojan problem

Pyslvs needs avoid Trojan detected of its executable file.

Switchable CAD kernel

Solvespace seems to getting trouble when simulating multiple input joints.

Since "tinycadlib" (triangular formulas) can works well with auto paths preview function, maybe Pyslvs can switch to it and that will be convenience to develop.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.