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.



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.




                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.


               

                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