Skip to content
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

Hatch with polyline points only returning y coordinate #130

Closed
mstigter0 opened this issue Mar 15, 2023 · 2 comments
Closed

Hatch with polyline points only returning y coordinate #130

mstigter0 opened this issue Mar 15, 2023 · 2 comments

Comments

@mstigter0
Copy link

Hi,

I've got an issue with parsing hatches with polyline points (only y values are returned).
image

I've found that removing the Object.create() and just setting polypoints to the object fixes my issue but i dont know if this creates other issues.
I saw that this line was added in a commit that added the bulge to the polypoints (879808c).

polyPoint = Object.create({
x: parseFloat(value),
y: 0,
bulge: 0,
})

image

I cant see why Object.create(0 doesnt work so would appriciate it if this is looked at.

@Akbar1909
Copy link

The same result on my side

@stevage
Copy link
Contributor

stevage commented Jun 1, 2023

Yes, I found the same thing. And the fix suggested works for me.

I'm not sure why Object.create() is used here (and in a few other places) but it definitely looks wrong. I think what is happening is:

  1. polyPoint is initialised with a value of {} (and a prototype that includes values for x, y and bulge)
  2. polyPoint.y is given a value
  3. ...that's it. So when polyPoint (now inside an array) is returned later on, it has just a y property.

stevage added a commit to stevage/dxf that referenced this issue Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants