Friday, July 12, 2013

Inventor HSM Express – The Free CAM Solution for Inventor Users – Beta Invitation

Issue:
You're looking for an integrated CAM solution to use with Autodesk Inventor.



Potential Solution:
Check out the Inventor HSM Express Beta tools.



From the Autodesk CAM Team:
The Autodesk CAM Team has launched the official Public Beta of Inventor HSM Express, a free 2-1/2 Axis CAM solution for Inventor users.

Powered by HSMWorks CAM technology, Inventor HSM Express has all the capabilities of HSMXpress – the Free CAM Solution for SolidWorks and is seamlessly integrated inside the design environment of Autodesk Inventor. This integration allows Inventor users to take advantage of workflow and tools they are used to when programming CNC toolpaths for their 2.5D machining projects.

If you are an experienced Inventor user we could really use your help. Our goal is to have a CAM solution so tightly integrated with Inventor that you don’t perceive any difference when switching between the   modeling environment and the CAM environment. Your feedback is crucial in helping us achieve this goal. And, for those of you with CNC programming experience, we would love to hear your first impressions in working with our new CAM tools.

If you'd like  to participate in our Beta but don’t have Autodesk Inventor you can download a 30-day trial at this link: http://www.autodesk.com/products/autodesk-inventor-family/free-trial

To participate in the Inventor HSM Express Beta and watch a quick preview of Inventor HSM Express, you can visit this link: https://beta.autodesk.com/callout/?callid=22396638F5374AC28E2F1A24CC7EEFA8

Wednesday, July 3, 2013

Ilogic - Add Standard Virtual Parts From a Text File



Issue:
You have a number of standard Virtual parts that you find yourself adding over and over. You'd like to have the ability to add them based on a predefined list.



Solution:
Here is an example iLogic rule that will read a *.txt file and present the contents to the user in an input box list. The user is then asked to enter a quantity for the virtual part, and then the virtual part occurrences are added to the assembly. If one or more occurrences of the virtual part exist in the assembly, the iLogic rule deletes them and just adds back the total number needed.

(update: see also iLogic - Add Standard Virtual Parts From an Excel File or a similar solution)

An example text file list

The list presented to the user in an input list box.

 
The input box presented to the user to set the quantity.

The virtual parts added to the assembly.

Adjusting the quantity.

The iLogic rule deletes the original 18 occurrences and just adds back the number specified.
 Here is the example iLogic rule:
(special thanks to Brian Ekins for the code he posted at this link.)






Imports System.IO
'open and read a text file
Dim oRead As New StreamReader("U:\iLogic examples\Virtual Part List.txt")
Dim sLine As String = ""
Dim MyArrayList As New ArrayList

'build list from text file
Do
    sLine = oRead.ReadLine()
    If Not sLine Is Nothing Then
        MyArrayList.Add(sLine)
    End If
Loop Until sLine Is Nothing
oRead.Close()

'get user input from list
sVirtPart = InputListBox("Select a virtual part to add.", _
MyArrayList, MyArrayList.Item(0), "iLogic", "Standard Virtual Parts")

'check for empty input
'in the case where the user
'cancels out of the input box
If sVirtPart = "" Then
Return 'end rule
Else
End if

'get quantity from user
iQTY = InputBox("Enter the TOTAL number of:" _
& vblf & "        ''" & sVirtPart & "''" _
& vblf & "to place in the assembly." _
& vblf &  vblf & "Note: Enter 0 to delete all existing instances.", "iLogic", "1")

'check for empty input
'in the case where the user
'cancels out of the input box
If iQTY = "" Then
Return 'end rule
Else
End if

'define assembly
Dim asmDoc As AssemblyDocument
asmDoc = ThisApplication.ActiveDocument
'define assembly Component Definition
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all of the occurrences in the assembly
Dim asmOcc As ComponentOccurrence
For Each asmOcc  In oAsmCompDef.Occurrences
                'get name of occurence only (sees only everything left of the colon)
                Dim oOcc As Object
            oOcc = asmOcc.name.Split(":")(0)
            'look at only virtual components
                If TypeOf asmOcc.Definition Is VirtualComponentDefinition Then
                        'compare name selected from list to the
                                'existing virtual parts
                                If oOcc = sVirtPart Then
                        'delete existing virtual parts if name matches
                                asmOcc.delete
                                Else
                        End if
            Else
            End If
Next
  
Dim occs As ComponentOccurrences
occs = asmDoc.ComponentDefinition.Occurrences
  
Dim identity As Matrix
identity = ThisApplication.TransientGeometry.CreateMatrix
 
'create first instance of the virtual part
Dim virtOcc As ComponentOccurrence
if  iQTY >= 1 Then
virtOcc = occs.AddVirtual(sVirtPart, identity)
Else
Return
End if

'add next instance starting at instance2 (if applicable)
Dim index As Integer
index = 2
Do While index <= iQTY
occs.AddByComponentDefinition(virtOcc.Definition, identity)
index += 1
Loop