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

example on how to read lines from a file #21

Open
aristonous opened this issue Mar 22, 2022 · 4 comments
Open

example on how to read lines from a file #21

aristonous opened this issue Mar 22, 2022 · 4 comments

Comments

@aristonous
Copy link

aristonous commented Mar 22, 2022

Is it possible to add examples on how to read lines from a dxf file I can not make it work

@neekfenwick
Copy link

It should be as simple as something like:

$file = 'some-file.dxf';
$dxf = new \DXFighter\DXFighter($file);

What have you tried, and in what way isn't it working?

@aristonous
Copy link
Author

That's how to open the file, However i am taking about getting the coordinates of the lines from the file.

@neekfenwick
Copy link

@aristonous ah when you said 'read lines' I thought you meant to read the lines of data from the file. Please be specific and use suitable formatting.

From the look of the code, you want to get a DXFighter\lib\Line object from the Entities array and access it's start or end properties. e.g.

use DXFighter\DXFighter;
$dxf = new DXFighter('some-file.dxf');
echo "Loaded OK.\n";

$entities = $dxf->getEntities();
$line = $entities[0];
$end = $line->getEnd();
echo "Saw line to {$end[0]},{$end[1]},{$end[2]}\n";

My copy of the library is old and doesn't have the getEnd() function in the Line class.. I must update some time :)

If you have a decent debugger and read the code in the library it's fairly clear what to do.

Does that help?

@aristonous
Copy link
Author

@neekfenwick yes indeed it works very well. Thanks

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

2 participants