Making A L profile with face feature

Making A L profile with face feature

Anonymous
Not applicable
416 Views
4 Replies
Message 1 of 5

Making A L profile with face feature

Anonymous
Not applicable
Hi,

I am new to using and making macro's
I have the folowing problem.
I am trying to make a macro that creates a Sheetmetal L-Profile.
3 parameters that I use in a form will create the shape.
But i am using a second face for the flange
The second face is flipped the wrong direction. so my dimensions aren't right.
I hope someone can help me
Here you have the code:

thanks



Private Sub Btn1_Click()


Dim dblL As Double
Dim dblB As Double
Dim dblF1 As Double


dblL = CDbl(TxtL.Text)
dblB = CDbl(TxtB.Text)
dblF1 = CDbl(TxtF1.Text)
'dblTh = CDbl(TxtTh.Text)

' Create a new sheet metal document, using the default sheet metal template.
Dim oSheetMetalDoc As PartDocument
Set oSheetMetalDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject, , , "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"))

' Set a reference to the component definition.
Dim oCompDef As SheetMetalComponentDefinition
Set oCompDef = oSheetMetalDoc.ComponentDefinition

' Set a reference to the sheet metal features collection.
Dim oSheetMetalFeatures As SheetMetalFeatures
Set oSheetMetalFeatures = oCompDef.Features

' Create a new sketch on the X-Y work plane.
Dim oSketch As PlanarSketch
Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes.Item(3))

' Set a reference to the transient geometry object.
Dim oTransGeom As TransientGeometry
Set oTransGeom = ThisApplication.TransientGeometry

' Draw a 4cm x 3cm rectangle with the corner at (0,0)
Call oSketch.SketchLines.AddAsTwoPointRectangle( _
oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d((dblL / 10), (dblB / 10)))

' Create a profile.
Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid

Dim oFaceFeatureDefinition As FaceFeatureDefinition
Set oFaceFeatureDefinition = oSheetMetalFeatures.FaceFeatures.CreateFaceFeatureDefinition(oProfile)

' Create a face feature.
Dim oFaceFeature As FaceFeature
Set oFaceFeature = oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition)

' Get the top face for creating the new sketch.
' We'll assume that the 6th face is the top face.
Dim oFrontFace As Face
Set oFrontFace = oFaceFeature.Faces.Item(4)

' Create a new sketch on this face, but use the method that allows you to
' control the orientation and orgin of the new sketch.
Set oSketch2 = oCompDef.Sketches.AddWithOrientation(oFrontFace, _
oCompDef.WorkAxes.Item(1), True, True, oCompDef.WorkPoints(1))

' Draw a 4cm x 3cm rectangle with the corner at (0,0)
Call oSketch2.SketchLines.AddAsTwoPointRectangle( _
oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d(dblL / 10, dblF1 / 10))

' Create a profile.
Dim oProfile1 As Profile
Set oProfile1 = oSketch2.Profiles.AddForSolid

Dim oFaceFeatureDefinition1 As FaceFeatureDefinition
Set oFaceFeatureDefinition1 = oSheetMetalFeatures.FaceFeatures.CreateFaceFeatureDefinition(oProfile1)

' Create a face feature.
Dim oFaceFeature1 As FaceFeature
Set oFaceFeature1 = oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition1)

End Sub




Private Sub Label1_Click()

End Sub

Private Sub UserForm_Click()

End Sub Edited by: DennisVercauteren on Aug 20, 2009 12:36 PM
0 Likes
417 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Do you mean the sketch is offset in the wrong direction when creating the
face feature? If so, you can use the FaceFeatureDefinition.Direction
property to control that direction.

Sanjay-


Dim oFaceFeatureDefinition1 As FaceFeatureDefinition
Set oFaceFeatureDefinition1 =
oSheetMetalFeatures.FaceFeatures.CreateFaceFeatureDefinition(oProfile1)

oFaceFeatureDefinition1.Direction = kNegativeExtentDirection

' Create a face feature.
Dim oFaceFeature1 As FaceFeature
Set oFaceFeature1 =
oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition1)
0 Likes
Message 3 of 5

Anonymous
Not applicable
yes, that's what I meant Sanjay
In this way it is possible to put a flange (with the face feature) to my sheet metal part
The idea i want to create is a form to make several standard Sheetmetal plates.
a face with 1, 2, 3 or 4 flanges is the first objective.
I don't know for sure if I am right, butt I've read that the Flange Feature is snot supported.
outherwise the solution would be "easy" 🙂

thanks for your help

it has brought a huge step forward
0 Likes
Message 4 of 5

Anonymous
Not applicable
Correct, creation of flange features is not currently supported thru the
API. This is high on our priorities for a future release.

Sanjay-
0 Likes
Message 5 of 5

Anonymous
Not applicable
Thanks Again.
Actualy, I've made my L-profile generator.
Now i want to take it a step forward and I am allready stuck.
Is it possible to see whats the face order for my model.
Ive found out that its starting from right to left. butt whats te order if a model is more complex ? *

gr Dennis
0 Likes