Skip to content
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

Integer vs Double values stored in SS OLEProps #188

Open
farfilli opened this issue Jan 14, 2025 · 6 comments
Open

Integer vs Double values stored in SS OLEProps #188

farfilli opened this issue Jan 14, 2025 · 6 comments

Comments

@farfilli
Copy link
Contributor

farfilli commented Jan 14, 2025

Numeric properties in SS are managed in a "Weird" way, I assume this is to save some bites in the file streams.

If the number to store is an integer the property type is VT_I4; instead, if the number to store is double the property type is VT_R8

In this line, the number is always converted to an integer and that will lead to a decimal loss in case the value to store is double

OLEProp.Value = CInt(PropertyValue)

There is no method to change the property type therefore the only way is to delete the property and recreate it retaining its id

My original code is here where this technique is used

' Case = VTPropertyType.VT_I4

@farfilli farfilli changed the title Integer vs Boolean values stored in SS OLEProps Integer vs Double values stored in SS OLEProps Jan 14, 2025
@rmcanany
Copy link
Owner

I see what you mean. I just did a test in SE. I created two new custom properties of type Number. One had a decimal point and the other didn't. Checking in SSView, the first was an int, the other was a double. I went back in SE and added a decimal to the first and removed it from the second. Back in SSView, the types had switched.

I'll fix that today. I appreciate you keeping an eye on things, by the way.

@rmcanany
Copy link
Owner

That should be working now. If you get a chance to try it, please let me know how it goes.

What's not working is Number type properties on the SE side. Is there some sort of trick to it? In TaskEditProperties, I do Prop.Value = CInt("1") for a VT_I4 property and get something like 1448905303. Huh?

@farfilli
Copy link
Contributor Author

farfilli commented Jan 15, 2025

Converting a string to an integer could be tricky; did you try using a different syntax?
Prop.Value = CType("1", Integer)

Or even better declare an intermediate variable as Integer and use it to assign the converted value? In this way, you can check the conversion before passing the value

@farfilli
Copy link
Contributor Author

farfilli commented Jan 15, 2025

One more hint, in the code you use Int32 which is a different beast than Integer perhaps this is the issue? Or do you use Int32 just as a tag?

@rmcanany
Copy link
Owner

Tried it both ways with no luck. I tried the following with a breakpoint on the second line. i is set to 2, but it's still not working. I'll keep playing with it.

Dim i As Integer = CInt("2")
Prop.Value = i

@rmcanany
Copy link
Owner

I see SE 2024 Update 11 fixed an API bug: PR 10852832: Application Crash Due to Solid Edge Status Setting

I'm going to try to update next week and see if it fixes my issue with Int and Double.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants