Monday, 18 September 2017

T&P Replace Family Template

            Let me just start by saying this is a bug and I’ve documented it on idea station so you can all vote for the change.

                If you have published a TP fitting to content center and you decide to change the authoring info there is no way to update the family in content center.

                Sure, you can try the standard procedure of right-clicking on your family and use the Replace Family Template but that will not update authoring info.



Replace Family Template works (no errors) but the authoring info is not updated.

Creating a new CC family is not feasible because you then need to change all T&P styles for existing runs/routes and point them to the new family. T&P Styles uses the CC UID to track and store fittings of each style.

There is no other way except to cast a vote and to hope it gets implemented.

Here’s the link to idea station.

Later,

ADS

Monday, 21 August 2017

Handrail with Tube and Pipe

                A while back I answered a question on Autodesk forum on what would be the best way to do hand railing in Inventor.



                While I think Frame Generator is the best tool for that because you get notch, trim and other specific functions to help you out I also mentioned Tube and Pipe.

                The user got really intrigued on how I would use Tube and Pipe for hand railing especially since he wanted ball connections on all joints.

                The other benefit of making it in Tube and Pipe is the possibility exporting the results into bending machine format; read all about it here.

                This post will explore just that, a short video on how this might be accomplished with TP. If you find the quality low on the video then you can always see the original one on screencast here.

video


Later,

ADS 

Thursday, 17 August 2017

Remove Columns on Bend Table

                Some Inventor tables are hard-coded and you can’t configure and preset their format. One of this tables is Bend Table and I had an interesting request from someone to remove Bend Radius column from it.





                You can customize it when you place the table or by editing the table, however, he doesn’t want to do it for every single table he places but rather configure it once and for all.


video


                This is one hard-coded table which can’t be configured. I have even searched the registry to see if I can find any reference and couldn’t find any. 


                Case has been confirmed by Autodesk QA Engineers but that doesn’t mean we can’t speedup the process.

                I have written an ilogic code for you that will remove the bend radius from your table. I suggest you have this as an external rule which you can trigger with a nice form.....

Here's an example.




Here’s what the code does



And here is the code.


' 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

'Set name for this table
Dim TableName As String
TableName = "TABLE"

' Process the rule, wrapping it in a transaction so the
' entire process can be undone with a single undo operation.
Dim trans As Transaction
trans = ThisApplication.TransactionManager.StartTransaction( _
        oDrawDoc, "Remove Bend Radius column from Bend Table")

For i = 1 To oSheet.CustomTables.Count
    If oSheet.CustomTables.Item(i).Title = TableName Then
        TableNr = i
    Else
        MessageBox.Show("Table named: " & TableName & " was not found on drawing", "Missing Table")
        Exit Sub
    End If
Next

'declare the table to edit by the number found in check
oCustomTable = oSheet.CustomTables.Item(TableNr)

'remove Bend Radius column
oCustomTable.Columns.Item("Bend Radius").Delete()

'end transaction for single undo
trans.End

Later,

ADS


photo credit: Lex Photographic Black and White Columns and Arches (license)

Monday, 14 August 2017

Translucent Off via iLogic

                If you import foreign cad models you might get the import as surfaces which show up as orange, translucent objects.




                I had one the other day that I needed to import as assembly but having all surfaces translucent did not cut it for me so being lazy I had written a code to change all parts and remove transparency.




                Short and sweet, here it is:

----------------------------------------------
Dim oAsmDoc As AssemblyDocument 
oAsmDoc = ThisApplication.ActiveDocument 

' Get the assembly component definition. 
Dim oAsmDef As AssemblyComponentDefinition 
oAsmDef = oAsmDoc.ComponentDefinition 

' Get all of the leaf occurrences of the assembly. 
Dim oLeafOccs As ComponentOccurrencesEnumerator 
oLeafOccs = oAsmDef.Occurrences.AllLeafOccurrences 

Dim oPartDoc As PartDocument
Dim oOcc As ComponentOccurrence 

' Process the occurrences, wrapping it in a transaction so the 
' entire process can be undone with a single undo operation. 
Dim trans As Transaction 
trans = ThisApplication.TransactionManager.StartTransaction( _ 
        oAsmDoc, "Translucent Off")

    For Each oOcc In oLeafOccs 
        oPartDoc = oOcc.Definition.Document
            
        Dim oWorkSurfaces As WorkSurfaces
        oWorkSurfaces = oPartDoc.ComponentDefinition.WorkSurfaces
        
        Dim oWorkSurface As WorkSurface
        For Each oWorkSurface In oWorkSurfaces
            oWorkSurface.Translucent = False
        Next
        
    Next 
    
'end transaction
trans.End 

----------------------------------------------
Later,
ADS


photo credit: Laura Tabakman Tabakman_Floating-bottom view (license)

Wednesday, 2 August 2017

Force Sheet Orientation

                So you need to force sheet orientation in inventor and have A4 always Portrait and the rest landscape?
                This is possible out of the box and it’s working quite nicely.


video
               

                But you want to update to old drawings or want to enforce things in your company? Then we can use this code:


Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDrawDoc.ActiveSheet

If oSheet.Size = Inventor.DrawingSheetSizeEnum.kA4DrawingSheetSize Then
    
    oSheet.Orientation = Inventor.PageOrientationTypeEnum.kPortraitPageOrientation
Else
    oSheet.Orientation = Inventor.PageOrientationTypeEnum.kLandscapePageOrientation
End If



Later,
ADS

Friday, 28 July 2017

Multiple Balloon Sets

                How can I have multiple balloon sets on same drawing? How can show project Item Number on components and subassembly drawings?



                In this case the user wanted to have dual balloons on all drawings but it works with as many balloons as you can fit in a drawing.

The first balloon will indicate current assembly Item Number, which translates to what position the item has in the current assembly and the second balloon was to show master Item Number which means what position this member has in the general, whole project, context.

He didn’t want to have dual set of documentation, one for fabrication and one for manuals because it was hard for him to maintain and update.

Three things are needed for this.

The user will place balloons on drawing as usual and we will change them for him but in order to do that we need a way of knowing which ones exactly he needs changing.

1. A new balloon style called “Pars Only”. I suggest you change the shape as well, like hexagonal type, maybe change text style too just to distinguish them better and update the code if you use a different name for the balloon.



2. A “PARTS ONLY” table but of the main assembly. Name it whatever you want but update the code.

User needs to place main assembly (project) “PARTS ONLY” parts list on the drawing so we can track and find this.

Do not filter the Parts Only table, it won’t work, there is no view for it to process. Design View reps or Ballooned Only filters won’t work.

3. iLogic code to process all “Parts Only” balloons and update value as in “PARTS ONLY” table.

You can do this with without a table but have the user browser for main iam and process BOM from that.

Here is a short video:

video


And here is the iLogic code:

'  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 oOccurrence As ComponentOccurrence 
Dim oGeometryIntent As GeometryIntent

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

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

If booleanParam = False Then
    Exit Sub
ElseIf booleanParam = True
End If

Dim oSheet As Sheet
'process all sheets
For Each oSheets In oDrawDoc.Sheets 
    
    '----------find the parts list
    oPartsLists = oActiveSheet.PartsLists
    'try and get the parts list form the table of this sheet
    Try
        
        For i=1 To oPartsLists.Count
            If oPartsLists.Item(i).Title = "PARTS ONLY" Then
                oPartsList = oPartsLists.Item(i)
                Exit For
            Else
                'do nothing
            End If
        Next
    Catch
        MessageBox.Show("No parts list named 'PARTS ONLY' found on drawing", "iLogic")
    End Try    

'----------end finding parts list

    ' Iterate over each balloon on the sheet.
    For Each oBalloon In oActiveSheet.Balloons
        If oBalloon.Style.Name = "Parts Only" 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
                oOccurrence = oEdge.ContainingOccurrence
                
                'get the selected item document occurrence name
                oOccDoc = oOccurrence.Definition.Document
                
                'get the path and file name of the selected item
                oOccFileName = oOccDoc.FullFileName
                
                ' Iterate over each value set (attached balloons) in a balloon.
                For Each oBalloonValueSet In oBalloon.BalloonValueSets
                    
                    '----------find item in parts list PARTS ONLY
                    ' Iterate through the contents of the parts list.
                    Dim j As Long
                    For j = 1 To oPartsList.PartsListRows.Count
                        ' Get the current row.
                        Dim oRow As PartsListRow
                        oRow = oPartsList.PartsListRows.Item(j)
                        'get filename of model in row
                        Dim oRowFileName As String
                        Try ' try and get the full file name of the PL item
                            oRowFileName = oRow.ReferencedFiles.Item(1).FullFileName
                        Catch 'on error go to next item
                            Continue For
                        End Try
                        
                        'compare the filenames
                        'Performs a text comparison, based on a case-insensitive text sort order
                        'If strings equal returns 0
                        If StrComp(oOccFileName, oRowFileName, CompareMethod.Text)=0 Then 
                            'Get the value of Item from the Parts List
                            'Row name needs to be case sensitive or use 1 for first 2 for second etc.
                            oCell  = oPartsList.PartsListRows.Item(j).Item("ITEM") 
                   'Row name needs to be case sensitive or use 1 for first 2 for second etc.

                            'get the value of text in cell
                            Dim oItemValue As String
                            oItemValue = oCell.Value
                            
                            '------------change balloon value to Parts ONLY Item value
                            oBalloonValueSet.OverrideValue = oItemValue
                        
                        End If
                    'go to next row in table
                    Next
                    '----------end find item in parts list PARTS ONLY                
                    
                Next 'go to next attached balloon in set
            Catch'do nothing if error
            End Try
        End If 'end of search for Tags balloons
    Next
Next

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



Later,
ADS
photo credit: Donahos Balloons over Colorado (license)

Tuesday, 25 July 2017

Precise Circular Text Pattern

                Do you need a Precise Circular Text Pattern?

                I needed this the other day and I was a bit intrigued about the best workflow for this.



                I needed this the other day and I was a bit intrigued about the best workflow for this.

                My first thought was to do it with iFeatures. Create a prompted text iFeature and a pattern of sketch points and place this iFeature as many times as you need changing the text every time. 

                Whell... that didn’t work and I slowly realized that it will be very difficult to edit, not to mention the large number of features in the browser.

                Then I thought of doing it by creating them as separate features and wrap them to the part. This seemed complicated as well so I had a better idea.

                Create a text and emboss it to the face, except there is a trick here. In order to get exact spacing between first and last, you need to use “Exact Spacing” in the text editor.

                This way I can control the text size and yet still get precise placement.

                As always Inventor threw a spanner in the works because the exact spacing field text has only 2 (two) decimal settings and you can’t use parameter for an automatic update when you change drum diameter.

                This was still way better than any other solutions proving fast and simple.

                The original screencast can be seen here (includes commands and dialog boxes if the video bellow is not clear enough).




Later,

ADS


photo credit: Simon & His Camera Darkest Before Dawn by Simon & His Camera (license)