Message 1 of 1
Difficulty Placing iFeature Containing two planes and a point
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have already developed most of the code, It however just keeps throwing COM errors. Here is the code:
Public Sub Main() Dim oPartDoc As PartDocument oPartDoc = ThisApplication.ActiveDocument Dim oPartDef As PartComponentDefinition oPartDef = oPartDoc.ComponentDefinition 'Dim oSketch As PlanarSketch = oPartDef.Sketches.Item("Placement 2") 'Dim oPoint As SketchPoint = oSketch.SketchPoints.Item(1) 'Dim oPlane As WorkPlane = oPartDef.WorkPlanes.Item("Placement 1") Dim oFace1 As Face Dim oFace2 As Face Dim oPoint As SketchPoint oPoint = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchPointFilter, "Select Select Point") oFace1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select Face of CAM Connector Hole") oFace2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select Connecting Plane") Dim oFeatures As PartFeatures oFeatures = oPartDef.Features ' Create an iFeatureDefinition object. Dim oiFeatureDef As iFeatureDefinition oiFeatureDef = oFeatures.iFeatures.CreateiFeatureDefinition("C:\iFeatures\CAM CONNECTOR") ' Set the input. Dim oInput As iFeatureInput For Each oInput In oiFeatureDef.iFeatureInputs Select Case oInput.Name Case "Point" Dim oPoint1Input As iFeatureEntityInput oPoint1Input = oInput oPoint1Input.Entity = oPoint Case "Face" Dim oPlane1Input As iFeatureWorkPlaneInput oPlane1Input = oInput oPlane1Input.PlaneInput = oFace1 Case "Plane" Dim oPlane2Input As iFeatureWorkPlaneInput oPlane2Input = oInput oPlane2Input.PlaneInput = oFace2 End Select Next 'Create the iFeature. Dim oiFeature As iFeature oiFeature = oFeatures.iFeatures.Add(oiFeatureDef) End Sub
It always hooks on either line 41:
oPlane1Input = oInput
Or Line 45:
oPlane2Input = oInput
I Thought this might be caused by there being a difference between a iFeatureWORKplane and an iFeatureSKETCHplane but changing that makes no difference.
Does anyone know whats wrong with this? Can iLogic with iFeautres not take more than two of a similar input?