Placing iFeature using iLogic

Placing iFeature using iLogic

jesscadd
Advocate Advocate
1,721 Views
8 Replies
Message 1 of 9

Placing iFeature using iLogic

jesscadd
Advocate
Advocate

Ok,

 

I am still learning how to use iLogic, so bear with me. I have been able to find snippets from others that accomplish what I have done so far. This iFeature I have is really causing me some issues. When I run the iLogic, it allows me to pick the initial surface and the the 2 reference work planes. After that it fails. I know the iFeature works, because I can do it manually.  Please review the code and let me know where I have gone wrong.

The error says Member not found. I have attached pictures of the error as well as the iFeature.

Any help is really appreciated.

 

Public Sub Main()

        Dim oPartDoc As PartDocument
        oPartDoc = ThisApplication.ActiveDocument

        Dim oPartDef As PartComponentDefinition
        oPartDef = oPartDoc.ComponentDefinition

        ' Get the selected face to use as input for the iFeature.
        Dim oFace As Face
        oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select a planar face")

        'Get the XY Planes
        Dim oPlane1 As WorkPlane
        oPlane1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Select a XZ Plane")

        Dim oPlane2 As WorkPlane
        oPlane2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Select a YZ Plane")

        Dim oFeatures As PartFeatures
        oFeatures = oPartDef.Features

        ' Create an iFeatureDefinition object.
        Dim oiFeatureDef As iFeatureDefinition
        oiFeatureDef = oFeatures.iFeatures.CreateiFeatureDefinition(
        "\\Dse-eng\dse-cad\Inventor Files\Templates & Libraries\Catalog\DSE Features\Feature Specific\Button_Pwr_5Prog_UpDown.ide")

        ' Set the input.
        Dim oInput As iFeatureInput
        For Each oInput In oiFeatureDef.iFeatureInputs
            Dim oParamInput As iFeatureParameterInput

            Select Case oInput.Name
                Case "Sketch Plane1"
                    Dim oPlaneInput As iFeatureInput
                    'Dim oPlaneInput As iFeatureSketchPlaneInput
                    oPlaneInput = oInput
                    oPlaneInput.PlaneInput = oFace

                Case "XZPlane1"
                    Dim oPlaneInput As iFeatureWorkPlaneInput
                    'Dim oPlane1Input As iFeatureSketchPlaneInput
                    oPlaneInput = oInput
                    oPlaneInput.PlaneInput = oPlane1

                Case "YZPlane2"
                    Dim oPlaneInput As iFeatureWorkPlaneInput
                    'Dim oPlane1Input As iFeatureSketchPlaneInput
                    oPlaneInput = oInput
                    oPlaneInput.PlaneInput = oPlane2

                Case "PlaneOffset"
                    oParamInput = oInput
                    oParamInput.Expression = "-3.0 in"

            End Select
        Next

        ' Create the iFeature.
        Dim oiFeature As iFeature
        oiFeature = oFeatures.iFeatures.Add(oiFeatureDef)
    End Sub

 

 

 

 

 

0 Likes
Accepted solutions (1)
1,722 Views
8 Replies
Replies (8)
Message 2 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@jesscadd,

 

Can you please provide manually iFeature inserted part ? I mean, part with iFeature inserted manually. Please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 9

jesscadd
Advocate
Advocate

Chandra,

 

Here is the example file with the iFeature added manually.

0 Likes
Message 4 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@jesscadd,

 

Thanks for sample part,

 

I tried to place attached ifeature into sample part with no success. Steps that are followed to place is recorded in below screencast video and uploaded to below link.

 

https://autode.sk/2N0As5S

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 9

jesscadd
Advocate
Advocate

@chandra.shekar.g 

 

Place the feature on the Back Surface. be sure the plate is a minimum of 8" high or adjust the vertical dimension to 1 or 2"

0 Likes
Message 6 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@jesscadd,

 

Sorry to inform you that I tried with 10 in height part(Attached with this post). Still, unable to place iFeature into part.

 

Height.png

 

Can you please provide non confidential source part of iFeature to investigate?

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 7 of 9

jesscadd
Advocate
Advocate

@chandra.shekar.g 

 

Did you try to place on the BACK Plane? I just did it with your part file.

0 Likes
Message 8 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@jesscadd,

 

Thanks for suggestion,

 

Now, I am able to place iFeature into part. With the same example, tried below iLogic code and working also.

 

Public Sub Main()

        Dim oPartDoc As PartDocument
        oPartDoc = ThisApplication.ActiveDocument

        Dim oPartDef As PartComponentDefinition
         oPartDef = oPartDoc.ComponentDefinition

        ' Get the selected face to use as input for the iFeature.
        Dim oFace As Face
         oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select a planar face")

        'Get the XY Planes
        Dim oPlane1 As WorkPlane
         oPlane1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Select a XZ Plane")

        Dim oPlane2 As WorkPlane
        oPlane2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Select a YZ Plane")

        Dim oFeatures As PartFeatures
         oFeatures = oPartDef.Features

        ' Create an iFeatureDefinition object.
        Dim oiFeatureDef As iFeatureDefinition
         oiFeatureDef = oFeatures.iFeatures.CreateiFeatureDefinition("path of iFeature\Button_Pwr_5Prog_UpDown.ide")

        ' Set the input.
        Dim oInput As iFeatureInput
        For Each oInput In oiFeatureDef.iFeatureInputs
            Dim oParamInput As iFeatureParameterInput

            Select Case oInput.Name
                Case "Sketch Plane1"
                    Dim oPlaneInput As iFeatureWorkPlaneInput
                    'Dim oPlaneInput As iFeatureSketchPlaneInput
                    oPlaneInput = oInput
                    oPlaneInput.PlaneInput = oFace
					 
                Case "XZPlane1"
                    Dim oPlane1Input As iFeatureWorkPlaneInput
                    'Dim oPlane1Input As iFeatureSketchPlaneInput
                    oPlane1Input = oInput
                    oPlane1Input.PlaneInput = oPlane1
					 
                Case "YZPlane1"
                    Dim oPlane2Input As iFeatureWorkPlaneInput
                    'Dim oPlane1Input As iFeatureSketchPlaneInput
                    oPlane2Input = oInput
                    oPlane2Input.PlaneInput = oPlane2
					 
                Case "PlaneOffset"
                    oParamInput = oInput
                    oParamInput.Expression = "-3.0 in"
					 
            End Select
        Next
		 

        ' Create the iFeature.
        Dim oiFeature As iFeature
        oiFeature = oFeatures.iFeatures.Add(oiFeatureDef)
    End Sub

If it is working through UI, for the same selected planes iLogic code will work.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 9 of 9

jesscadd
Advocate
Advocate

@chandra.shekar.g 

Thank you so much. It works now. 

0 Likes