[Add In Programming] Trouble with making automatic face on sketch

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've recently started making an addin, for making easy parts at my company.
I want the project to do a couple of things:
- Make new part (DONE)
- Make it a sheet metal part (DONE)
- Make sketch in said part (DONE)
- Draw rectangle from input (DONE)
- Make a face on said sketch (This is where I'm having trouble)
In the future I will need it so make flanges by input (different angles, and length.)
And making DXF file of the unfolded part, and saving it to location.
Where I'm having trouble right now is with the face part.
The writing is in danish but translated it says
"The public member 'FaceFeatures' in type
'SheetMetalComponentDefinition' was not found."
Public Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click
Dim invApp As Inventor.Application
invApp = System.Runtime.InteropServices.Marshal.GetActiveObject _
("Inventor.Application")
Dim docs As Inventor.Documents
docs = invApp.Documents
Dim partDoc As Inventor.PartDocument
partDoc = docs.Add(Inventor.DocumentTypeEnum.kPartDocumentObject)
partDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
Dim partDef As Inventor.SheetMetalComponentDefinition
partDef = partDoc.ComponentDefinition
Dim oSheetMetalFeatures As SheetMetalFeatures
oSheetMetalFeatures = partDef.Features
Dim oUnit As UnitsTypeEnum
oUnit = UnitsTypeEnum.kMillimeterLengthUnits
partDoc.UnitsOfMeasure.LengthUnits = oUnit
'...................................................'
Dim xyPlane As Inventor.WorkPlane = partDef.WorkPlanes.Item(3)
Dim sketch1 As Inventor.PlanarSketch
sketch1 = partDef.Sketches.Add(xyPlane, False)
'...................................................'
Dim oTransGeom As TransientGeometry
oTransGeom = g_inventorApplication.TransientGeometry
Dim oLength As Integer = Convert.ToInt32(tLength.Text)
Dim oWidth As Integer = Convert.ToInt32(tWidth.Text)
Dim oHeigth As Integer = Convert.ToInt32(tHeight.Text)
Call sketch1.SketchLines.AddAsTwoPointRectangle(
oTransGeom.CreatePoint2d(0, 0),
oTransGeom.CreatePoint2d((oLength / 10), (oWidth / 10)))
Dim oProfile As Profile
oProfile = sketch1.Profiles.AddForSolid
Dim oFaceFeatureDefinition As FaceFeatureDefinition
oFaceFeatureDefinition = partDef.FaceFeatures.CreateFaceFeatureDefinition(oProfile)
Dim oFaceFeature As FaceFeature
oFaceFeature = oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition)
End Sub
Thats my code.
I've looked up a lot of the samples on website: http://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=GUID-1A2151F4-59B8-4F3E-B704-F0F6FFFAE38E
And I've changed the code to work in VB.NET, but it seems like a lot of the samples are a bit outdated(might be wrong there, as it has worked with some tweaks.)
Anybody who've had any luck with the kind of things? That could maybe lead me into the right direction.
Note I'm not really a programmer by any means, I've done some programming in C#, but most of what I make right
now is done by looking up a lot of things.