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: 

IV2015 - Take Hole Diameter Precision from Model in a Hole Table?

5 REPLIES 5
Reply
Message 1 of 6
tdswanson
1040 Views, 5 Replies

IV2015 - Take Hole Diameter Precision from Model in a Hole Table?

Hey everyone:

 

I'm trying to figure out how to do something with less manual intervention.  I draw a lot of fixturing components which will have a large number of holes, tapped, bolt clearance, dowel slip-fit, dowel press-fit, etc.  

 

When I draw the models, I generally use the "canned" hole features from Inventor for holes for bolt clearances and tapped holes.  For dowel SF, I'll actually draw a hole at a clearance size, like 0.377" for a 3/8" dowel and tolerance it appropriately.  For dowel PF, I usually use limits and fits, like 0.3750 h5 for a dowel PF.  For these, I'll actually go to the tolerance menu for the hole (in the model) and set it specifically to four decimals (0.0000) and set the tolerance, like to an h5 for example.

 

When I make a drawing and add a hole table, I use the option that says "use part tolerance" on all hole types.

 

The trouble is, the hole table doesn't take the model's PRECISION, but it does take the tolerance.  Here's an example:

 

Add a clearance hole for a 5/16" screw to a part model.  I could even change the diameter precision from "0.000" to "0.00" in the tolerance screen for the hole.  The diameter will most likely be something like 0.332", which two decimal places should display as "0.33".  The "hole type" would just be "Thru".

 

Add a PF hole for a 5/16" dowel pin.  By fairly standard conventions, this hole would be 0.3125" h5 tolerance.  In the part model, set the units to four decimals and the tolerance to h5, which is I think is going to be +0.0000 / -0.0002".

 

I have my dimension style set to three decimals in my Dim Style settings, and I have the "Use Part Tolerance" box checked for all hole types on the leaders tab.

 

When I add a hole table, both of these holes will come in with a diameter specfication at three decimals, i.e. 0.332 for the clearance hole and 0.313 h5 for the dowel PF holes.  As you can imagine, what happens in the shop for the dowel holes is that a guy has already run a 0.3130" reamer through the holes under the assumption that the actual design intent is 0.313 +0.0000 / -0.0002 since it will round up when truncating.  Then the dowels drop in the holes because they're oversized.

 

Sooooooooo.......  Is there away to get a hole table to not only take the model's TOLERANCE specification, *and* the PRECISION specification as well?

 

Thanks for reading all this!

5 REPLIES 5
Message 2 of 6
wayne.brill
in reply to: tdswanson

Hi,

 

This seems like this issue should be a UI enhancement. You could request it on the Inventor Idea Station:

http://forums.autodesk.com/t5/inventor-ideastation/idb-p/v1232

 

You could also post the question on the Inventor General forum.

http://forums.autodesk.com/t5/inventor-general-discussion/bd-p/78

 

 

There is an API available for hole tables. As a quick example the VBA code below prints out the value in each cell of a selected hole table. I did not try using the API to edit the values. This could be problematic as it would be overwriting what Inventor has created in the table. Perhaps using the API to add a new column to the table and populating the cell in each row for that column with the values you need would be helpful.

 

 

Public Sub holeTableTest()
    Dim oHoleTable As HoleTable
    Set oHoleTable = ThisApplication.ActiveDocument.SelectSet(1)
   
    Dim oHoleTableRow As HoleTableRow
    Dim oHoleTableCell As HoleTableCell
      
    For Each oHoleTableRow In oHoleTable.HoleTableRows
        For Each oHoleTableCell In oHoleTableRow
            Debug.Print oHoleTableCell.Text
            Debug.Print oHoleTableCell.FormattedText
          
        Next oHoleTableCell
    Next oHoleTableRow
   
End Sub 

 

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 3 of 6
tdswanson
in reply to: wayne.brill

Wayne:

 

Thanks for your reply.  However, I'm not sure that I understand.  Per your message: "As a quick example the VBA code below prints out the value in each cell of a selected hole table".  How does that relate to making sure that the precision is as desired?

 

Best,

 

Tadd

Message 4 of 6
wayne.brill
in reply to: tdswanson

Hi Tadd,

 

I was just trying to introduce the Inventor API related to hole tables. I do not see an API call that will change the default behavior for precision for a hole table like you are asking for.

 

I was thinking that it could be possible to use the API to add the information you need to a hole table in a new column that can be created using the API.

 

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 5 of 6
tdswanson
in reply to: wayne.brill

Ahh.  I see.  I'm pretty new to using VBA in Inventor, but I've got quite a bit of experience with it in Office programs.

 

Anyway, is there a way to use a loop like you've got to go line by line and query the part model for the precision setting for the hole in question?  If we could get the precision (# of decimal places), could we then use that variable to apply that formatting to the row in question?  Just a thought....  That's more advanced than anything I've coded in Inventor before.

 

Out of curiosity though, it's curious that a hole table wouldn't pull the precision setting the for the hole from the model anyway.  For example, if I need a hole to be 1.234567", I can type in 1.234567" to create the hole without changing the precision display for the hole, and the model will have the hole be a diamter of 1.234567".  If that precision setting ISN'T going to get transferred through to a callout on the drawing, what is the motivation to change the precision setting at all?  What does it do for the designer?  The hole is still 1.234567" in diameter even if he doesn't change the precision.

 

Thanks again for looking at this!

Message 6 of 6
wayne.brill
in reply to: tdswanson

Hi,

 

I agree that the hole table needs to be improved to allow for the display of precision. Please request it on the Inventor Idea station.

 

 

The API does have a way to get to features from a row in a hole table. However I do not see a way to go directly from the HoleTableRow object to the HoleFeature for that row.

 

Note: This VBA code is just to demonstrate this part of the API. (it would need to be enhanced to do what you need)

 

This example uses the ReferencedHole property to get to a DrawingCurve. The parent of a ModelCurve of that DrawingCurve is a SurfaceBody. This object has an AffectedByFeatures method that will allow you to get to the hole features. The Parameter that is driving the diameter or the ExtendedName property could give you the precision values you need. Your algorithm would need to figure out which hole is in each row in the table.

 

 

Public Sub holeTableTest2()
    Dim oHoleTable As HoleTable
    Set oHoleTable = ThisApplication.ActiveDocument.SelectSet(1)
   
    Dim oHoleTableRow As HoleTableRow
        
    For Each oHoleTableRow In oHoleTable.HoleTableRows
       
        If Not oHoleTableRow.ReferencedHole Is Nothing Then
           Dim oDrawCrv As DrawingCurve
           Set oDrawCrv = oHoleTableRow.ReferencedHole
      
          Dim oPartFeaturesEnumerator As PartFeaturesEnumerator
          Set oPartFeaturesEnumerator = oDrawCrv.ModelGeometry.Parent.AffectedByFeatures 
          Dim oPartFeature As PartFeature
          For Each oPartFeature In oPartFeaturesEnumerator
                  
          If oPartFeature.Type = 83912192 Then 'kHoleFeatureObject"
 
           Dim oHoleFeature As HoleFeature
           Set oHoleFeature = oPartFeature
                 
           Debug.Print oHoleFeature.Name
           Debug.Print oHoleFeature.ExtendedName
          
           Dim oParam As Parameter
           Set oParam = oHoleFeature.HoleDiameter
           Dim oDiameter As Double
               
           oDiameter = ThisApplication.UnitsOfMeasure.ConvertUnits(oParam.Value, kDatabaseLengthUnits, kInchLengthUnits)
           Debug.Print oDiameter
         
           End If
          Next
         
          Exit For
        End If

    Next oHoleTableRow
   
End Sub

 

 

 

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