Getting shape data from DxfModel
TorbenVanAssche
4/20/2022 8:16 AM
|
---|
We are trying to extract data from a DxfModel and cannot find how to get the actual shape.
Preferably, we would like to be able to get a list of coordinates from the Entities but that's not something I can find out how to retrieve. I have populated an array with the different DxfBlocks in the file, and am hoping to now get entities from that list (preferably some [x, y] formatting but I cannot find how this can be done from the docs).
Code: / |
Wout
4/20/2022 9:53 AM
|
---|
Hi,
If you're using CadLib 4.0/5.0 (for Windows), there's a GetCoordinates example in the Examples directory. I'll copy the code below:
C# Code: #region ( |
TorbenVanAssche
4/20/2022 10:07 AM
|
---|
Thank you for the quick reply,
We are currently using the .NET Standard 2.0 version (our client's back-end is .NET Core as far as I can tell).
The other DLL for both 4.0 and 5.0 were throwing errors upon installation.
The 'CoordinatesCollector' does not appear to be available in this version as far as I can tell.
I assume this is limited to the 2 versions you mentioned?
- Torben
|
Wout
4/20/2022 10:21 AM
|
---|
Hi,
I just haven't included the sample in the other 2 versions yet, but it should work for those too, perhaps with very minor modification.
What errors did you get for 4.0/5.0? 4.0 should be fine, 5.0 is fairly new so perhaps there are still some occasional hiccups with it.
- Wout
|
TorbenVanAssche
4/20/2022 11:48 AM
|
---|
Hello,
This may be a me-problem but looking at the documentation I don't see the coordinates you mention there.
I just tried importing the 5.0 package, after generating a license for a trial I now have this error popping up,
likely to do with some file missing somewhere
|
Wout
4/20/2022 11:54 AM
|
---|
Hi,
Since this is the Windows version, you need to set TargetFramework to net5.0-windows and set UseWindowsForms to true in your project file:
C# Code: <OutputType>Exe</ |
TorbenVanAssche
4/20/2022 11:57 AM
|
---|
Hello,
I cannot change this myself sadly. I will forward this forum post to the relevant parties and see what they can do to help...
The entire framework we have is built on the current framework version, I don't know if I can just change that.
|
TorbenVanAssche
4/20/2022 12:24 PM
|
---|
Oh... I was looking for a "CoordinateCollector" class, not knowing you had included taht in your code snippet. That would explain why it isnt in the library documentation...
|
TorbenVanAssche
4/21/2022 2:07 PM
|
---|
After carefully applying your suggestion, we are getting a lot of PolyLine data from a file that only includes a rectangle. How should we proceed to identify only this shape and its PolyLines so that we can work with the data extracted as PolyLines? We need to correctly identify the x and y minimum and maximum of the shape so that we can process the data for our database lookup
|
Wout
4/21/2022 2:21 PM
|
---|
I only see 2 polylines in the output, which is correct, because the rectangle in the drawing is drawn by 2 polylines.
- Wout
|