Hi,
I have switched from Revit 2022 to 2024, and encountered something that seemed strange to me, but perhaps there is just a setting I haven’t found yet.
Basically this keeps happening to me:
I assumed that a string should not do this. If I place any other character in front of it(or behind it) then it works as it should …
Any clues?
Michal
I would suggest you check that you have the latest version of revit 2024, if not get that update then re-check if you are having the same issue.
How to tie the Build number with the Revit update
I think this is a known and resolved issue where leading and trailing zeros were removed for the display of the string. To confirm it try a String.Length node to see if that returns a value of 1 (meaning the 0 is lost) or 2 (meaning the zero is just not displayed). To fix the later first confirm you have all the updates, then if so and it’s still blocking for your workflow, consider adding a prefix for display purposes, such as a zero width space. Just be sure to not use the display value in further calculations.
1 Like
bvs1982
November 13, 2024, 12:34pm
4
Looks like @jacob.small is right
Ahhh, thanks guys, yeah it solved it.
@bvs1982 yes, I cant recall a post where he wasnt right
I can - quite a few actually.
The joy of AEC tech is there are pretty much infinite ways to accomplish any goal. As such all answers are situationally dependent - you’ve got a different perspective than I do and can do things which I cannot.
So always trust but verify for your context, as I’m not sitting where you are. Least I think not - I’d hope you’d say hello if I was next to you.
You’ll all probably be excited about this PR coming to a future Dynamo version then
DynamoDS:master
← mjkkirschner:codeblockdisplay
opened 09:29PM - 01 Sep 23 UTC
### Purpose
[DYN-5965](https://jira.autodesk.com/browse/DYN-5965)
[DYN-6557]… (https://jira.autodesk.com/browse/DYN-6557)
this PR does the following:
* adds some new overloads for the string conversion methods that the `String From Object` and `String From Array` nodes call internally.
* modifies the built-in methods and string from nodes to accept a second optional parameter `formatSpecifier` the nodes pass these specifiers down in the case of integer or double to string calls.
* adds two new nodes `String From Object And Format` and `String From Array And Format`.
* adds `DynamoPreferencesNumberFormat` as a special format that uses the preferences to set the specifier - maybe a simpler name for this `DYNFORMAT`? I am still on the fence about this.
* When we encounter a format exception - for example if you user tries to apply a binary format string to a floating point number (not allowed) - we catch the exception, log a warning on the node, and return the string "Format specifier was invalid." instead of the formatted string.
* If this occurs to ANY data in an array, the entire array is not formatted.
* adds extended help docs for these two new nodes.
* new nodes are marked experimental.
* Introduces a new experimental state for nodes, if this is true a node will display an experimental glyph in the UI and there will be some extra text in the description.
* Introduces a feature flag to control if the glyph should be displayed.
support all c# numeric specifiers:
![image](https://github.com/user-attachments/assets/1b18fcbb-e9fc-4576-a8a7-236fea7d170f)
a new experimental glyph is added - we also display this glyph on nodes that are in the experimental category in the preferences - this is done with namespace matching.
![Screenshot 2024-11-06 194145](https://github.com/user-attachments/assets/ca63e3e5-4176-4ef3-bf8a-c39357cfbe9b)
we use the standard dotnet `experimental` attribute to control the experimental state - we also have a tooltip explaining what this means. Package authors can use this and it integrates into c# - if someone tries to use an experimental API it is a compile time error and they need to explicitly disable the warning to compile their c# code.
![Screenshot 2024-11-06 165924](https://github.com/user-attachments/assets/5ea445c1-12ff-49bf-b22f-6541b7dc9aa6)
also add a bit of text to extended description of the node in the library.
![Screenshot 2024-11-06 122100](https://github.com/user-attachments/assets/49987a82-d3fe-40de-8a26-bfd9dec8abf5)
extended docs for the new string format nodes are added and link to the super detailed c# docs.
![Screenshot 2024-11-06 121849](https://github.com/user-attachments/assets/15c290f3-311a-4fd0-9b7a-70afb37a2802)
TODO:
- [x] add tests
- [x] add more tests!
- [x] cleanup method names
- [x] add localized resources
- [x] additional controls for using standard c# string formats -
- [x] assess with the teams if this should make it into 3.4 or is too risky
- [x] Currently the default format specifier is `f6` which keeps the behavior consistent with the old nodes... though I think actually `G` is a better default. It's what most users would expect IMO
- [x] file a follow-up task for using format specifiers on reference types (classes)
- [x] file a follow-up task for adding info or warnings if experimental methods are used in DS code or python.
- [x] file a follow-up task for generating experimental docs urls.
- [x] tsplines - remove from experimental check
### Declarations
Check these if you believe they are true
- [x] The codebase is in a better state after this PR
- [x] Is documented according to the [standards](https://github.com/DynamoDS/Dynamo/wiki/Coding-Standards)
- [x] The level of testing this PR includes is appropriate
- [x] User facing strings, if any, are extracted into `*.resx` files
- [x] All tests pass using the self-service CI.
- [x] Snapshot of UI changes, if any.
- [x] Changes to the API follow [Semantic Versioning](https://github.com/DynamoDS/Dynamo/wiki/Dynamo-Versions) and are documented in the [API Changes](https://github.com/DynamoDS/Dynamo/wiki/API-Changes) document.
- [ ] This PR modifies some build requirements and the readme is updated
- [ ] This PR contains no files larger than 50 MB
### Release Notes
* add `String From` nodes that allows control over format of generated string using format specifiers.
* standard c# numeric specifiers are allowed. https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
* in addition a custom Dynamo specifier is allowed that uses the user's current number format preferences in the dynamo preference. Using this is discouraged. `DynamoPreferencesNumberFormat`. (this is currently undocumented) I'd like insight from team members and ux if it makes sense.
* Dynamo now also supports the `system.diagnostics.codeanalysis.experimental` attribute https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.codeanalysis.experimentalattribute?view=net-8.0 and will display a small experimental symbol on experimental nodes as well as adding some information to the description for these nodes.
### Reviewers
(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)
(FILL ME IN, optional) Any additional notes to reviewers or testers.
### FYIs
(FILL ME IN, Optional) Names of anyone else you wish to be notified of
1 Like