Skip to content

create_circular_pattern should be able to take as input an axis to revolve the pattern around #1951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
craig-connelly opened this issue Apr 30, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@craig-connelly
Copy link
Contributor

craig-connelly commented Apr 30, 2025

🔍 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

🐞 Description of the bug

When creating a circular pattern, we have to choose an edge of a body for the revolution of the pattern around. This is not always natural to do and sometimes leads to dummy bodies needing created just to get the revolution to work. Here's a simple pipe case below that if we could use the axis of the pipe cylinder for the circular pattern, would make things much easier than having to create a dummy body whose edge represents the center of the pipe.

Image

📝 Steps to reproduce

Run this code in pyansys-geometry. The very last command creates a circular pattern using it's axis from a dummy body created earlier. This is where it would be nice to call out the pipes axis for this circular pattern creation.

# Import libraries
import os
import numpy as np
import pyvista
from pyvista.plotting import system_supports_plotting
from ansys.geometry.core import *
from ansys.geometry.core.connection import *
from ansys.geometry.core.designer import *
from ansys.geometry.core.materials import *
from ansys.geometry.core.math import *
from ansys.geometry.core.misc import *
from ansys.geometry.core.misc.units import *
from ansys.geometry.core.parameters import *
from ansys.geometry.core.plotting import *
from ansys.geometry.core.shapes import *
from ansys.geometry.core.sketch import *
from ansys.geometry.core.tools import *

# Connect to Core Service backend
modeler = Modeler(host="127.0.0.1", port=50051, timeout=10)

# Create initial design and set default units to millimeters
design = modeler.create_design("Sample_Mixer_Tee")
component_mixer = design.add_component("Mixer Tee")
DEFAULT_UNITS.LENGTH = UNITS.mm

# model pipe segment
component_pipe1 = component_mixer.add_component("First Pipe")
origin = Point3D([0, -355.6, 0])
sketch = Sketch(Plane(origin, direction_y=[0, 0, 1],))
sketch.circle(Point2D([0, 0]), 76.2)
sketch.circle(Point2D([0, 0]), 85.725)
pipe1 = component_pipe1.extrude_sketch("Pipe1", sketch, -171.45)

# model pipe segment lip
origin = Point3D([0, -184.15, 0])
sketch = Sketch(Plane(origin, direction_y=[0, 0, 1]))
sketch.circle(Point2D([0, 0]), 85.725)
sketch.circle(Point2D([0, 0]), 127.0)
pipe1_edge = component_pipe1.extrude_sketch("pipe1_edge", sketch, 19.05)
pipe1.unite(pipe1_edge)

# create pipe bolt holes
# draw box whose one edge will represent the rotational axis
origin = Point3D([0, 0, 0])
sketch = Sketch(Plane(origin, direction_y=[0, 0, 1]))
sketch.box(Point2D([1, 1]), 2, 2)
box = design.extrude_sketch("axis", sketch, 100)
axis = box.edges[1]

# draw first bolt hole
origin = Point3D([0, -355.6, 0])
sketch = Sketch(Plane(origin, direction_y=[0, 0, 1],))
sketch.circle(Point2D([0, 107.95]), 12.7)

# imprint bolt hole onto pipe body
faces = pipe1.imprint_projected_curves(direction=-UNITVECTOR3D_Y, sketch=sketch, closest_face=True, only_one_curve=False)

# extrude bolt hole
hole_extrude = design.extrude_face("Pattern Cut", faces[0], Distance(406.4, UNITS.mm), ExtrusionDirection.NEGATIVE)

# cut bolt hole out of pipe lip
pipe1.subtract(hole_extrude)

# pattern the bolt holes radially to create six bolt holes on lip segment
pattern_pipe1_hole = pipe1.faces[-1]
# this is where it would be nice to specify the pipe axis instead of the dummy body edge
hole_pattern = modeler.geometry_commands.create_circular_pattern(pattern_pipe1_hole, axis, 6, np.pi * 2)

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

V251

🐍 Which Python version are you using?

3.12

📦 Installed packages

accessible-pygments==0.0.5
aiohappyeyeballs==2.6.1
aiohttp==3.11.18
aiosignal==1.3.2
alabaster==1.0.0
ansys-api-dbu==0.3.18
ansys-api-geometry==0.4.57
ansys-api-platform-instancemanagement==1.1.3
-e git+https://github.com/ansys/pyansys-geometry.git@14aecb609d4b24cce233129890378b28c215b9d0#egg=ansys_geometry_core
ansys-platform-instancemanagement==1.1.2
ansys-sphinx-theme==1.4.2
ansys-tools-path==0.7.1
ansys-tools-visualization-interface==0.9.1
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
astroid==3.3.9
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
beartype==0.20.2
beautifulsoup4==4.13.4
bleach==6.2.0
bokeh==3.6.3
certifi==2025.4.26
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
colorama==0.4.6
comm==0.2.2
contourpy==1.3.2
coverage==7.8.0
cycler==0.12.1
dataclasses-json==0.6.7
debugpy==1.8.14
decorator==5.2.1
defusedxml==0.7.1
Deprecated==1.2.18
distlib==0.3.9
docker==7.1.0
docutils==0.21.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
flexcache==0.3
flexparser==0.4
fonttools==4.57.0
fqdn==1.5.1
frozenlist==1.6.0
geomdl==5.3.1
grpcio==1.71.0
grpcio-health-checking==1.71.0
h11==0.16.0
httpcore==1.0.9
httpx==0.28.1
identify==2.6.10
idna==3.10
imagesize==1.4.1
importlib_metadata==8.7.0
iniconfig==2.1.0
ipycanvas==0.13.3
ipyevents==2.0.2
ipykernel==6.29.5
ipython==9.2.0
ipython-genutils==0.2.0
ipython_pygments_lexers==1.1.1
ipyvtklink==0.2.3
ipywidgets==7.8.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.12.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2025.4.1
jupyter==1.1.1
jupyter-console==6.6.3
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter-sphinx==0.5.3
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab==4.4.1
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==1.1.11
jupytext==1.16.7
kiwisolver==1.4.8
linkify-it-py==2.0.3
Markdown==3.8
markdown-it-py==3.0.0
MarkupSafe==3.0.2
marshmallow==3.26.1
matplotlib==3.10.1
matplotlib-inline==0.1.7
mdit-py-plugins==0.4.2
mdurl==0.1.2
mistune==3.1.3
more-itertools==10.7.0
msgpack==1.1.0
multidict==6.4.3
mypy_extensions==1.1.0
myst-parser==4.0.1
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nbsphinx==0.9.6
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.4.1
notebook_shim==0.2.4
numpy==2.2.5
numpydoc==1.8.0
overrides==7.7.0
packaging==25.0
pandas==2.2.3
pandocfilters==1.5.1
panel==1.6.1
param==2.2.0
parso==0.8.4
pdf2image==1.17.0
pillow==11.2.1
Pint==0.24.4
platformdirs==4.3.7
pluggy==1.5.0
pooch==1.8.2
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.51
propcache==0.3.1
protobuf==5.29.3
psutil==7.0.0
pure_eval==0.2.3
pycparser==2.22
pydata-sphinx-theme==0.16.1
pygltflib==1.16.4
Pygments==2.19.1
pyparsing==3.2.3
pytest==8.3.5
pytest-cov==6.1.1
pytest_pyvista==0.1.9
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
pyvista==0.45.0
pyviz_comms==3.0.4
pywin32==310
pywinpty==2.0.15
PyYAML==6.0.2
pyzmq==26.4.0
quarto-cli==1.6.42
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
roman-numerals-py==3.1.0
rpds-py==0.24.0
scipy==1.15.2
scooby==0.10.1
semver==3.0.4
Send2Trash==1.8.3
setuptools==80.1.0
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
snowballstemmer==2.2.0
soupsieve==2.7
Sphinx==8.2.3
sphinx-autoapi==3.6.0
sphinx-autodoc-typehints==3.1.0
sphinx-copybutton==0.5.2
sphinx-jinja==2.0.2
sphinx_design==0.6.1
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
tabulate==0.9.0
terminado==0.18.1
tinycss2==1.4.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
trame==3.9.0
trame-client==3.8.1
trame-common==0.2.0
trame-server==3.4.0
trame-vtk==2.8.15
trame-vuetify==3.0.1
types-python-dateutil==2.9.0.20241206
typing-inspect==0.9.0
typing_extensions==4.13.2
tzdata==2025.2
uc-micro-py==1.0.3
uri-template==1.3.0
urllib3==2.4.0
virtualenv==20.30.0
vtk==9.4.2
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
wheel==0.45.1
widgetsnbextension==3.6.10
wrapt==1.17.2
wslink==2.3.3
xyzservices==2025.4.0
yarl==1.20.0
zipp==3.21.0
@craig-connelly craig-connelly added the bug Something isn't working label Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant