How to use symmetricDimeter API

Valued Contributor
Valued Contributor

 

HI,

     I want to give symmetric diameter to a sketch, which I draw before revolving it along an axis. ie I use a revolved command.

The API is woking the way it is expected to work. Am I missing Somethin.

here is the code for it ..

    Dim LineAxis As Line2d

    ' *** creating a base revolved protrusion feature using igRight

' creating the reference axis and profile and validating it

Set objRPProfile = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objDoc.RefPlanes(1))

Set LineAxis = objRPProfile.Lines2d.AddBy2Points(X1:=-0.06, Y1:=0#, X2:=0.06, Y2:=0#)

Call objRPProfile.Relations2d.AddHorizontal(LineAxis, True)

'Set objLine2d11 = objAxis.Geometry

 

'Set objRPRAxis = objRPProfile.SetAxisOfRevolution(lineforaxis:=objRPProfile.Lines2d(1))

 

 

    ' Draw a rectangle for the profile graphics.

    Dim LineAB As Line2d

    Dim LineBC As Line2d

    Dim LineCD As Line2d

    Dim LineAD As Line2d

 

    Set LineAB = objRPProfile.Lines2d.AddBy2Points(0.023, 0.084, 0.023, 0.161)

 

    Set LineBC = objRPProfile.Lines2d.AddBy2Points(0.023, 0.161, -0.023, 0.161)

 

    Set LineCD = objRPProfile.Lines2d.AddBy2Points(-0.023, 0.161, -0.023, 0.084)

 

    Set LineAD = objRPProfile.Lines2d.AddBy2Points(0.023, 0.084, -0.023, 0.084)

    Call objRPProfile.Relations2d.AddKeypoint(LineAB, igLineStart, LineBC, igLineStart, True)

    Call objRPProfile.Relations2d.AddKeypoint(LineBC, igLineEnd, LineCD, igLineStart, True)

    Call objRPProfile.Relations2d.AddKeypoint(LineCD, igLineEnd, LineAD, igLineStart, True)

    Call objRPProfile.Relations2d.AddKeypoint(LineAB, igLineEnd, LineAD, igLineEnd, True)

 

    Call objRPProfile.Relations2d.AddVerticalAlign(LineAD, igLineMiddle, _

                                                   objLine2d11, igLineStart, True)

 

 

    'objProfiles(1).Visible = False

    ' End and validate the profile.

    lngStatus = objRPProfile.End(ValidationCriteria:=igProfileClosed)

    If lngStatus 0 Then

        MsgBox "Invalid Profile"

        Exit Sub

    End If

 

' creating the revolved protrusion feature

    Set objRPProfArray(1) = objRPProfile

    Set objModel = objDoc.Models.AddFiniteRevolvedProtrusion(NumberOfProfiles:=1, _

    ProfileArray:=objRPProfArray, ReferenceAxis:=objRPRAxis, _

    ProfilePlaneSide:=igRight, AngleOfRevolution:=2 * PI)

    'Turn off the profile

    objRPProfile.Visible = False

 

    Set objDimension = objRPProfile.Dimensions.AddSymmetricalDiameter( _

                                  LineAD, 0.023, 0.084, 0#, False, objRPProfile.Lines2d(1), 0.06, 0#, 0#, False)

''    objDimension.OriginLineDirection = True  ###shows error here so commented

    objDimension.TrackDistance = 0.08

    objDimension.Constraint = True

    Set objDimension = Nothing

 

    Set objDimension = objRPProfile.Dimensions.AddSymmetricalDiameter( _

                                 LineBC, 0.023, 0.161, 0#, True, objRPProfile.Lines2d(1), 0.06, 0#, 0#, True)

   '' objDimension.OriginLineDirection = False

    objDimension.TrackDistance = 0.08

    objDimension.Constraint = True

    Set objDimension = Nothing

am I missing anything.....

 

Posted by: Pritam Dulam
Post date: 9/22/2009 11:49:48 PM