cart: empty [ Login ]

Getting shape data from DxfModel

< previous  1 2 3 
Wout
5/6/2022 8:45 AM
For your file Block_test1.dwg the output is: Block SHAPE Polyline: { 0, 0, 0 -3.13364418244736E-16, 4.36971315725182, 0 2.37999036250534, 5.47993406989127, 0 2.37999036250534, 7.04433626497413, 0 -5.68890445586918E-17, 8.55827387311884, 0 6.12323399573677E-16, 10, 0 5, 10, 0 5, 0, 0 } This is also correct. - Wout
TorbenVanAssche
5/9/2022 10:08 AM
Thank you for the reply! After carefully looking through your code here, we saw that we have exactly the same code but different results with the .NET Standard 2.0 version of the library. I updated your library to 6.0 to test if that would solve it. With that version it does what is expected. There is however one issue popping up with reading the blocks; While your suggestions work perfectly for what we need. Is there a way to find the instances of a block in the DWG file? We have 2 instances of the same block at a different position, which is important information we cannot read from the block data directly.
Wout
5/9/2022 10:44 AM
The only way is to brute force iterate over all the layout's entities and its children recursively. You can do this iteration once, and store a dictionary of block to a list of inserts. Note that these inserts may not all be on the top level, they may be 2 or 3 levels deep, so their position might then not be the actual position in the drawings coordinate system, but rather the position in their parent insert's coordinate system etc. - Wout
TorbenVanAssche
5/11/2022 1:50 PM
That worked a charm! The only thing I cannot seem to figure out is how to find the offset of entities in the block. This information does not appear to be available on a Block / Entity level as the transformation matrix for entities inside blocks is an identity matrix. But the object is not on the origin of the block (in the AutoCAD Block editor, see attached screenshot). I am looking to programmatically move it over to that center so the object is positioned accurately on the pivot which will account for coordinates more accurately.
< previous  1 2 3