Thursday, 10 November 2016

No news?

No news good news, right? Not in my case.


I haven’t diapered on some exotic island drinking coconut cocktails, in fact it was quite the opposite. I felt tired this year, more than usual and was wondering why that is and so I started looking for reasons.

While there could be others as well I stop looking when I found out that by the end of October we had almost 200% live contracts against last year. Cramming 2 years of work into a single one can be exhausting and to be honest I am not looking forward to next year if the trend maintains.

Furthermore (can’t help it) I stop and answer to all your emails, youtube and blog comments, inventor forum, personal messages as well as helping old colleagues.

Two week was special because we had Inventor Open Days, and I couldn’t miss that. What is that you ask? It’s when autodesk employees take a day off answering questions on the forum, but anyone can answer really. Thursday night I spent an extra couple of hours answering questions and trying to help them because on rare occasions like this you can get some really interesting questions and learn a lot.

In fact I saved a couple of posts that I really liked and intend to share them on the blog. Not stealing other people’s work but rather sharing them with those of you that don’t have time to read them all and would better subscribe to blogs like mine and get it as a concentrated pill.

As if this wasn’t enough I decided to get some virtual reality glasses, not the ultra expensive giga-bucks to ruin the economy kind but the cheap phone version. This is essentially just a plastic box where you stick your phone and you watch 3D stuff. Things like panoramic pictures, videos and the “piece de resistance” high quality CAD renderings.

Will have to expand on that on the next blog.

Later,
ADS


photo credit: Anders V "Read All About It" (license)

Friday, 21 October 2016

Drawing layers

                Do you use layers in Inventor drawings? Or do you consider them legacy, obsolete, pre cretaceous kind of animal?

Add caption

Last week we looked at showing hidden lines for buried components and now we look at a different method for doing that but with the additional benefits.

                When detailing pipe routes you can use the “Include Route Centerlines” command but if that view is a detail, section, cropped view you end up with a lot of extra lines. You can use this method to clean them up as well.
Include Route Centerlines, adds more than visible.
               

                Another good example is the worm gear bellow. I have an M10 hole on center and I can’t really show it properly. Top left to bottom right I have hidden lines view, normal view, hidden break out view, normal breakout view and yet not of them looks good enough.

Top left - Hidden Lines, Top Right - Normal,
Bottom Left - Hidden Break Out, Bottom Right - Normal Break Out

                What I tend to do is turn the hidden lines on for that view then edit the layers, where I turn off every one of them except Hidden and Hidden Narrow and save the style. Now I only have left the hidden lines which makes it so much easier to delete the extra stuff.
               
Turn layers off to help your selection.

                TIP: On the edit layers dialog window you can SHIFT select them all and when you click the light bulb the visibility changes to all at once.

                TIP: It’s much easier to do a window selection and select all and then hold down CTRL and deselect the view, and other curves that you need keeping. You can then use the Visibility on the right click menu to turn them off at once.

                And there you have it. Hope you’ll put this to good use and give layers a chance ; they are not used just for AutoCAD exports only.

Later
ADS


                
photo credit: Eugen Naiman layers (license)

Thursday, 13 October 2016

Drawing Hidden Lines

In the drawing have you ever needed to show components buried down below?



I didn’t have a lot of time this week for blogging but I forced myself to wake up early today and write a couple of words on this trick I use quite a lot. Will try and keep it simple for now and will do a follow-up next week on layers and how to leverage them to your advantage.

                A lot of the times I find myself in need to indicate components that are not visible unless you change the view to hidden lines. That can be daunting for untrained eye to look at and it will clutter the drawing so I tend to avoid it if I can.
               
For example take a look at the vessel in the image bellow. Turning the view to hidden lines would have made a mess out of it with no way to identify what’s what. Showing just the legs in hidden lines makes a huge difference.

Hidden lines accentuate design.
To show a component you need to find it in the browser, right click, and choose "Hidden Lines".

Enabling hidden lines

As soon as you set hidden lines on you get a message saying "Dependent vies styles will become independent”.

Changing the view message

Sometimes the “Hidden Lines” menu will be grayed out and that is because your view has linked design view representation. For that you need to edit your view and tick the “Associative” box off as bellow.

Associative off on view properties

A new option is needed here besides “show hidden lines” and that should be simply “show” which will turn the model visible (in dotted lines because it is underneath in the background) without its internal geometry. I need to indicate the component in outline, not the whole geometry but that’s for a latter post.

Next new feature?
   
Take a look at the drawing below. The drain header is visible and I only need the outline body; normally we show all runs in hidden lines but this is just a sales proposal and I couldn't be bothered. This shows just enough info, eliminating clutter and accentuating design.

Way better, isn't it?

Later,
ADS


photo credit: Max Garçia Metallica (license)

Friday, 7 October 2016

T&P Hoses P2 - Documenting Hose Lengths

How do I show hose lengths? How to document hoses? I need to document cut lengths, swage distance as well as overall lengths, so how to do that?

               

                Last week we covered BOM structure for hoses and I’ve showed you how to mark them as single items in BOM / Parts List. This is useful if you don’t’ manufacture the hose and you don’t need to show all the sub-parts individually.

                But what if you need to show those dimensions and send the drawing over to whoever is going to manufacture it; assuming it’s not a standard stock item.

                Hoses are created as a subassembly in tube and pipe and you get the route, the sweep part and the connectors (depending on style settings) in one single assembly.

Hoses are created as assemblies

                Unfortunately the info is not at the assembly level and it can’t be exposed when changing BOM structure to “Purchased” or “Inseparable” (check my previous post here). All the info is created in the hose part (the one containing the sweep).

                If you open the hose and check the parameters window you can find a couple of parameters defining the various lengths for the hose (they are exposed as custom iproperties as well.)

                If you open the parameters window here’s what you will find:
PL - Pipe Length (hose in this case)
RPL - I believe this is "Rounded Pipe Length" (hose in this case)
OPL - I believe this is "Overall Pipe Length" (hose in this case)
ROPL - I believe this is "Rounded Overall Pipe Length" (hose in this case)

Parameters exposed to iProperties.

If you have connectors each end (like I do) you will notice that the sweep sketch is made from a spline and 2 straight lines (swage distance). Measuring the spline and the individual lengths you will get PL(hose length) which is then rounded to the nearest increment (changeable from the T&P route style) and you then get RPL (rounded hose length).

Rounded increment is declared in the Route Style

OPL (overall hose length) you get by adding the connector lengths to the PL (hose length) and just like above when you round this to the nearest increment you get ROPL (rounded overall hose length).

                If you need this info in the Parts List you need to add these custom iproperties manually by editing the drawing table. However if you marked the hose as “Inseparable” or “Purchased” the info will not show up.

                In both cases you can add a Leader Line and use the “Custom Properties – Model” to show these on the drawing.
Use Leader Lines to document the various lengths
                Here's a short animation of the process.




Later,
ADS photo credit: Garden hose (license)

Monday, 3 October 2016

T&P Hoses P1 - BOM Structure


Do you include hoses and flexible tubing to your design? Are you thinking into taking your products to next level by adding this info to your design?




While we use them in our plant layouts we don’t really document them on the drawing but nonetheless there are some good practices as well as tips and tricks.

Will keep this simple and split it into separate blogs and for now the question is:

How can I show a hose assembly as single part?

We are not hose manufacturers so it would help to see the assembly in the Parts Only section of the BOM along with all the fittings, valves, conduits, all parts really to be purchased.

This needs editing the BOM and changing the “BOM Structure” field to one of these 2 options:

- Mark it as “Purchased”

-Mark it as “Inseparable”

For all my life I have been thinking about “Inseparable” items as welded, casted, glued, press fitted, riveted kind of items but it’s really just a way of grouping several parts in BOM.

“Purchased” it’s what I’ve been using and it’s a nice way of merging multiple parts as a single item. Think of skids, tanks, etc. or any assembly which you vendor has sent over and you consider that a single purchase / single item.

The advantages of keeping it or importing it as assembly rather than single part is you can play with Level Of Detail (LOD), Design View Representations or show different positional representations.

 In the Structured tab you can still expand and collapse it (if show all levels is active), edit the iproperties but now it shows up in the Parts Only section of the B.O.M.

At this point should mention that if you want to show the child components of the hose assembly you will change the BOM Structure to “Phantom”. This will promote the children and hide the subassembly; I use this all the time to group things together for less constraints, improved pattern, etc.


Changing Bom Structure type.
Later,
ADS


photo credit: Steel-braided hose (license)

Thursday, 22 September 2016

Tag Top Level Components

And yet again the question of “how to indentify same parts with different labels-marks-balloons” has passed my way. This time it’s a variation of the previous but the answer stays the same and as far as Inventor is concerned, at the moment there is only one solution.

Are you looking for balloons?

As most stuff on this blog it’s not documented and only came to me after long years of testing the software but I have been using it successfully ever since.

While you can add notes, balloons or leader texts to your drawing, they will not update and you need to manually adjust these every time. Don't get me wrong, the values will not update automatically with this method either but we will use ilogic code to force update them all..

The only way to tag equipment is to use assembly browser name. That stays unique to each occurrence (component) and while a valve can be used 100 times in the assembly and reside in library (read only folder) you can change the browser name in the assembly and give it an unique ID.

If you don’t know what I am taking about or you need a refresh, start with this post where I am explaining this concept and the setup of custom balloons in the drawing.

Then read the update on tagging from the assembly, which might be faster/preferred by some people.

Then there’s the final code to use in the drawing which merges both codes and creates the balloon on the drawing and renames the assembly browser node. If that component (eg. Valve) has a tag already then it prompts the user to change the value.

I should mention that it is possible to create a custom table to extract tagged equipment with any iproperties you wish along (eg. PN, Description, Stock Number, etc.).

here's how to create custom table:

and here's how to edit a Parts List table:

Now that we’ve cleared that out, how would I tag top level components like documenting nozzle on a tank assembly?
                While I am used to label end components this time we need to label top level subassemblies.
                Start by creating a custom balloon style, so that the code will only change those and ignore any standard balloons like Item Number and Quantity.
                Then we have several options:
1.       Balloon the items (make sure you select correct style).
a.       Use ilogic to update the value of balloons you select on screen.
b.      Use ilogic change the values of all balloons of that style current sheet / all sheets (complete drawing).
2.       Use ilogic to create balloons on the fly, prompt the user for tag value, and override the value on the assembly browser node and on the balloon.

For simiplicity I have created the second option where the balloons are created for you. Try this out and let me know how that goes.

--------------------------------------------------------------------------------------------------

'this sets a tag to each selected component and creates
'a balloon for it, asks for update of existing balloons

' 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 oActiveSheet As Sheet
oActiveSheet = oDrawDoc.ActiveSheet


Dim oStyles As DrawingStylesManager
oStyles = oDrawDoc.StylesManager

Dim oCurve As DrawingCurve
Dim oEdge As EdgeProxy
Dim occurrence As ComponentOccurrence 
Dim oGeometryIntent As GeometryIntent


While True
    Try
        ' Get a drawing curve segment selection from the user
        Dim oCS As DrawingCurveSegment
        oCS = ThisApplication.CommandManager.Pick( _
                SelectionFilterEnum.kDrawingCurveSegmentFilter, "Pick a drawing curve segment")
                                            
        If oCS Is Nothing Then
            'MessageBox.Show ("Selection was cancelled","ilogic")
            Beep
            Exit While
        End If
                
        oCurve = oCS.Parent
        oEdge = oCurve.ModelGeometry
        occurrence = oEdge.ContainingOccurrence
        While Not occurrence.ParentOccurrence Is Nothing
            'MessageBox.Show("Parent Occ name: " & occurrence.ParentOccurrence.Name,"ilogic")
            occurrence = occurrence.ParentOccurrence
            'MessageBox.Show("cur Occ name: " & occurrence.Name,"ilogic")
        End While 'end test for parent
        'MessageBox.Show("Old Occ name: " & occurrence.Name,"ilogic")
        
        Retry = True
        
        'as long as retry is selected by user
        While Retry
            'get tag from user
            oTagOcc = InputBox("Enter Tag No: ", "Tag Prompt", occurrence.Name)

            Try
                ' try and set that value
                occurrence.Name = oTagOcc
                'if success exit the retrying loop
                Exit While
            'if tag allready exists
            Catch
                'prompt if user wants to try again
                Retry = InputRadioBox("Allready used, try again", "Yes", "No", Retry, Title := "Retry")
            End Try
        End While
        
        'if user canceled the retry skip the rest of the code and
        'prompt to select parts again
        If Retry = False Then
            Continue While
        End If

        'Get the mid point of the selected curve
        ' assuming that the selection curve is linear
        Dim oMidPoint As Point2d
        oMidPoint = oCurve.MidPoint
        
        ' Set a reference to the TransientGeometry object.
        Dim oTG As TransientGeometry
        oTG = ThisApplication.TransientGeometry
        
        Dim oLeaderPoints As ObjectCollection
        oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
        
        Try
            ' Create a couple of leader points.
            Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 0.5, oMidPoint.Y + 1))
            'Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 1, oMidPoint.Y + 0.5))
        Catch
            MessageBox.Show("Circular segment found," & _
            vbLf & "Can't get sement center," & _
            vbLf & "Manually move balloon please", _
            "Position error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
        
        ' Add the GeometryIntent to the leader points collection.
        ' This is the geometry that the balloon will attach to.
        oGeometryIntent = oActiveSheet.CreateGeometryIntent(oCurve)
        
        Call oLeaderPoints.Add(oGeometryIntent)
        
        Dim oBalloon As Balloon
        Try
            oBalloon = oDrawDoc.ActiveSheet.Balloons.Add(oLeaderPoints)
        Catch 
            MessageBox.Show("Can'te activate BOM." & _
            vbLf & "Temporary add a Parts List on the sheet" & _
            vbLf & "You can remove it later", "ilogic")
        End Try
        
        'set the style of the balloon to "Tags"; if you don't have a style called tags
        'you can remove this to keep it as default or use some of these settings:
        'oBalloon.SetBalloonType (kHexagonBalloonType)
        '---------
        'other options here are kCircularWithOneEntryBalloonType, 
        'kCircularWithTwoEntriesBalloonType, kHexagonBalloonType, 
        'kLinearBalloonType, kNoneBalloonType And kSketchedSymbolBalloonType
        '---------
        oBalloon.Style = oStyles.BalloonStyles.item("Tags")
        
        Dim oBalloonValueSet As BalloonValueSet
            
        ' Iterate over each value set (attached balloons) in a balloon.
        For Each oBalloonValueSet In oBalloon.BalloonValueSets
            ' Set balloon value from browser.
            oBalloonValueSet.OverrideValue = occurrence.Name
        Next

    Catch
    'end try
    End Try
End While

'----------Update existing balloons on all sheets

'Ask the user if he wants to update values of all balloons (if edited some)
booleanParam = InputRadioBox("Update existing balloons?: ", "Yes", "No", True, Title :="Update Existing?")

If booleanParam = False Then
    Exit Sub
ElseIf booleanParam = True
    
'process all sheets
For Each oSheets In oDrawDoc.Sheets 
        ' Iterate over each balloon on the sheet.
        For Each oBalloon In oActiveSheet.Balloons
            If oBalloon.Style.Name = "Tags" Then
                Try
                    Dim leader As Leader
                    Leader = oBalloon.Leader
                    'assuming the leader is a single line segment
                    Dim leaderNode As LeaderNode 
                    leaderNode = leader.AllNodes(2)
                    
                    oGeometryIntent = leaderNode.AttachedEntity
                
                    curve = oGeometryIntent.Geometry
                
                    oEdge = curve.ModelGeometry
        
                    'occurrence = oEdge.ContainingOccurrence
                    While Not occurrence.ParentOccurrence Is Nothing
                        'MessageBox.Show("Parent Occ name: " & occurrence.ParentOccurrence.Name,"ilogic")
                        occurrence = occurrence.ParentOccurrence
                        'MessageBox.Show("cur Occ name: " & occurrence.Name,"ilogic")
                    End While 'end test for parent
                    
                    ' Iterate over each value set (attached balloons) in a balloon.
                    For Each oBalloonValueSet In oBalloon.BalloonValueSets
                        ' Set balloon value from browser.
                        oBalloonValueSet.OverrideValue = occurrence.Name
                    Next 'go to next balloon
                Catch'do nothing if error
                End Try
            End If 'end of search for Tags balloons
        Next
    Next
End If

'----------End Update existing balloons on all sheets


---------------------------------------------------------------------------------------------------
Later,
ADS.
                                                                                                                                                                  
photo credit: Mass Ascension (license)

Thursday, 15 September 2016

Convert Parts to Sheet Metal

Still slow on picking up old habits and I am ridiculously busy at work. I think they wouldn’t mind if I get a bed in the office and move in completely.

The other day I started investigating how to convert a batch of parts to sheet metal? If you have a lot of files you might want to use code injector from here. This will insert the code in the files, run it and then remove it from the files cleaning them up.

layers upon layers..



The code to use is.

---------------------------------------------
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument
 
'Change Document.SubType to Sheetmetal
oPartDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"

----------------------------------------------

But what if have an assembly open and I want to convert specific parts? This code will allow you change parts to sheet metal from within the assembly. As long as you don't press ESC and you keep selecting parts in the graphical window it will convert them to sheet metal parts.


 ----------------------------------------------

Dim oADoc as AssemblyDocument
oADoc = ThisApplication.ActiveDocument
 
Dim comp As Object
 
While True
    'prompt user to select an occurrence
    comp = ThisApplication.CommandManager.Pick(
        SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, 
        "Select a component") 
    If comp Is Nothing Then
        MessageBox.Show ("Selection was cancelled","ilogic")
        Beep
        Exit While
    End If
    
    oPartDoc = comp.Definition.Document
    
    Try
        oPartDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
    Catch
        MessageBox.Show("Some error occurred, make sure it's not read-only or library item","error")
    End Try
 
End While

----------------------------------------------
Here’s a short animation.


convert to sheet metal

And then you might ask how to change thickness while we’re here?
This presented a problem in itself because the thickness parameter can’t be accessed directly and the end value seemed to be 10x bigger..!
I read somewhere that the default Inventor units are cm and I needed them in mm but don’t take my word for it.

Here is the code with prompted thickness value.

 ----------------------------------------------
Dim oADoc as AssemblyDocument
oADoc = ThisApplication.ActiveDocument
 
Dim comp As Object
 
 
While True
    'prompt user to select an occurrence
    comp = ThisApplication.CommandManager.Pick(
        SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, 
        "Select a component") 
    If comp Is Nothing Then
        MessageBox.Show ("Selection was cancelled","ilogic")
        Beep
        Exit While
    End If
    
    oPartDoc = comp.Definition.Document
    
    Try
        oPartDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
        
        Dim oSheetMetalCompDef As SheetMetalComponentDefinition
        oSheetMetalCompDef = oPartDoc.ComponentDefinition
        
        ' Override the thickness for the document
        oSheetMetalCompDef.UseSheetMetalStyleThickness = False
        
        ' Get a reference to the parameter controlling the thickness.
        Dim oThicknessParam As Parameter
        oThicknessParam = oSheetMetalCompDef.Thickness
                
        
        'promot user to enter thickness
        'this will get current and ask for new one
        Dim oNewTHK As Double
        'read that default units are cm need to get them to mm
        'but I suspect this is to do with not pecifying explicitly units
        oNewTHK = InputBox("Enter Thickness", "iLogic",oThicknessParam.Value) 
        ' Change the value of the parameter.
        oThicknessParam.Value = oNewTHK/10
    Catch
        MessageBox.Show("Some error occurred, make sure it's not read-only or library item","error")
        Exit While
    End Try
 
End While

----------------------------------------------

Later,
ADS

photo credit: DC-3 (license)