-
-
Notifications
You must be signed in to change notification settings - Fork 166
DimensionStyle Overrides #898
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
base: master
Are you sure you want to change the base?
Conversation
…nd round-trip operations
| case XDataValueKind.ZeroHandling: | ||
| return ZeroHandling.SuppressZeroFeetAndInches; | ||
| case XDataValueKind.LineType: | ||
| return ensureLineType(doc, "LT_TEST"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still have to think about the best way to implement this, by now I leave some notes that I think it will help you to avoid code repetition.
The ensure methods could be replaced for Table.TryAdd it works in the same way and is directly implemented in all the tables.
| private static string getDumpFolder() | ||
| { | ||
| var folder = Path.Combine(TestVariables.OutputSingleCasesFolder, "dim_style_overrides"); | ||
| Directory.CreateDirectory(folder); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The folder creation should be initialized in TestSetup is it giving trouble in ryder?
| } | ||
| } | ||
|
|
||
| public enum XDataValueKind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enum is repeated, DxfCode enum contains all this fields, look for ExtendedData at the end, starts with the value 1000.
You can also check the classes in XData folder for the dedicated classes for each type fo data.
|
|
||
| namespace ACadSharp.Tables; | ||
|
|
||
| public sealed class DimensionStyleOverride |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the class DxfMap it creates this exact same structure and there is already methods to get and set the values for CadObjects.
| /// </summary> | ||
| /// <param name="app">The AppId object.</param> | ||
| /// <param name="value">ExtendedData object.</param> | ||
| public bool TryGet(AppId app, out ExtendedData value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point with this method, I would use directly the name such as:
return this.TryGet(app.Name, out value);I see some other errors in this class like public void Add(AppId app, IEnumerable<ExtendedDataRecord> records) is not checking that the AppId is in the document.
|
Proposal for this implementation: Dimension Methods: if style == null
//Remove Extended data entry DSTYLE
else
//1 Create DxfMap for dimstyle
DxfMap.Create<T>
//2 Compare Dimension.Style vs override style using DxfMap
foreach p in DxfMap.DxfProperties
if p.value(style) != p.value(override)
//Add to extended data
else
//continue
//End: have the edata updated using the dim override as a parameter
Method setps: if override == null => return null;
//Clone current style
//Map the properties from edata into a dxfmap
//override de edata values into the clone
return the cloneLet me know what you think about this approach. |
Description
Implemented overrides for DimensionStyle in Dimension.cs
Related Issues / Pull Requests
Notes for reviewer