Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Volume calculation

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
Jefkee
1543 Views, 12 Replies

Volume calculation

Hi,

 

I made some kind of "bucket" for molten metal and i want to know what volume it can hold. So i made the inside of the "bucket" and then get the volume from the physical properties. It worked great.

 

Now they asked me can you give us the volume of each centimeter of the bucket. What i would do is cut a centimeter out of the shape and get the volume. Again it worked great; the only problem is that i would be forced to do this for +1000 times to get all the volumes (its a big bucket).

 

Is there a way for me to get my cut out to go up each time with a centimeter and then export for each level the physical properties to excel. Making a list with all the calcutated volumes

 

 

Thanks, i really hope that there is a way! if there are any questions just ask!

 

In attachement a image of the bucket inside

 

Inventor 2013
12 REPLIES 12
Message 2 of 13
stephengibson76
in reply to: Jefkee

have a look at this part... rule2 drives the popup but it is always step behind because it doesnt update until after its displayed the value.

 

go to your parameters and change the parameter 'zero' plus or minus 1

 

it doesnt output how you want but im no expert and just had a little lunchtime play, im sure its possible and possible to update realtime

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 3 of 13
Jefkee
in reply to: stephengibson76

Ok, i looked at it, and seems good! I went further on it, and came up with this, but as you say, it is a step behind!

 

 

I made these parameters and this rule

parameters.jpg

iLogicVb.UpdateWhenDone = True

Row_Value = Height_Measurement / 10

row = CStr("A") & Row_Value
volume = iProperties.Volume

iLogicVb.UpdateWhenDone = True

GoExcel.CellValue("C:\VaultWorkspace\cadcampc\12853\drawings\test.xls", "Blad1", row) = volume

 

**The height_measurement is against my ref point and always be +1

 

 

So what i still need it to do, is make a loop.

   - Start Loop: height_measurement = 1

       - Write volume value to cell "A1"  --> should be set by row declaration

 

   - Loop: height_measurement = 2 (1 + 1)

       - Write volume value to cell "A2"  --> should be set by row declaration

 

   - Loop End should be when volume value = 0

       - Message box : Measurements are done

Inventor 2013
Message 4 of 13
stephengibson76
in reply to: Jefkee

I created a new rule 'rule3' which is this

iLogicVb.UpdateWhenDone = True
iLogicVb.RunRule("rule2")

 

then deleted the 'updateWhenDone' from rule2 and placed the line

 

iLogicVb.RunRule("rule3")

 

at the top of rule2

 

this is a rather ineloquent way of forcing it to update to the parameter entered, there will be a better way by someone more experienced

 

I would be interested in your finished rule to workout displacment of ships hulls at different waterlines and am willing to help where i can

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 5 of 13
Jefkee
in reply to: stephengibson76

 Hi, again..

 

I tried some things but I still cannot get things to work, something is wrong to my code, it seems that my loop works but my write to excel doesn't.

 

First lets have a look at the code:

 

InventorVb.DocumentUpdate(True)
iLogicVb.UpdateWhenDone = True

Dim row As String
Dim volume As Double

rowvalue = 0

While Height_Measurement <= Max_Height
	
	Height_Measurement = Height_Measurement + 10
	rowvalue = rowvalue + 1
	
	InventorVb.DocumentUpdate()
	iLogicVb.UpdateWhenDone = True
	
	row = CStr("A") & rowvalue
	volume = iProperties.Volume
	
	MessageBox.Show("height = " & Height_Measurement & " row = " & row & " volume = " & volume, "My iLogic Dialog", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
	
	GoExcel.Open("C:\VaultWorkspace\cadcampc\12853\drawings\test.xls", "Blad1")
	GoExcel.CellValue("C:\VaultWorkspace\cadcampc\12853\drawings\test.xls", "Blad1", row) = volume
	GoExcel.Save
	GoExcel.Close


If Height_Measurement > Max_Height Then
	
	MessageBox.Show("Excel sheet ready", "My iLogic Dialog", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)

Exit While
End If
End While 

 

I made a message box that reports back to me what values are active (for testing) and there the output is almost ok. It shows that it gives a loop where the height_measurement and rowvalue is changing as I want. The volume on the other hand stays the same trough out the loop. This is because my 3D model doesn't update in the loop, and I don't know how to get it to do so.

 

Further my expectation would be that it in my excel-sheet I would get a list of the same volume values. But here it only shows in the first cell.

 

 

 

Anybody got any idea how to get it to write in all the cells that are needed and update my 3D model during my rule loop?

 

 

Thanks.

Inventor 2013
Message 6 of 13
stephengibson76
in reply to: Jefkee

can you post your part as well?  this thread might get better results in the customization forum

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 7 of 13
Jefkee
in reply to: stephengibson76

here is my part.

 

 Its the test rule that is supressed, the other rules are other tryings but not as good (but working) you have to end inventor to exit the cyclus 😕

Inventor 2013
Message 8 of 13
VdVeek
in reply to: Jefkee

Jefkee, I tested this a little bit and i found the command: RuleParametersOutput() under the Document-Snippets.

When i place that line before the DocumentUpdate i get some good results. I need to test it some more before i post some code, but you can give it a try.

Rob.

Autodesk Inventor 2015 Certified Professional & Autodesk Inventor 2012 Certified Professional.
Message 9 of 13
VdVeek
in reply to: VdVeek

I saw you have inventor 2012, I use 2013 at the moment so i just place the code here that works for me.

It creates a textfile but you can also write the information to an excel-file. 

First i set the Hoogte Split propertie to 0mm, and then run the rule. There will be a textfile in the same folder as the part with the volumes in it.

Hopes you understand the code.

Rob.

Autodesk Inventor 2015 Certified Professional & Autodesk Inventor 2012 Certified Professional.
Message 10 of 13
Jefkee
in reply to: VdVeek

edit,

 

i need to change that! i use 2013 now too 🙂 and its needed in excel but i will have a look later! thanks!

Inventor 2013
Message 11 of 13
Jefkee
in reply to: Jefkee

I will post a 'clean' code of my version that writes to excel later today. But ive got it working thanks! Bedankt!

Inventor 2013
Message 12 of 13
stephengibson76
in reply to: Jefkee

Hi, did you ever manage to get this working?  I would love a copy of the code

 

thanks

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 13 of 13
stephengibson76
in reply to: VdVeek

this worked for me...  Ive adapted it to drop into an assembly so you can simply place any ship hull into the assembly, run the rule and pump out the gross tonnage for different waterlines...  a very useful tool

Stephen Gibson



View stephen gibson's profile on LinkedIn


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums