Dim Errors in Model by VBA Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I am using below code to create a Rectangle 4 mm X 3 mm x 1 mm, I am using mm template but the model shows 40 mm X 30 mm x 10 mm.
Anything wrong in my code, please someone guide me to understand this type of situation.
Private Sub CommandButton1_Click()
Dim oProjectMgr As DesignProjectManager
Set oProjectMgr = ThisApplication.DesignProjectManager
Dim oTemplatesPath As String
oTemplatesPath = "C:\Program Files\Autodesk\Inventor 2009\Inventor 2009\Templates\FB\AES_Standard.ipt"
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, oTemplatesPath, True)
Dim oCompDef As PartComponentDefinition
Set oCompDef = oPartDoc.ComponentDefinition
Dim oSketch As PlanarSketch
Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes(3))
Dim oTransGeom As TransientGeometry
Set oTransGeom = ThisApplication.TransientGeometry
Dim oRectangleLines As SketchEntitiesEnumerator
Set oRectangleLines = oSketch.SketchLines.AddAsTwoPointRectangle( _
oTransGeom.CreatePoint2d(0,0), _
oTransGeom.CreatePoint2d(4,3))
Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid
Dim oExtrude As ExtrudeFeature
Set oExtrude = oCompDef.Features.ExtrudeFeatures.AddByDistanceExtent( _
oProfile, 1, kNegativeExtentDirection, kJoinOperation)
Thanks & Regards,
S.Sekar