Placing iFeature with Ilogic (Planes and Points) (Solids)

Placing iFeature with Ilogic (Planes and Points) (Solids)

C_Haines_ENG
Collaborator Collaborator
133 Views
0 Replies
Message 1 of 1

Placing iFeature with Ilogic (Planes and Points) (Solids)

C_Haines_ENG
Collaborator
Collaborator

I cannot seem to figure out placing iFeatures with iLogic, I have rewritten and changed this code a number of times but still absolutely no progress, as well I cant see anything about selecting multiple solid bodies and including that in the ifeature input. Heres the code below:

 

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:\CAM CONNECTOR.ide")
		
        ' 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

 I have also included the CAM connector im trying to use, maybe something about how theyre created dramatically effects how the code works? See also the image below for the kind of situation, first the point in the middle would be clicked, then the flat plane and then the vertical plane.

 

chainesL5H3G_0-1682344310518.png

 

0 Likes
134 Views
0 Replies
Replies (0)