Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hole Feature sketch point IsParamOnFace not returning

3 REPLIES 3
Reply
Message 1 of 4
Dickerson2012
365 Views, 3 Replies

Hole Feature sketch point IsParamOnFace not returning

I am trying to deterimne if a hole feature sketch point is on the planar face. When I run this with a sketch that is not consumed by a Hole feature all returns correct. when I consume the same sketch with a hole feature it does not work correctly. Can anyone instruct me on why or what is incorrect below?

 

Public Sub CheckHolePoint()

    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.ActiveDocument
   
    ' Set a reference to the component definition.
    Dim oDef As PartComponentDefinition
    Set oDef = oPartDoc.ComponentDefinition
   
    Dim oSketch As PlanarSketch
    For Each oSketch In oPartDoc.ComponentDefinition.Sketches
        If TypeOf oSketch.PlanarEntity Is Face And (oSketch.Adaptive) Then
        Dim oFacePlane As Face
        Set oFacePlane = oSketch.PlanarEntity
        Dim oSKPoint As SketchPoint
        Dim oPoint As Point
        For Each oSKPoint In oSketch.SketchPoints
        Dim oSE As SurfaceEvaluator
        Set oSE = oFacePlane.Evaluator
        Dim oCords(1) As Double
        oCords(0) = oSKPoint.Geometry.X
        oCords(1) = oSKPoint.Geometry.Y
        Debug.Print "IsParam: " & oSE.IsParamOnFace(oCords)
        Next
        End If
    Next
   
End Sub

3 REPLIES 3
Message 2 of 4
wayne.brill
in reply to: Dickerson2012

HI,

 

I am able to recreate this behavior. I believe it is because the coordinates of the SketchPoint for a hole are in the middle of the hole once it is consumed and is not on the surface. You can test this by moving the coordinate tested with IsParamOnFace() so that it is not where the hole is. In my tests with my simple part I changed your code (oCords(0) = oSKPoint.Geometry.X + 0.5) and IsParamOnFace was then True.

 

I am not sure what your actual requirement is. There should be other ways to find out you need to know using some other approach. This VBA help example could be of interest: IsCylindricalFaceInterior(). Help on my system is here:

"C:\Program Files\Autodesk\Inventor 2014\Local Help\admapi_18_0.chm"

 

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
Dickerson2012
in reply to: wayne.brill

Wayne,

 

Thank you for the information, I have tested and am getting some True and some False based on the value I add to to the "X" point. Is the value relative to a given parameter (i.e. perpendicaluar to the centerline axis ). I am trying to determine if sketch points consumed by Adaptive Hole Features are located on the face that the sketch was modeled on. If they are not then move them back to the nearest edge.

 

Would another method be better?

 

Regards,

 

Nathaniel

Message 4 of 4
wayne.brill
in reply to: Dickerson2012

Hi Nathaniel,

 

I am not sure I understand this. Are moving sketch points the only way to achieve your requirement?

 

Can you provide a part or assembly that I could use to test? (you can use the case if you want to keep it private).

 

Maybe FindUsingRay or FindUsingVector would help find the edge.

 

Thanks,

Wayne

 

 

 

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report