-
Are there any plans to add REVCLOUD support? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
No. |
Beta Was this translation helpful? Give feedback.
-
FYI: REVCLOUD is not a special DXF element, just a strange LWPOLYLINE with lots of bulges |
Beta Was this translation helpful? Give feedback.
-
This script renders something similar, maybe I add the # Copyright (c) 2024, Manfred Moitzi
# License: MIT License
from typing import Sequence
from pathlib import Path
import math
import ezdxf
from ezdxf.math import UVec, Vec2
CWD = Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = Path(".")
def revcloud(
points: UVec,
segment_length: float,
bulge: float = 0.5,
start_width: float = 0.0,
end_width: float = 0.0,
) -> list[Sequence[float]]:
vertices = Vec2.list(points)
if not vertices[0].isclose(vertices[-1]):
vertices.append(vertices[0])
lw_points: list[Sequence[float]] = []
for s, e in zip(vertices, vertices[1:]):
lw_points.append((s.x, s.y, start_width, end_width, bulge))
diff = e - s
length = diff.magnitude
if length <= segment_length:
continue
count = math.ceil(length / segment_length)
_segment_length = length / count
offset = diff.normalize(_segment_length)
for _ in range(count):
s += offset
lw_points.append((s.x, s.y, start_width, end_width, bulge))
return lw_points
def main():
doc = ezdxf.new()
msp = doc.modelspace()
lw_points = revcloud(
[(0, 0), (1, 0), (1, 1), (0, 1)],
segment_length=0.1,
bulge=0.5,
start_width=0,
end_width=0.01,
)
msp.add_lwpolyline(lw_points)
doc.saveas(CWD / "revcloud.dxf")
if __name__ == "__main__":
main() |
Beta Was this translation helpful? Give feedback.
-
Example script to add a true REVCLOUD object: https://github.com/mozman/ezdxf/blob/master/examples/revcloud.py These conditions must be met to create a true REVCLOUD representation:
Whether the first vertex coincides with the last vertex or not is not important. EDIT: moved module to |
Beta Was this translation helpful? Give feedback.
Example script to add a true REVCLOUD object: https://github.com/mozman/ezdxf/blob/master/examples/revcloud.py
These conditions must be met to create a true REVCLOUD representation:
Whether the first vertex coincides with the last vertex or not is not important.
EDIT: moved module to
ezdxf.revcloud
as it can now do more than just render the requiredLWPOLYLINE
points.