-
Hi all, I have a problem with this DXF in which there is a block "Overfladebrond" that has been defined with unit "millimeters". The corresponding Insert entity has an original scale of 0.001 but then the PostProcesses method set the scale to 1. So I display the block reference with scale 1 but it is 1000 bigger than the size in AutoCAD. So the question is: is it correct to PostProcess the Insert entity in this case ? I hope that you can help to clarify this topic. Thank you. Best regards. Keven Corazza |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I guess you are familiar with the scale factor introduced by AutoCad when creating Insert entities due to the relationship between the document insertion units (DxfDocument.DrawingVariables.InsUnits) and the Block units (Insert.Block.Record.Units). When a DXF is created the Insert scale values includes both, the units scale factor and any scale value introduced by the user. When the Insert is imported with netDxf this is undone so the Insert scale property only includes the user scale value and not the units scale. In AutoCad if you check the scale value of the Insert in the properties window you will see that it shows 1, but the document insertion units is meters and the block units is millimeters, that is the 0.001 scale factor you are missing. If you want to display an insert you need to take the units scale into consideration, but keep in mind that to properly draw an Insert you not only need the scale but also the rotation, the normal, and the position of the Insert. There is a method in the Insert class "GetTransformation" that will return a transformation matrix that includes all scales, the normal, and the rotation; together with the Inserts's position and the Block's origin you have all information to properly transform the block entities. Take a look at the Insert's "Explode" method for more information. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. I confirm that Explode method works fine but I expect the same without Explode. I notice a difference in the way the scale factor is calculated: Explode:
PostProcess:
Thank you. |
Beta Was this translation helpful? Give feedback.
-
Yes, it is correct. As I explained in my previous post when loading the DXF I undo the scale factor due to the difference between the block units and the document units. This is the same as saying, I am inverting the unit conversion factor. That is why I need to multiply the DXF inssert scale by: UnitHelper.ConversionFactor(this.doc.DrawingVariables.InsUnits, insert.Block.Record.Units); which is the same as: 1 / UnitHelper.ConversionFactor(insert.Block.Record.Units, this.doc.DrawingVariables.InsUnits); |
Beta Was this translation helpful? Give feedback.
I guess you are familiar with the scale factor introduced by AutoCad when creating Insert entities due to the relationship between the document insertion units (DxfDocument.DrawingVariables.InsUnits) and the Block units (Insert.Block.Record.Units). When a DXF is created the Insert scale values includes both, the units scale factor and any scale value introduced by the user. When the Insert is imported with netDxf this is undone so the Insert scale property only includes the user scale value and not the units scale. In AutoCad if you check the scale value of the Insert in the properties window you will see that it shows 1, but the document insertion units is meters and the block units is m…