You are on page 1of 4

Deze site gebruikt cookies van Google om services te leveren, advertenties te personaliseren en verkeer te

analyseren. Informatie over je gebruik van deze site wordt gedeeld met Google. Als je deze site gebruikt, ga je
From the Trenches with Autodesk Inventor
akkoord met het gebruik van cookies.
MEER INFORMATIE IK SNAP HET
Tips, tricks & solutions from daily life with Inventor

Home Inventor Tutorials Inventor Links Mastering Inventor Companion Files

Wednesday, July 3, 2013 Translate This Site

Ilogic - Add Standard Virtual Parts From a Text File Select Language
Powered by Translate

Issue:
You have a number of standard Virtual parts that you find yourself adding over and over. You'd like to About Me
have the ability to add them based on a predefined list.
Curtis Waguespack
I've used Inventor daily, “in the
trenches” of a real world
design environment. I've also
used AutoCAD and Inventor to
design a wide range of manufactured
products in the past. In addition to this real
world experience I’ve written and co
written multiple editions of the Mastering
Autodesk Inventor series and have taught
Inventor to professionals in the classroom.
I hope to share some of the useful tips and
tricks I've learned in the past and stumble
across in the future on this blog.
View my complete profile

Mastering Autodesk Inventor


Series Books

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)

Looking for a Book on Inventor? Click the


image above to follow the link.

Search This Blog

Search

An example text file list


Popular Subjects on this Blog

Autodesk Inventor iLogic (46)

Inventor IDW (5)

Autodesk Inventor Frame Generator (4)

Sketch (4)

Autodesk Inventor iProperties (2)


Subscribe To From the Trenches

Posts

Comments

Archives (What did you miss?)

► 2017 (2)
► 2014 (7)
▼ 2013 (10)
► October (1)
► August (1)
The list presented to the user in an input list box.
▼ July (3)
Ilogic - Add Standard Virtual
Parts From an Excel ...
Inventor HSM Express – The
Free CAM Solution for I...
Ilogic - Add Standard Virtual
Parts From a Text Fi...

► March (2)
► February (1)
► January (2)
The input box presented to the user to set the quantity.
► 2012 (16)
► 2011 (73)

Popular Posts

Part Modeling Practice


Drawings for Inventor
Are you looking for a few
dimensioned drawings to
practice your Inventor
modeling with? I've put together 24 sheets
of detailed ...

Understanding Autodesk
Inventor Frame Generator,
Bill Of Materials and Part
Numbers
Issue: With the help of the
Frame Generator you've used Inventor to
successfully design a frame. The problem
is in the way that Invento...

Understanding Bend
Allowance and Bend
Dedcution in Inventor
Issue: You want to better
understand the difference
between Bend Allowance and Bend
Deduction and how they relate to Inventor
sheet metal p...

Inventor 101: Simple Fully


Constrained Sketches
Issue: You've been using
Inventor for a while now, but
you find it frustrating and find
yourself spending almost as much time
fixing yo...

iLogic To Save PDF Files To a New


Subfolder
The virtual parts added to the assembly. Issue: You want to save a
PDF of each Inventor
drawing file in a PDF folder
based on the path of the the
current drawing file. You'd
al...

Inventor Background Color


as White: Improved
Issue: You'd like to use a
solid white back ground in
Inventor because it allows
you to take quick screen captures for use
Adjusting the quantity. in il...

Change The Origin of an


Imported Model
Issue: You've imported a part
model from a STEP, IGES or
some other file format, but
find that it was not modeled about the part
0,0,0 ...

Built for Speed: Running


iLogic Rules Automatically
When Saved, For New and
Existing (pre-iLogic) Inventor
Files
Issue: You've created what is possibly the
best collection of iLogic rules ever! And
you'd like the rules to run on your existing
p...

Where are the Inventor 2012


Tutorial and Help Files?
Issue: You've installed
Inventor 2012 (or a later
version) and everything went
well. But for some reason the help files
and tutorials f...

Using Excel and iLogic to


The iLogic rule deletes the original 18 occurrences and just adds back the number specified. Retrieve Part Numbers From
a Drawing Log
Here is the example iLogic rule: Issue: Because you don't use
(special thanks to Brian Ekins for the code he posted at this link.) Vault and don't use an MRP
or ERP system you utilize a simple
spreadsheet as a part number log to
reco...

Imports System.IO Autodesk Inventor Forum Topics


'open and read a text file
Dim oRead As New StreamReader("U:\iLogic examples\Virtual Part List.txt") How to make a trim between two surfaces
Dim sLine As String = "" with VBA? - andresmpajaro
Dim MyArrayList As New ArrayList
How to do a Trim Surface operation
'build list from text file between two surfaces in
Do vba? - andresmpajaro
    sLine = oRead.ReadLine()
    If Not sLine Is Nothing Then
Normalizing Imported Models in Inventor
        MyArrayList.Add(sLine)
    End If 2019 - tts197
Loop Until sLine Is Nothing
oRead.Close() Problems creating runoff for
mold - jdoty36287
'get user input from list
sVirtPart = InputListBox("Select a virtual part to add.", _ Inventor View 2019 inventorview.exe
MyArrayList, MyArrayList.Item(0), "iLogic", "Standard Virtual Parts") process stays running after closing the
gui - nlbisd
'check for empty input
'in the case where the user
'cancels out of the input box
If sVirtPart = "" Then
Return 'end rule Autodesk Inventor Customization
Else Forum Topics
End if
Не могу активизировать продукт.
'get quantity from user возникает ошибка. - korobeynikova909
iQTY = InputBox("Enter the TOTAL number of:" _
& vblf & "        ''" & sVirtPart & "''" _ Sheet Metal Rule Error - lAkleinsasser
& vblf & "to place in the assembly." _
& vblf &  vblf & "Note: Enter 0 to delete all existing instances.", "iLogic", "1")
'check for empty input How to make a trim between surfaces with
'in the case where the user VBA for Inventor? - andresmpajaro
'cancels out of the input box
If iQTY = "" Then Suppress a linked parameter in a
Return 'end rule part - tmayesPUD23
Else
End if Set Joint Angular Limits ilogic - jzcrouse

'define assembly
Dim asmDoc As AssemblyDocument
asmDoc = ThisApplication.ActiveDocument
'define assembly Component Definition
Dim oAsmCompDef As AssemblyComponentDefinition Last 12 Posts
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

Labels: Autodesk Inventor iLogic

Newer Post Home Older Post

View mobile version

Powered by Blogger.