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: 

Weird behavior, tolerance, inch to cm, dim limits

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
CadUser46
326 Views, 2 Replies

Weird behavior, tolerance, inch to cm, dim limits

I have some very weird (to me at least) behavior going.  Im trying to set some part sketch parameters and their upper and bottom limits based on imperial values from a spreadsheet.

 

In the sample below i can see GetCellValues returns the correct value from the spreadsheet (as a string) of 4.003 inches.  Also listed in this spreadsheet are the upper limit 4.006 and bottom limit of 4.003.  The problem is that when i set these limits (even after converting to inches) it displays the tolerance as 8.009/8.003. 

 

It appears the settolimits only accepts the values as a deviation and the lower value must be a negative to have it work correctly?

 

 

        'Add dimensions from spreadsheet
        'set oDims(1) = oSketch.DimensionConstraints.AddTwoPointDistance(oCenterLine.StartSketchPoint, oCenterLine.EndSketchPoint, kHorizontalDim, oCoord1, True)
        Set oDims(1) = oSketch.DimensionConstraints.AddOffset(oLines(3), oCenterLine, oTG.CreatePoint2d(-5, 0), True, False)
            oDims(1).Parameter.Name = "Dim4"
            oDims(1).Parameter.Value = ConvertInchtoCM(GetCellValues(CBoxFamily1.Value, CBoxEnd1.Value, 0, "Dim4"))
            
            Dim dblULimit As Double: dblULimit = ConvertInchtoCM(GetCellValues(CBoxFamily1.Value, CBoxEnd1.Value, 2, "Dim4"))
            Dim dblBLimit As Double: dblBLimit = ConvertInchtoCM(GetCellValues(CBoxFamily1.Value, CBoxEnd1.Value, 3, "Dim4"))

            If GetCellValues(CBoxFamily1.Value, CBoxEnd1.Value, 2, "Dim4") <> "NULL" Then
                Call oPartDoc.ComponentDefinition.Parameters("Dim4").Tolerance.SetToLimits(kLimitsStackedTolerance, dblULimit, dblBLimit)
            End If
            'set precision here.
            oDims(1).Parameter.Precision = GetCellValues(CBoxFamily1.Value, CBoxEnd1.Value, 1, "Dim4")

 

 

 

 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
2 REPLIES 2
Message 2 of 3

Hi

 

So far I'm not reproducing an unexpected behavior, I am testing with a simple sample as below. I have a parameter associated with a linear dimension:

 

Sub TolTest()

    Dim doc As PartDocument
    Set doc = ThisApplication.ActiveDocument
    
    Dim param As parameter
    Set param = doc.ComponentDefinition.parameters("adn")

    Call param.tolerance.SetToLimits(kLimitsStackedTolerance, "5 in", "3 in")

End Sub

 

Keep in mind that the API units, if not explicitely specified, are always expressed in cm for length. If this is still an issue for, provide a sample document along with some code and the Excel functionality stripped away as I don't think  they are relevant here.

 

Thank you,

Philippe.

 

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

I guess it was more my misunderstanding of what the method was looking for.  When it says input the upper limit i think of the actual measurable value an inspector would check on a gauge.

 

What its actually looking for is deviation.  So in your example you are saying the upper 'deviation' is +5cm and the lower 'deviation' is still +3cm.

 

Once i figured out what it wanted i simply adjusted my values in my spreadsheet to 0.003 and -0.003.

 

 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro

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

Post to forums  

Autodesk Design & Make Report