Comments (6)
In the Dwg Reader there is this line:
//X-axis dir 3BD 11 Apparently the text x-axis vector. (Why not just a rotation?) ACAD maintains it as a unit vector.
mtext.AlignmentPoint = this._objectReader.Read3BitDouble();
So I'm guessing that the rotation is calculated using the AlignmentPoint
and the InsertPoint
.
For the Dxf we need to detect if the angle is provided or not, and then calculate the AlignmentPoint
(which it should be renamed as a vector) or the angle depending on which one is provided.
from acadsharp.
That is exactly the information that I need. Confirmed that the AligmentPoint
and InsertPoint
were both properly set to determine the angle.
Since the angle is determined If this is the case, is there any time that MText.Rotation
is actually used? I see it has DxfCodeValue(50)
attribute so I'm presuming that it is read at some point, but I feel like whoever uses this library needs to determine which value to use.
In this case, do we add any "helper" methods (or property) like MText.Get2dRotation
and MText.Set2dRotation
on the class to ease the use of this or do we just leave it up to the Library consumer to determine which to use (AligmentPoint
and InsertPoint
vs Rotation
)?
I'm willing to do this if I have a better understanding if/when the Rotation
DXF code is used.
I deal with 2D DWGs regularly so I forgot this was probably done this way to calculate the rotation in 3 dimensions...
from acadsharp.
It seems that the DWG works only with the AlignmentPoint
because checking the documentation the rotation is not read at any point, so for DWG when AlignmentPoint
is set, the Rotation automatically should get it's value.
For DXF it seems that you have both options, but I presume that both values must be coherent with each other, if not, Autocad just picks the last value read:
Documentation: "A group code 50 (rotation angle in radians) passed as DXF input is converted to the equivalent direction vector (if both a code 50 and codes 11, 21, 31 are passed, the last one wins). This is provided as a convenience for conversions from text objects"
For me the best way to approach this issue would be to to modify the { get; set; }
for the Rotation
and the AlignmentPoint
being this last one a normalized vector:
First scenario:
The costumer/reader sets the Rotation
, the set calculates the new AlignmentPoint
and changes the value so both of them are coherent with each other.
Second scenario:
The costumer/reader sets the AlignmentPoint
, the set calculates the new Rotation
angle and sets the new value.
This way both values are always linked and they will "make sense" at any moment.
This is the solution that I propose but I accept any ideas or alternatives.
from acadsharp.
IMPORTANT NOTE:
I've notice that the common fields for TextEntity
and MText
have the same text in the xml documentation, so for MText
the documentation is not valid and needs to be updated, the branch linked to this issue will refactor this class.
from acadsharp.
Excellent. Thank you for digging into this. I agree that modifying the properties set methods is the best way. These are pretty high priority for me so I will go ahead and make a PR for this modification less the documentation.
from acadsharp.
PR created, feel free to push your branch to the PR's issue if you want, I'll give a second look before merging.
from acadsharp.
Related Issues (20)
- Need handle error HOT 1
- DWG MText Not Appearing HOT 1
- DwgWriter fails due to summaryinfo being null HOT 2
- CadDictionary TryAdd always returns false HOT 1
- Encoding Issue HOT 3
- How to add entities to a new layer?
- HELP WANTED: How to convert cadDocument into a pdf file. HOT 2
- Creating Layouts and Viewports
- Dictionary name not stored when writing to DWG HOT 1
- Hatch Transparency Value Not Updating in DWG file HOT 2
- Some entities don't seem to be read in HOT 2
- How to get attribute Tag ? HOT 3
- The entity color is incorrect in the saved DWG file HOT 3
- Dynamic blocks support HOT 1
- GDAL reads a DXF file shows 0 features Which created by ACadSharp HOT 3
- DxfWriter failed to write entities. HOT 1
- Dictionary entries with key ACAD_ENHANCEDBLOCK not read anymore HOT 3
- Hatches not writing correctly HOT 3
- Dxf reading further than end of file or stream HOT 2
- .
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acadsharp.