AddBySilhouette troubles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to use the PlanarSketch.AddBySilhouette method to project a collection of faces found with AssemblyComponentDefinition.FindUsingRay, but I get an error when trying to create the sketch entity.
Has anyone successfully implemented this method? I can run the help file code example w/out error, but it's being used in a part document. Is it possible this just doesn't work at the assembly level? Forum search for AddBySilhouette pulls up absolutely nothing. Code below.
Dim oDoc As AssemblyDocument Set oDoc = ThisDocument Dim oACD As AssemblyComponentDefinition Set oACD = oDoc.ComponentDefinition Dim oTG As TransientGeometry Set oTG = ThisApplication.TransientGeometry Dim oSk As PlanarSketch Set oSk = oACD.Sketches.Item("Rotating Sketch") Dim oPart As ComponentOccurrence Dim oBody As SurfaceBody Dim startPt As Point Set startPt = oTG.CreatePoint(0, 0, 0) 'create a vector facing the sketch from the origin Dim oVecPt As WorkPoint Set oVecPt = oACD.WorkPoints.Item("VectorPoint") Dim pt As Point Set pt = oVecPt.Point Dim oVec As UnitVector Set oVec = oTG.CreateUnitVector(pt.X, pt.Y, pt.Z) Dim objCol As ObjectsEnumerator Dim ptCol As ObjectsEnumerator Call oACD.FindUsingRay(startPt, oVec, 1, objCol, ptCol, False) Dim proxPt As Point Dim oFoundItem As Object Dim oSkEnt As SketchEntity Dim oFace As Face For Each oFoundItem In objCol If oFoundItem.Type = kFaceProxyObject Then Set oFace = oFoundItem.NativeObject Set proxPt = oFace.PointOnFace ' ERROR GENERATED BY THE LINE BELOW Set oSkEnt = oSk.AddBySilhouette(oFace, proxPt) End If Next end Sub
My thoughts:
My use of the 'ProximityPoint' input could be blatantly wrong, I couldn't really glean its proper use from the code example.
or
Using the Face object in the method at the assembly level doesn't work (but neither does the FaceProxy object, unfortunately).
Appreciate any help. Thanks.