Creation of Part using iLogic

Creation of Part using iLogic

Anonymous
Not applicable
1,862 Views
2 Replies
Message 1 of 3

Creation of Part using iLogic

Anonymous
Not applicable

Hello, first I would like to say thank you for taking the time again this year to answer our questions, last year I found it extremely valuable.

I have a need to create a large batch of .ipt's from a base ipt. The need specifically is for identification stencils that are a sheetmetal part (with an extrusion that is text) that we export as a DXF so that we can cut it on our CNC Machine. The problem is sometimes we need 50 stencils that have the same base but a different ID number on the end. Example "STENCIL ID - 01 , STENCIL ID - 02, STENCIL ID - 03......

 

The current process that I use would be to create my base part that has the ilogic and form in it to replace the ID number ("01"). I use the form to change the ID number, I then export the DXF of the sheetmetal, save, check into the vault and then, Save As my next .ipt ("02")

 

As you can imagine this is a bit of a time consuming process and I am aiming to automate it in any way I can. The ideal process would be to open an excel file and input my values. Then open a base iam and use iLogic to read from the excel file which would tell how many ipt's I would need to create and change the text inside each file based on the excel. I have a firm grasp on using excel and iLogic but I am unsure if I can use iLogic to create new ipt's inside an iam. Then I could export all 50 ipt DXF's at the same time as well as saving and checking into the vault.

 

Hopefully this makes sense and someone may have an example of part creation inside an assy. Thanks in advance! 

0 Likes
Accepted solutions (1)
1,863 Views
2 Replies
Replies (2)
Message 2 of 3

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

iLogic is based on Inventor API. So you could just use Inventor API within iLogic. e.g. the code below is what I made and translated from VBA. It assumes an assembly document is current document. Then it will create a new part, add a block, then insert this part to the assembly. 

 

hope it could give you an idea how to start for your requirement. 

 

    Dim oAssDoc As AssemblyDocument
    oAssDoc = ThisApplication.ActiveDocument
    
     Dim oAssDef As AssemblyComponentDefinition
     oAssDef = oAssDoc.ComponentDefinition
    
    Dim oNewPart As PartDocument
     oNewPart = ThisApplication.Documents.Add(kPartDocumentObject, , False)
    
    Dim oNewPartDef As PartComponentDefinition
     oNewPartDef = oNewPart.ComponentDefinition
    
    'do what you need to create in this part
    'e.g. create a block
    
    Dim oTG As TransientGeometry
     oTG = ThisApplication.TransientGeometry
    
    Dim oSketch As PlanarSketch
     oSketch = oNewPartDef.Sketches.Add(oNewPartDef.WorkPlanes(1))
    
    Call oSketch.SketchLines.AddAsTwoPointRectangle(oTG.CreatePoint2d(0, 0), oTG.CreatePoint2d(10, 10))
    
    Dim oProfile As Profile
     oProfile = oSketch.Profiles.AddForSolid()
    
    Dim oExtrudeDef As ExtrudeDefinition
     oExtrudeDef = oNewPartDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, kJoinOperation)
    
    Call oExtrudeDef.SetDistanceExtent(1#, kPositiveExtentDirection)
    
    Call oNewPartDef.Features.ExtrudeFeatures.Add(oExtrudeDef)
    
    'place without any transformation
    'can adjust the matrix with your requirement
    Dim oMartrix As Matrix
    oMatrix = ThisApplication.TransientGeometry.CreateMatrix()
    
    'add the new part to the assembly
    Dim oNewOcc As ComponentOccurrence
    oNewOcc = oAssDef.Occurrences.AddByComponentDefinition(oNewPartDef, oMatrix)
    
     
    
 
Message 3 of 3

Anonymous
Not applicable

Excuse me, is it possible to create a sheet metal part with your answer ?. Thank you! Sorry by my bad english.

0 Likes