Equation function "INT" doesn't seem to work

User avatar
charlesculp
Posts: 13
Joined: Fri Mar 26, 2021 3:52 pm
Answers: 0
x 1
x 13

Equation function "INT" doesn't seem to work

Unread post by charlesculp »

Am I missing something? I am trying to add an extra sheet at the end of all drawings. Because it is not part of the drawing itself, I need the page count for the drawing to be less than the actual calculated page count. I tried to use an equation in the custom properties to make this happen.

To do this, it does some math, but it looks like it turns it into a floating point number, and uses the length unit standard tolerance for significant digits (three past the .). Ok, so I used the "int" function, but it does nothing. What gives?

Shouldn't

Code: Select all

int ( $PRP:"SW-Total Sheets" - 1 )
return an integer? Solidworks 2022 SP5.0

image.png
User avatar
jcapriotti
Posts: 1868
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 30
Location: The south
x 1211
x 1998

Re: Equation function "INT" doesn't seem to work

Unread post by jcapriotti »

Hey Charles, long time.

I don't see a way to make this work with the equations in custom properties. The INT function is working somewhat if you put a decimal value in like 5.523, it changes it to 5.000. Excel does the same thing if you have decimal place formatting set on the cell.
image.png
image.png (6.18 KiB) Viewed 660 times
Jason
User avatar
JSculley
Posts: 643
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 877

Re: Equation function "INT" doesn't seem to work

Unread post by JSculley »

Yeah, the INT function is borked. You wouldn't be bothering with this at all if this SPR were addressed:

SPR769752 - Ability to set certain drawing sheets to be ignored from total sheet count
User avatar
charlesculp
Posts: 13
Joined: Fri Mar 26, 2021 3:52 pm
Answers: 0
x 1
x 13

Re: Equation function "INT" doesn't seem to work

Unread post by charlesculp »

JSculley wrote: Fri Nov 08, 2024 1:20 pm Yeah, the INT function is borked. You wouldn't be bothering with this at all if this SPR were addressed:

SPR769752 - Ability to set certain drawing sheets to be ignored from total sheet count
Nice, I will +1 that SPR.

Nice to hear from you, Jason. Back doing engineering work again after a decade as a manager.
User avatar
josh
Posts: 295
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 16
x 22
x 508

Re: Equation function "INT" doesn't seem to work

Unread post by josh »

I hope that's an old pic you're using there for your profile... I've considered you somewhat of a colleauge for almost as many years as you look old in that pic.
User avatar
gupta9665
Posts: 410
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 433
x 447

Re: Equation function "INT" doesn't seem to work

Unread post by gupta9665 »

You may have to use a macro that counts the total sheet, subtract 1 and update the custom property. Downside, run macro every time you add/remove a sheet. A macro or add-in to run in the background and act on file save might help updating the sheet count.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
User avatar
charlesculp
Posts: 13
Joined: Fri Mar 26, 2021 3:52 pm
Answers: 0
x 1
x 13

Re: Equation function "INT" doesn't seem to work

Unread post by charlesculp »

josh wrote: Fri Nov 08, 2024 5:18 pm I hope that's an old pic you're using there for your profile... I've considered you somewhat of a colleauge for almost as many years as you look old in that pic.
That was at least four haircuts ago. I had to get it trimmed when I started going on job interviews. It's all still there, though. The picture is from 2021, I believe.

My solution was to do this Solidworks PDM Dispatch Action (during check-out) by creating two variables, one that is the $PRP:"Total Sheets" and the other is the new calculated value. It determines if there is the attached change sheet at the end, and then if there is it subtracts a page from the total. This afternoon I will make it work for a variable number of change sheets; in case the designer gets ambitious and makes multiple pages worth of changes at a time.
image.png
User avatar
AlexLachance
Posts: 2184
Joined: Thu Mar 11, 2021 8:14 am
Answers: 17
Location: Quebec
x 2364
x 2013

Re: Equation function "INT" doesn't seem to work

Unread post by AlexLachance »

JSculley wrote: Fri Nov 08, 2024 1:20 pm Yeah, the INT function is borked. You wouldn't be bothering with this at all if this SPR were addressed:

SPR769752 - Ability to set certain drawing sheets to be ignored from total sheet count
So um, I'm trying to vote on this SPR, but can't seem to find where anymore. I used to do it through the Knowledge base but it doesn't seem to work anymore, I get the search result, but can't vote on it. I tried looking up on the Platform but didn't find any topic on the platform linked to it either...
image.png
https://support.3ds.com/knowledge-base/ ... :SPR769752

Edit: Is it the badge on the right of the title to "Add to Favorites" that counts as a vote? If so, that is truely intuitive, feels just as intuitive as the platform.
User avatar
charlesculp
Posts: 13
Joined: Fri Mar 26, 2021 3:52 pm
Answers: 0
x 1
x 13

Re: Equation function "INT" doesn't seem to work

Unread post by charlesculp »

josh wrote: Fri Nov 08, 2024 5:18 pm I hope that's an old pic you're using there for your profile... I've considered you somewhat of a colleauge for almost as many years as you look old in that pic.
I updated my avatar for you. Funny story, I was at the grocery store with my daughter, who is 11, and we were getting a week's worth of groceries. Then I thought of something we forgot. I ran back to get it, while my daughter put all the groceries on the checkout conveyor. When I get back the cashier was patiently waiting for my return, because the mirin in our purchase contains alcohol.

So, I was carded last week for the first time in probably a decade.
User avatar
charlesculp
Posts: 13
Joined: Fri Mar 26, 2021 3:52 pm
Answers: 0
x 1
x 13

Re: Equation function "INT" doesn't seem to work

Unread post by charlesculp »

As for setting the page numbers, I now do it TWO ways. On Checkin, PDM will run a refresh on the page numbers. I also added a macro to do it, whenever someone adds a DCN to the drawing. So, I did it both ways, neither using custom property equations. The Dispatch is shown above, the VBA code is below. This is a snippet of the appropriate portion.

Code: Select all

NewPropertyNames(28) = "DCN Total Sheets" ' total sheets in the regular drawing
NewPropertyNames(29) = "DCN Pages" ' total pages in the DCN
If SheetNames(UBound(SheetNames)) = "DCNSheet2" Then ' If the last sheet in the list is "DCNSheet2", then total number of regular drawing sheets is the total sheet count minus 2. Keep in mind arrays start at zero, not one
    NewPropertyValues(28) = UBound(SheetNames) - 1 ' arrays start at zero, so the total number of drawing sheets is one larger than the upper bound of SheetNames
    NewPropertyValues(29) = 2
Else
    NewPropertyValues(28) = UBound(SheetNames) ' arrays start at zero, so the value of the upper bound of this array is one less than the total number of sheets in the solidworks document.
    NewPropertyValues(29) = 1
End If
NewPropertyTypes(28) = 3
NewPropertyTypes(29) = 3

' This one updates all values to what is shown
For i = 27 To UBound(NewPropertyNames)
    value = propMgr.Add3(NewPropertyNames(i), NewPropertyTypes(i), NewPropertyValues(i), swCustomPropertyAddOption_e.swCustomPropertyReplaceValue) ' adds any custom properties missing
Next i

User avatar
josh
Posts: 295
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 16
x 22
x 508

Re: Equation function "INT" doesn't seem to work

Unread post by josh »

charlesculp wrote: Fri Nov 15, 2024 10:28 am I updated my avatar for you.
Ya still look way too young... :-D I'd card you.
User avatar
JSculley
Posts: 643
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 877

Re: Equation function "INT" doesn't seem to work

Unread post by JSculley »

charlesculp wrote: Fri Nov 15, 2024 10:34 am As for setting the page numbers, I now do it TWO ways. On Checkin, PDM will run a refresh on the page numbers. I also added a macro to do it, whenever someone adds a DCN to the drawing. So, I did it both ways, neither using custom property equations. The Dispatch is shown above, the VBA code is below. This is a snippet of the appropriate portion.
FYI: You can also add a macro feature to your drawing template so that the necessary code will run every time the drawing is rebuilt. A little automation always helps. Users often forget to run macros or follow procedures, etc....
Post Reply