Message 1 of 2
Create new part, sketch and rectangle / circle

Not applicable
06-29-2014
06:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to make iLogic script what will create new part then sketch on plane based on user input, project axes and middle point, draw rectanlge or circle get dimmensions to it and make surface or extrusion. I can create new part, is it possible to create directly sheet metal part? make sketch based on user input but im stucked on projecting axes and creating rectanlge, getting various errors from compiler.
Any help would be appreccieted.
' Connect to a running instance of Inventor. Dim invApp As Inventor.Application invApp = System.Runtime.InteropServices.Marshal.GetActiveObject _ ("Inventor.Application") ' Get the Documents collection. Dim docs As Inventor.Documents = invApp.Documents ' Create a new part document. Dim partDoc As Inventor.PartDocument partDoc = docs.Add(Inventor.DocumentTypeEnum.kPartDocumentObject) ' Get the component definition. Dim partDef As Inventor.PartComponentDefinition partDef = partDoc.ComponentDefinition ' Get the X-Y work plane. Dim xyPlane As Inventor.WorkPlane = partDef.WorkPlanes.Item(3) ' Get the X-Y work plane. Dim xzPlane As Inventor.WorkPlane = partDef.WorkPlanes.Item(2) ' Get the X-Y work plane. Dim zyPlane As Inventor.WorkPlane = partDef.WorkPlanes.Item(1) ' Select work plane. Dim n As Integer 'n = InputBox("Vyberte pracovní rovinu" & " " & "XY = 3" & " " & "XZ = 2" & " " & "ZY = 1","iLogic Work Plane","") n = InputBox ("Vyberte pracovní rovinu: " & Name _ & vbLf & "XY = 3" & ShortName _ & vbLf & "XZ = 2" & Folder_Location _ & vbLf & "ZY = 1" & CurFileName, "iLogic Work Plane") ' Create a new sketch. Dim Sketch As Inventor.PlanarSketch Sketch = partDef.Sketches.Add(partDef.WorkPlanes.Item(n), False) ' Project the origin point onto the sketch. Dim oOriginSketchPoint As SketchPoint = Sketch.AddByProjectingEntity(PartDef.WorkPoints.Item(1))