News:

Interested in some really terrific mobile apps? Visit www.turboapps.com for details.

Main Menu
TurboCAD 2026 Platinum box
Now available

TurboCAD 2026.2

The latest update for TurboCAD 2026. It installs over any 2026 build and keeps your activation, drawings and settings. Get it from the Start Page or Help > Check for Update.

Find matching volume (Sorry - Long)

Started by PCSteel, August 02, 2025, 10:39:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PCSteel

Quote from: Alvin Gregorio on August 11, 2025, 06:14:38 PM
Quote from: PCSteel on August 11, 2025, 03:54:35 PMI think you mean reply 39 Nikki
It depends on what we have set for "Show most recent posts at the top in topic view" in (our)Profile/Look_and_layout
  That can cause it to differ by one count between Forum members.
      Which kinda sucks for effective efficient communication.


Ahh, thanks Alvin, I've learnt something else today.
That is a bit confusing.
John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

Alvin Gregorio

John-- What would be a typical range in Volume value that you would be searching for?  An exact value only?  Or within a tolerance, or range?  What would that tolerance or range typically be?
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

PCSteel

Quote from: Alvin Gregorio on August 12, 2025, 04:20:39 AMJohn-- What would be a typical range in Volume value that you would be searching for?  An exact value only?  Or within a tolerance, or range?  What would that tolerance or range typically be?

If a range option was available Alvin, I would make it fairly small, like around 10mm³. The only reason a range would be handy is because occasionally there will be a very small difference in volume, but the two objects are essentially the same. I believe this probably happens when they are created individually rather than copied.
John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

Alvin Gregorio

Quote from: PCSteel on August 12, 2025, 02:48:01 PMIf a range option was available Alvin, I would make it fairly small, like around 10mm³. The only reason a range would be handy is because occasionally there will be a very small difference in volume, but the two objects are essentially the same. I believe this probably happens when they are created individually rather than copied.
Does the method that Nikki came up with allow for Searching or Selecting within a range?
Or only an exact value?

Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

PCSteel

Quote from: Alvin Gregorio on August 12, 2025, 03:40:00 PM
Quote from: PCSteel on August 12, 2025, 02:48:01 PMIf a range option was available Alvin, I would make it fairly small, like around 10mm³. The only reason a range would be handy is because occasionally there will be a very small difference in volume, but the two objects are essentially the same. I believe this probably happens when they are created individually rather than copied.
Does the method that Nikki came up with allow for Searching or Selecting within a range?
Or only an exact value?



Exact value Alvin but I've been using the ID's for my searches because I was unable to get the 'search by query/volume' to work for me.
John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

nikkipollard

#55
Did your Query look something like the attached?
Or you could use a script

Once you have run the first script you can use this script to select by similar volume within a Range.
Select the first Graphic and run the script.

Call SelectSimilarVolume

Sub SelectSimilarVolume()
 If Selection.Count = 0 Then
MsgBox "Please Select one Graphic First"
Exit Sub
 End If

Dim gfx : Set gfx = Selection(0)
dim Volume,vol2
Volume = GetVolume(gfx)
dim gset
Set gset = ActiveDrawing.GraphicSets.Add("SimilarVolumes")

Dim Range
Range = cdbl(InputBox("Range","",5))
Dim mn,mx
mn = Volume - Range
mx = Volume + Range

If Volume <> 0  Then
Selection.UnSelect

For each gfx in ActiveDrawing.Graphics
vol2 = GetVolume(gfx)
   If vol2 >= mn And vol2 <= mx then
       gset.AddGraphic gfx
    End If
Next
End If

gset.Select
ActiveDrawing.ActiveView.Refresh

Set gfx = Nothing
Set gset = Nothing

End Sub
'**************************************

Function GetVolume(gfx)

 On Error Resume Next
  Dim ix : ix = gfx.Properties.Item("M_Volume").Value
 If Err <> 0 Then
  GetVolume = 0
  Else
  GetVolume = ix
  End IF
   Err.Clear
 End Function


Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

PCSteel

#56
Yes Nikki and I just tried again (see screen clip below) with no result.
I had no result from the script either.

You cannot view this attachment.
John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

Alvin Gregorio

I'd like to try to help.
But I got lost along the way.

Can one of you bring me up to speed on:
>Which script(s) are we using?— in which order?  (maybe we can ask Nikki to provide a Name or Version number comment at the tops of her scripts, for easy reference and communication)
>What are the exact steps/tools/commands within TurboCAD that we are now instructed to use to get from a drawing with many graphics within it that have volume to a listing of those graphics that have a Volume Value within a certain range
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

PCSteel

I'm still testing things Alvin, but at present I'm leaning towards the following. The scripts all have their pluses and minuses but after you brought the 'Mass Properties' tool to my attention I've found it to be very useful, the downside being selecting things singly.

It goes something like this:

   •Use 'Mass Properties' to select what needs to be checked.
   •Use 'Generate BOM Report'
   •Export to .csv - metric
   •Open the .csv in a spreadsheet and sort by weight
   •'Select by Query' with criteria - common properties - object ID

BUT, I'm still learning!  ;)

John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

Alvin Gregorio

Quote from: PCSteel on August 13, 2025, 04:44:16 AMIt goes something like this:

  •Use 'Mass Properties' to select what needs to be checked.
  •Use 'Generate BOM Report'
  •Export to .csv - metric
  •Open the .csv in a spreadsheet and sort by weight
This seems like the method we intended on using before Nikki's scripts were offered.

And it starts with  •Use 'Mass Properties' to select what needs to be checked.  Which is an issue at this time, since we have yet to figure out how to select hundreds of graphics in a single operation.

I thought you two were on a different track. 
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

#60
Does the select by similar not work at all? I provided 2 select similar scripts,one that uses the Volume custom property which is generated by the Mass properties tool. And one that uses the M_Volume property generated by my script. (TC wouldn't allow me to use volume - I guess it is reserved)
The only advantage of using my script is that you can select everything at once.

I am not really sure what your end goal is but with a script you can do everything you need to do
Including writing a sorted list to the csv file.
You can create detailed reports or changing the graphics to more meaningful layers. All this with just one script.

If you are using the query tool to find graphics with the same volume - generated by the mass tool - it needs to have a " mm3"
at the end.
'[C]Volume' = '640872.370 mm3' -  it is stored in the database as a string with the units included.

If you are using my script - Search using just the measurement as I didn't bother to add the units to the property.
The advantage of my lazy method is you can use the report tool to get totals.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

PCSteel

Quote from: nikkipollard on August 13, 2025, 06:46:34 AMDoes the select by similar not work at all? I provided 2 select similar scripts,one that uses the Volume custom property which is generated by the Mass properties tool. And one that uses the M_Volume property generated by my script. (TC wouldn't allow me to use volume - I guess it is reserved)
The only advantage of using my script is that you can select everything at once.

I am not really sure what your end goal is but with a script you can do everything you need to do
Including writing a sorted list to the csv file.
You can create detailed reports or changing the graphics to more meaningful layers. All this with just one script.

If you are using the query tool to find graphics with the same volume - generated by the mass tool - it needs to have a " mm3"
at the end.
'[C]Volume' = '640872.370 mm3' -  it is stored in the database as a string with the units included.

If you are using my script - Search using just the measurement as I didn't bother to add the units to the property.
The advantage of my lazy method is you can use the report tool to get totals.


No Nikki, I couldn't get the select by similar tool to work here.

Yes, the script you provided in post 39 or 40 works well and I've found that I can manipulate the BOM data easily in a spreadsheet. That's not to say that there aren't other ways to do it.

Thanks for pointing out that I need to add the mm3 to the Volume search, I had no idea why it wasn't working. At the end of the day it's actually easier to use the ID's for the search as there are fewer numbers to type in.

Thanks Nikki.
John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

Alvin Gregorio

I feel like a dummy.  I can't get the script to do anything.
I'm using the post 39/40 script that has

   '# DESCRIPTION
'Generate mass properties via tools,inquiry,Mass properties before running the script
' select the graphics and Run the script

It says "Generate mass properties via tools,inquiry,Mass properties before running the script".
Isn't that where we started?
This script is supposed to that for me, right?
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

PCSteel

No, you have to run 'Mass Properties' on everything you want included first.
John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

Alvin Gregorio

#64
I thought we decided running Mass Properties on hundreds of objects, with the tool's limitation of having to select one graphic at a time, was to onerous and time consuming.

Even Nikki said in the 39/40 post, "The problem with the BOM method is selecting hundreds of Graphics one at a time is more time consuming..."
  And/but in some other post in this thread she said that (half of?) her script runs Mass Properties on all the graphics.
  And/but Nikki's script throws out this message (attached), if we don't have something selected first.  Note how it states, "... , remember to generate the mass properties before running the script"

I am so confused.
I guess if I'm still interested come the weekend, I can work through catching up on this thread slowly and methodically.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

PCSteel

Yeah I find I'm getting confused too Alvin with all the scripts but I don't think there's one that runs Mass Properties.
I started badly because when I was doing test files I was saving each test, thinking the script would save with it, only to find it didn't. I then had to go back and try to work out what did what.  :-[
John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

nikkipollard

#66
Quote from: PCSteel on August 13, 2025, 07:09:44 PMYeah I find I'm getting confused too Alvin with all the scripts but I don't think there's one that runs Mass Properties.
I started badly because when I was doing test files I was saving each test, thinking the script would save with it, only to find it didn't. I then had to go back and try to work out what did what.  :-[
I was referring to the script , on the 8th of August. I would give you a time but we are on different sides of the world.
The script you are referring ,uses the result of the mass tool to sort the graphics.
When you run that script there are 2 options
The first option, generates a list of IDs with similar volumes (type 1 for that option). The second option finds graphics with the same Volume.(type 2 for that option)
For the second option you only need to select one graphic and it will find all the graphics with the same volume in the drawing, as long as there is a Volume property for that graphic.
I can change that script to work with volumes in a range if you prefer to use the mass tool to generate the Volume property.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

PCSteel

Quote from: nikkipollard on August 13, 2025, 09:21:18 PMI was referring to the script , on the 8th of August. I would give you a time but we are on different sides of the world.

Ahh, that was the second script on that day and is the one I've been using BUT I'm an idiot and missed the fact that there was a second option which, now that you have pointed it out, WORKS BRILLIANTLY.  :)

Thank you so much Nikki and my apologies for being such a difficult student.
John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

Alvin Gregorio

#68
And, yes, within a Range, please.
(Can you Title it something distinctive, high up in the script)
____
Initial post August 14, 2025 - 01:41:00 AM - PDT
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Alvin Gregorio

Quote from: nikkipollard on August 13, 2025, 09:21:18 PM... the 8th of August. I would give you a time but we are on different sides of the world.
So much so that we can even be referring to different Dates.
______
Initial post: August 14, 2025 at 02:34:47 AM PDT
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Andy H

When referring to posts, its easier to quote the post number.  Normally shown in the top right hand corner of each post.  Example, Alvin's latest post is #69 

Alvin Gregorio

#71
Quote from: Andy H on August 14, 2025, 03:01:54 AMWhen referring to posts, its easier to quote the post number.  Normally shown in the top right hand corner of each post.  Example, Alvin's latest post is #69 
Except for (see link) can cause confusion.
___________________
Initial post: August 14, 2025 at 03:52:50 AM PDT
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Andy H

Quote from: Alvin Gregorio on August 14, 2025, 03:52:50 AMExcept for (see link) can cause confusion.
___________________
Initial post: August 14, 2025 at 03:52:50 AM PDT


Good point Alvin.  Though at least it's only one post out  ::) .  (I'm 8 hours in front of you (I think Nikki is 9 hours)). 

Alvin Gregorio

I guess if one thought confusion was taking place, and they really wanted to be certain they were communicating referring to a certain post, they could include a link to the post.

e.g.:  I believe this is the Nikki script we are currently referring to—  https://forums.turbocad.com/index.php?msg=196008
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

Quote from: PCSteel on August 13, 2025, 11:07:43 PM
Quote from: nikkipollard on August 13, 2025, 09:21:18 PMI was referring to the script , on the 8th of August. I would give you a time but we are on different sides of the world.

Ahh, that was the second script on that day and is the one I've been using BUT I'm an idiot and missed the fact that there was a second option which, now that you have pointed it out, WORKS BRILLIANTLY.  :)

Thank you so much Nikki and my apologies for being such a difficult student.

No problem at all.
I am learning so much too, hence my perseverance.
What you really need is a tool that detects similar graphics and converts them to blocks.
Like BricsCADS blockify tool. Even Autocad has copied that tool, with their SmartBlocks tool. Way out of my league but that would be a gamechanger.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

I still think the cleanest, simplest, way is to get the Mass Properties command to allow for selecting multiple graphics or use already-selected graphics.

I'm working (a few minutes a day) with my MS Copilot to achieve that.  Not entirely confident we'll ultimately do so
.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

PCSteel

Quote from: nikkipollard on August 14, 2025, 07:06:43 AM
Quote from: PCSteel on August 13, 2025, 11:07:43 PM
Quote from: nikkipollard on August 13, 2025, 09:21:18 PMI was referring to the script , on the 8th of August. I would give you a time but we are on different sides of the world.

Ahh, that was the second script on that day and is the one I've been using BUT I'm an idiot and missed the fact that there was a second option which, now that you have pointed it out, WORKS BRILLIANTLY.  :)

Thank you so much Nikki and my apologies for being such a difficult student.

No problem at all.
I am learning so much too, hence my perseverance.
What you really need is a tool that detects similar graphics and converts them to blocks.
Like BricsCADS blockify tool. Even Autocad has copied that tool, with their SmartBlocks tool. Way out of my league but that would be a gamechanger.

Yep, that'd do the trick nicely!
John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

PCSteel

Quote from: Alvin Gregorio on August 14, 2025, 09:07:26 AMI still think the cleanest, simplest, way is to get the Mass Properties command to allow for selecting multiple graphics or use already-selected graphics.

Yes, which you would think, is the way it should be.
John@PC Steel

Core i7-6700 CPU
16GB Ram
64 Bit
Windows 10 Home
TurboCAD 2015 Pro Platinum 64 bit Build 90.0
TurboCAD 2023 Platinum 64 bit Build 63.3

nikkipollard

Quote from: Alvin Gregorio on August 14, 2025, 09:07:26 AMI still think the cleanest, simplest, way is to get the Mass Properties command to allow for selecting multiple graphics or use already-selected graphics.

I'm working (a few minutes a day) with my MS Copilot to achieve that.  Not entirely confident we'll ultimately do so
.
You are right.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h