CadQuery / CadQuery/cadquery

PositionAt/LocationAt returning wrong coordinates for edges of imported Dxf/Step curves

Open
#686 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

The case below tries to get the center point of the selected edge (in green), yet the returned position seems to be in some random place outside the edge/curve (orange dot).

I'd expect `locationAt`/`positionAt` to also function for imported curves/geometry.

When using `wires()` instead of `edges(..)`, the position returned by `positionAt`/`locationAt` is actually on the curve again - but that is a different use case.

I've added `start_point`/`end_point` just to test whether at least that data is available (yellow dots).

Curve used in the example case: [issue.zip](https://github.com/CadQuery/cadquery/files/6131882/issue.zip)

```python
curve = cq.importers.importDXF("issue.dxf").edges(">Y")
show_object(curve, options={"color":(100, 255, 0)})

t = curve.val().positionAt(0.5)
point = cq.Vertex.makeVertex(t.x, t.y, t.z)
show_object(point, options={"color":(255, 165, 0)})

start_point = curve.val().startPoint()
show_object(cq.Vertex.makeVertex(start_point.x, start_point.y, start_point.z))

end_point = curve.val().endPoint()
show_object(cq.Vertex.makeVertex(end_point.x, end_point.y, end_point.z))
```
![image](https://user-images.githubusercontent.com/116052/110976102-c7f8c300-8360-11eb-9bfc-08cbcc33e8a9.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.