Tuesday, 26 May 2015

Volume of Media in Pipes

Been playing with this for a while, but never had time to fully test it and get good results but it’s been itching me cause I knew the is a better answer to the existing solutions on the net.
                The question is: How do you calculate the volume of media in the pipes, or in any equipment for that matter.






                Every single video, blog or forum post I’ve seen are dealing with single pipe with open ends and while that’s good info I find it purely theoretical because you are never going to measure the volume pipe by pipe. Most of these solutions rely on copying the inside surface of the pipe, trim and stitch them back together along with capping the ends, and them sculpt-convert them into a solid that has a volume and for which you can assign material.
                My mind went straight away to derive, combine, sculpt, or possible extrude with intersect to better, faster do this on complete Tube and Pipe assemblies, not just individual pipes. I can’t expect any of you to manually do this because I know I wouldn’t.
                By far, over 10 clicks and multiple minutes wasted for the next best thing, by far, the fastest method I found to be a double derive with simplification and combine. We derive the assembly into a single body, then we use Revit BIM simplify to fill the voids (this is the fastest way) , we derive the assembly again as a different body and then we combine the both removing the second out of the first one which in fact will give us just the media inside the pipes.
                So for the first step prepare your assembly, remove components you don’t need or that will not influence the result to speed up the process and once done save that as a level of detail or design view. If you don’t want to edit your original T&P assembly then do a save copy as and work on that one.
                Open a new part and save it, then use derive component and select your assembly but in the select dialog use the options button and select your level of detail. You can do this later by changing it in the derive window as well.



  TIP: Save your new ipt before derive. I found it to be the problem with long compute time and crashes.

                In the derive style type choose “single solid body” and take off some of the stuff that will not help, like gaskets, bolts, nuts, pipe clips, etc. You should have done this on the assembly when you setup your level of detail or design view but you can do it now as well. Do not mark anything in the Options tab.




                The simplest, fastest way to fill the inside is to use the Revit BIM simplification tool that has a fill voids command we will use. You need to make sure it’s loaded in your add-ins and that you have a tab called BIM in your assembly or part environment. Use fill voids but don’t choose Auto Select because it will try and fill every possible pocket, hole and gap and it’s not relevant to us. Pick your open ends and click OK.








                Before selecting your edges or faces to fill you might want to do a bit of planning. If you select the top most edge / face you might end up with too much info like I did. Instead of selecting the outside of the tee I need to select the base of the up segment otherwise I will get the pockets in the reducing bushing which I don’t need.




                The good about my solution is that you can have as many routes as you want and they don’t need to be connected for this to work.
                Now you should have one single body with all pipes filled in so the next step is to bring in the original one back again. Repeat the steps above to bring it in as a new body.
                Use “combine” and specify the first body as your Base and the second body as your Toolbody, mark cut as your type of operation and click ok.



THAT’S IT!

                Depending on the edges, faces, you selected in the simplify operation you will have different results but now you can assign a material and verify the volume. Right click on the body in the browser or got to iProperties.
                Make sure you specify a material for the body otherwise it will show different Mass; volume will be same but you will scratch your head trying to figure it out why Mass is different on the body than on iproperties.


               

                Limitations:
                If you are using the default Content Center elbows you will need to re-author them. I have done it long ago because converting all my assemblies to neutral formats for clients or sending it to Showcase would unrecognisable twist them and this method of volume measuring will not work. Not all families are created like this and if you have errors simplifying the model then I would investigate the elbows you are using.



                Some elbows have the middle section done as a revolved but because Inventor fails to do a revolve, the axis has been offset by 0.01mm which in fact leaves your elbow with disconnected sections. If you zoom in on your elbow you will see that there is a gap in between the middle section and one of the ends you need to fixe and replace the family member. Or at least the very instance used in the assembly




                The proper way to do the middle section is by using sweep which doesn’t produce a gap in between consecutive segments. If you want to simplify it even more do a single sweep on the outside and another one on the inside, 2 sketches 2 features instead of 3 as it currently has.


Next post will be on how to calculate volume in various shape and size tanks.

Managed to add the video.... enjoy



Later,
ADS.

Thursday, 14 May 2015

Butt Fusion Fittings

Still buried with work and not sure if I’ll be able to do a video but at least you will have some quick info on how to do but fusion fittings and routes in general.



Depending on the complexity and detail you need there are a couple of approaches to take here. The simplest one would be to ignore the discrepancies before and after the pipe welding but you can take it all the way and create your excess welding material as ifeatures that you can drop on each fitting you author.
On my plant layouts I always ignore them because we tend to have plenty of space and discrepancies can be ignored. Quite simply on a 10 meter pipe the assemble tolerance will incorporate any variation from welding or thermal expansion.
So unless you’re into designing medical equipment or any other precise, tight tolerances equipment I would not bother. Keep this as a reference if every once in while you need to do renderings, or the client asks for these welds to be in place and ignore them the rest of the time.
On the simple side, quick and dirty if you do need to have proper, exact cut-to-length dimensions and BOM reports then you need to over-define your engagement dimensions so that the parts interfere therefore reporting correct pipe length and correct route dimensions, node to node.




If you do need to get all that detail exact and you have all the time in the world I would suggest you do the fusion as a ifeature that you can drop on each fitting. Make that ifeature table driven so you can choose and change size on the fly. You can take it down another level and calculate the lost volume from the cutout (melting) and generate your weld bead based on that but that’s way too granular for me.






If you need to author ipart fittings like elbows, tees, or anything else that has a table and might go to Content Center then define new planes driven by the fusion distance and set your engagement to plane/point so you can drive the engagement for each fitting diameter separately.




I recommend that you don’t change or re-author the pipe because you might use that pipe on different connection style (socket welding, jointed, etc.) and it will mess those up. Do all these changes on fittings and it will drive the pipe engagement as well.
Don’t just stop here use the over-engagement on compressed gaskets (thank you Chris Benner for the solution), expansion joints etc.
Here are a couple of links on Fusion Welding, general info and dimensions to help you on the process:
-          Local Head Loss in Polypropylene andPolyethylene Pipeline Joint Welded by Butt Fusion - Ing. Jaroslav VeselskýSupervisor & Prof. Ing. Jan Melichar, CSc.
-          Polyethylene Pipeline Systems - Avoiding ThePitfalls of Fusion Welding - Dr Chris O’Connor

And the post on Autodesk forum that generated this idea.


I have managed to do a video for my youtube friends. Not my best of works, you can hear I am tired and out of focus, apologies for that.



Later,
ADS.

Thursday, 7 May 2015

Custom Table on Drawing

No time for a regular post or a video but I’ve got a small ilogic code to share on how to create and edit custom tables on drawings.
I am doing half a dozen tanks a week and each need to have a couple of tables with nozzle connection and tank specifications.
The tank is done as ilogic component that I clone along with the drawing each time a new one is needed.
The nozzle connection table looks like this:


And the Operating Conditions table:



                All the info comes from the model and if they are not present then we prompt the user for the values to fill in.
                It is better if you place and position the table before running the code otherwise it will show up somewhere in the lower left corner, (you can always move it of course). If you do place the table first even if it doesn't have the correct info the code will find it and will edit it.
                I am using table name as my search criteria when going through all the custom tables on the drawing.  The limitation would be having two custom tables with same name because it stops at the first one so, although obvious, make sure you have different names for each of your table; can’t call them all “table”.

        TableCheck:
'------------------------------------------------------
'---------------start finding the table----------------
'------------------------------------------------------
For i = 1 To oSheet.CustomTables.Count
    TableTitle = oSheet.CustomTables.Item(i).Title                       
    If TableTitle = "Operating Conditions" Then
        'Remember the table number for editing section
        TableNr = i
        'If table found jump to edit section
        Goto EditTable
    End If
Next
'------------------------------------------------------
'---------------end finding the table----------------
'------------------------------------------------------
               
If the table is not found then we are creating it and then we run the TableCheck again in order to find the table number to edit.

'CreateTable:
'------------------------------------------------------
'---------------start creating the table---------------
'------------------------------------------------------
' Set the column titles
oTitles = New String(){"Item", "Description"}
'
'
'
' Create the custom table
oCustomTable = oSheet.CustomTables.Add("Operating Conditions", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), _
                                    2, 11, oTitles,oContents, oColumnWidths)
'------------------------------------------------------
'---------------finish creating the table---------------
'------------------------------------------------------
'edit the table by restarting the check routine
Goto TableCheck
       
This is where we edit the table, and we check if the model has the info we need and if not then we prompt the user for that. When we prompt we show the user the current value but allow him to change it if he wants:

EditTable:
'------------------------------------------------------
'---------------start editing the table---------------
'------------------------------------------------------
'Get the name Of the first model in the drawing
modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
'MessageBox.Show(modelName, "ilogic")
'
'
'
'
'------------------------------------------------------
'---------------finish editing the table---------------
'------------------------------------------------------

It’s pretty much the same for the Tank Connection Details so I won’t post that but the code for this one is down bellow for all those search engines and linked here for you to download.

Later,

ADS.



' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

' Set a reference to the active sheet.
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet

'Declare my custom table
Dim oCustomTable As CustomTable


TableCheck:
'------------------------------------------------------
'---------------start finding the table----------------
'------------------------------------------------------
For i = 1 To oSheet.CustomTables.Count
    TableTitle = oSheet.CustomTables.Item(i).Title                       
    If TableTitle = "Operating Conditions" Then
        TableNr = i
        'If table found jumpt to edit section
        Goto EditTable
    End If
Next

'if not found go create it
Goto CreateTable
'------------------------------------------------------
'---------------end finding the table----------------
'------------------------------------------------------


CreateTable:
'------------------------------------------------------
'---------------start creating the table---------------
'------------------------------------------------------
' Set the column titles
oTitles = New String(){"Item", "Description"}
' You can ask user for the name of the columns if you want
'Dim oTitles(1 To 2) As String
'oTitles(1) = "Item"
'oTitles(2) = InputBox("What to prompt", "iLogic", "Default value")

' Set the contents of the custom table (contents are set row-wise)
'more than one way to skin a cat
'Dim oContents(1 To 22) As String
oContents = New String(0 To 21){}

oContents(0) = "Contents"
oContents(1) = "" 'oMedia
oContents(2) = "Working Capacity (EST)"
oContents(3) = "" 'oCapEST
oContents(4) = "Dry Weight"
oContents(5) = "" 'oDryWgt
oContents(6) = "Maximum Working Weight"
oContents(7) = "" 'oMaxWgt
oContents(8) = "Specific Gravity"
oContents(9) = "" 'oSpecGrav
oContents(10) = "Max. Working Temperature"
oContents(11) = "5 Degrees C"
oContents(12) = "Max.Working Pressure"
oContents(13) = "Atmospheric"
oContents(14) = "Materials of Construction"
oContents(15) = "" 'oMaterial
oContents(16) = "Location"
oContents(17) = "Plantroom"
oContents(18) = "Tolerances"
oContents(19) = ""
oContents(20) = "Angular"
oContents(21) = "+/- 0.5 Degrees"


' Set the column widths (defaults to the column title width if not specified)
Dim oColumnWidths(0 To 1) As Double
oColumnWidths(0) = 7.5
oColumnWidths(1) = 6
 
' Create the custom table
oCustomTable = oSheet.CustomTables.Add("Operating Conditions ADS", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), _
                                    2, 11, oTitles,oContents, oColumnWidths)
'------------------------------------------------------
'---------------finish creating the table---------------
'------------------------------------------------------
'edit the table by restarting the check routine
Goto TableCheck



EditTable:
'------------------------------------------------------
'---------------start editing the table---------------
'------------------------------------------------------
'Get the name Of the first model in the drawing
modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
'MessageBox.Show(modelName, "ilogic")
   
'declare the table to edit by the number found in check
oCustomTable = oSheet.CustomTables.Item(TableNr)

'Type of Media
Dim oMedia As String
'set the cell to edit, you can add numbers or name
'first cell to edit
oCell1= oCustomTable.Rows.Item(1).Item("Description")
'try and get it from the model
Try
    oMedia = Parameter(modelName, "MediaType")
'if not found, prompt user for it
Catch
    oMedia = InputBox("Contents", "iLogic", oCell1.Value)
End Try
'add media to table
oCell1.Value = oMedia

'Capacity
Dim oCapEst As String
'second cell we're editing
oCell2= oCustomTable.Rows.Item(2).Item("Description")
'try and get it from the model
Try
    oCapEst = Parameter(modelName, "CapEst") & " Litres"
'if not found, prompt user for it
Catch

    oCapEST = InputBox("Working Capcity (EST)", "iLogic", oCell2.Value)
End Try
'add Capacity to table
oCell2.Value = oCapEST

'Dry Weight
Dim oDryWgt As String
'3rd cell we're editing
oCell3 = oCustomTable.Rows.Item(3).Item("Description")
'try and get it from the model
Try
    oDryWgt = Parameter(modelName, "DryWgt") & " Kg"
'if not found, prompt user for it
Catch

    oDryWgt = InputBox("Dry Weight", "iLogic", oCell3.Value)
End Try
'add Weight to table
oCell3.Value = oDryWgt

'Total Weight
Dim oMaxWgt As String
'4th cell we're editing
oCell4= oCustomTable.Rows.Item(4).Item("Description")
'try and get it from the model
Try
    oMaxWgt = Parameter(modelName, "MaxWgt") & " Kg"
'if not found, prompt user for it
Catch

    oMaxWgt = InputBox("Max Working Weight", "iLogic", oCell4.Value)
End Try
'add total weight to table
oCell4.Value = oMaxWgt

'Specific Gravity of Media
Dim oSpecGrav As String
'5th cell to edit
oCell5= oCustomTable.Rows.Item(5).Item("Description")
'try and get it from the model
Try
    oSpecGrav = Parameter(modelName, "SpecGrav")
'if not found, prompt user for it
Catch
    oSpecGrav = InputBox("Specific Gravity", "iLogic", oCell5.Value)
End Try
'add Specific Gravity to table
oCell5.Value = oSpecGrav

'Material
Dim oMaterial As String
'6th cell to edit
oCell6= oCustomTable.Rows.Item(8).Item("Description")
'try and get it from the model
Try
    oMaterial = Parameter(modelName, "MaterialType")
'if not found, prompt user for it
Catch
    oMaterial = InputBox("Material", "iLogic", oCell6.Value)
End Try
'add material to table
oCell6.Value = oMaterial
'------------------------------------------------------
'---------------finish editing the table---------------
'------------------------------------------------------


EndRule: