Reply

Help with AddTangentToCylinderOrConeAtKeyPoint Plane Creation

I am having trouble with creating a plane using AddTangentToCylinderOrConeAtKeyPoint in a VBA script, and I can't find any examples of this method.  I am trying to troubleshoot, but there are parameters in the method that I do not understand.

 

1. ParentPlane: Is this a plane normal to the axis of the cylinder?

2. XaxisAngle: Why is an angle required for creation through a point? I have igNone specified.

3. ExtentSide: ?  Again, igNone specified.

 

Basically just guessing......

 

A snippet of the code is shown below.  The minimum distance command is used to find the closest face, which is the cylinder.


Call objPartDoc.MinimumDistance(objRef1, objRef2, Distance, dblPoint1, dblPoint2) MinDist = Distance
Set objClosestFace = objRef2
dblPointonFace = dblPoint2
'Closest Face found but what type of face is it? 'igBody 167551091 GNT Type - Body
'igBSplineSurface 1465959633 GNT Type - BSplineSurface
'igCone -114972031 GNT Type - Cone
'igCurveBody -1020639371 GNT Type - CurveBody
'igCurvePath -1020639369 GNT Type - CurvePath
'igCylinder -114972029 GNT Type - Cylinder
'igFace 167551075 GNT Type - Face
'igPlane -1909484335 GNT Type - Plane
'igShell 167551088 GNT Type - Shell
'igSphere -114972027 GNT Type - Sphere
'igTorus -114972025 GNT Type - Torus FaceType = objClosestFace.Type
MsgBox ("Minimum distance between the elements is " + CStr(MinDist))
MsgBox ("Facetype is " + CStr(FaceType)) Set objSketch3D = objPartDoc.Sketches3D.Add()
Set objPoints3D = objSketch3D.Points3D
Set objPoint3D = objPoints3D.Add(3, dblPointonFace) 'this works Set refPlanes = objPartDoc.refPlanes Set refPlane = refPlanes.AddTangentToCylinderOrConeAtKeyPoint(Face:=objClosestFace, parentplane:=objCSPlane, keypoint:=objPoint3D, KeyPointTypeconstant:=igKeyPointPointOnly, XaxisAngle:=igNone, ExtentSide:=igNone, normalOrientation:=igTangentToSurfaceAtKeypoint, local:=False)

 

MsgBox ("Facetype is " + CStr(FaceType)) reports the face type as 167551075 (a "face", not a cylinder as expected).

 

The specific error I get when executing this code is:"Method 'AddTangentToCylinderOrConeAtKeyPoint' of object 'RefPlanes' failed"

 

Can anyone offer any suggestions?

 

Thanks!

 

Scott_R