Message 1 of 3
Having Extrude problems !

Not applicable
05-29-2010
09:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am very new at programming. I have been trying to get the below code to work. The code first opens a new part file. It then opens a sketch. It then creates a work plane .5 inch away from plane 3. It then draws a rectangle 2 X .2 inches and finally tries to extrude it. Everything seems to work except the extrude part.
Thank you for your time
WailGM
Private sub UserButtonz1_Click()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.Documents.Add(kPartDocumentObject, ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
Dim oPartCompDef As PartComponentDefinition
Set oPartCompDef = oDoc.ComponentDefinition
Dim oSketch As PlanarSketch
Set oSketch = oPartCompDef.Sketches.Add(oPartCompDef.WorkPlanes.Item(3))
Dim oWPlane As WorkPlane
Set oWPlane = oPartCompDef.WorkPlanes.AddByPlaneAndOffset(oPartCompDef.WorkPlanes(3), (.5 * 2.54))
Set oSketch = oPartCompDef.Sketches.Add(oWPlane)
Call oSketch.SketchLines.AddAsTwoPointRectangle(oTg.CreatePoint2d(0, 0), oTg.CreatePoint2d(.2 * 2.54, 2 * 2.54))
Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid
Dim oExtrude As ExtrudeFeature
Set oExtrude = oPartCompDef.Features.ExtendFeatures.AddByDistanceExtent(oProfile, 1 * 2.54, kPositiveExtentDirection, kJoinOperation)
End sub
I am very new at programming. I have been trying to get the below code to work. The code first opens a new part file. It then opens a sketch. It then creates a work plane .5 inch away from plane 3. It then draws a rectangle 2 X .2 inches and finally tries to extrude it. Everything seems to work except the extrude part.
Thank you for your time
WailGM
Private sub UserButtonz1_Click()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.Documents.Add(kPartDocumentObject, ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
Dim oPartCompDef As PartComponentDefinition
Set oPartCompDef = oDoc.ComponentDefinition
Dim oSketch As PlanarSketch
Set oSketch = oPartCompDef.Sketches.Add(oPartCompDef.WorkPlanes.Item(3))
Dim oWPlane As WorkPlane
Set oWPlane = oPartCompDef.WorkPlanes.AddByPlaneAndOffset(oPartCompDef.WorkPlanes(3), (.5 * 2.54))
Set oSketch = oPartCompDef.Sketches.Add(oWPlane)
Call oSketch.SketchLines.AddAsTwoPointRectangle(oTg.CreatePoint2d(0, 0), oTg.CreatePoint2d(.2 * 2.54, 2 * 2.54))
Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid
Dim oExtrude As ExtrudeFeature
Set oExtrude = oPartCompDef.Features.ExtendFeatures.AddByDistanceExtent(oProfile, 1 * 2.54, kPositiveExtentDirection, kJoinOperation)
End sub