Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Intent Dimension Tolerance change on creation

1 REPLY 1
SOLVED
Reply
Message 1 of 2
morgangardiner
805 Views, 1 Reply

Intent Dimension Tolerance change on creation

I am trying to get a tolerance to change when I create a dimension in Intent.

 

 

The code seems to work if run from the Immediate window but I can not seem to get it to run when the dimension is created.

Can anyone help to figure out what needs to be done to make this work.

Also I cannot seem to get any tolerance types except Deviation and Symmetrical. I can not seem to get the Limits-Stacked to work for example.

 

I call out a child for a dimension setting a variable (blnSetTolerance?)  indicating I want to change the tolerance

 

Child DIM1 As  :CompanyLinearDimension  ':IvLinearDimension '
   view=ViewA
   dimType=:horizontal
   part1= viewModel
   part2= viewModel
   entity1= "plane1"
   entity2= "plane2"
   centerText?= True
   render?=Render? 'True
   textOrigin= ViewA.origin + Vector (0,1.75,0)
   dimStyle="Dual Dimension"
   blnSetTolerance? = True
 End Child

 

 

 

CompanyLinearDimension  consists of the following iks file.

 

'! Intent Language(tm) 3.0

Design CompanyLinearDimension : ShaftRoot IvLinearDimension

 

Parameter Rule  blnSetTolerance? As Boolean = False

 

Uncached Rule changeTolerance As List

    If blnSetTolerance? Then   

           Return addMyTolerance(Me)  

          'Return addMyTolerance(%%updateSelf)

   Else   

          Return {"NO"}  

    End If

End Rule  

 

Method addMyTolerance(p As Part) As List

        Dim linDim As Any = GetHostObject(p)  

        linDim.Tolerance.SetToDeviation("0.0125 in", "-0.0950 in")

        'linDim.Tolerance.SetToSymmetric("0.0125 in")

        linDim.Precision = 4

        linDim.TolerancePrecision = 4

 

 

        ''linDim.Tolerance.SetTobasic  

        ''linDim.Tolerance.SetToDefault  

        ''linDim.Tolerance.SetToFits("FitType","HoleTolerance", "ShaftTolerance")

        ''linDim.Tolerance.SetToLimits("Stacked","0.0125 in", "-0.0950 in")

        ''linDim.Tolerance.SetToMax  ''linDim.Tolerance.SetToMin  

        ''linDim.Tolerance.SetToReference

       Return { "Ok" }

End Method

 

End Design

 

1 REPLY 1
Message 2 of 2

with some help from Wayne Brill this is my final code to reset the tolerance type and tolerance precision automatically when creating a dimension from within Inventor ETO (intent).

 

 

'-----------------------------------------------------------------------------------

' DESIGN CREATION INFORMATION

'

'

'Design Name: TidlandLinearDimension

'Design Intent: a file to add funtionality to ivLinearDimension such as being able to change the tolerance

'Drawing Design Based On:

'Date Created: 10/15/2012

'Created by: Morgan Gardiner

'-----------------------------------------------------------------------------------

' HISTORY

'

'

'-----------------------------------------------------------------------------------

Design

CompanyLinearDimension : IvLinearDimension

 

'####### EXAMPLE OF HOW TO CALL THIS DESIGN FROM ANOTHER  #####################

'

'Child SlotStart As  :CompanyLinearDimension 

' view=ViewA

' dimType=:horizontal

' part1= viewModel

' part2= viewModel

' entity1= "End"

' entity2= "SlotStart"

' centerText?= True

' render?=Render? 'True

' textOrigin= ViewA.origin + Vector (0,1.75,0)

' dimStyle="Dual Dimension"

' blnSetTolerance? = True

' strToleranceType  = "Deviation" ' "Default","Deviation","LimitLinear","LimitsStacked","Reference","Symmetric"

'  'intTolerancePrecision  = -1

'  anyUpperTolerance  = "0.125 in" '0.00  'UPPERTOLERANCE CAN BE PUT In As A String WITH UNITS DEFINED Or As A  Number And DEFAULT CENTIMETER UNITS IS ASSUMED.

'  anyLowerTolerance  = "-0.05 in" '0.00  'LOWERTOLERANCE CAN BE PUT In As A String WITH UNITS DEFINED Or As A  Number And DEFAULT CENTIMETER UNITS IS ASSUMED.

'  'anySymmetricTolerance = 0.00

'End Child

'#############################################################################

 

 

'A VARIABLE TO DETERMINE IF YOU WANT TO SET/CHANGE A TOLERANCE FORMAT

Parameter

Rule blnSetTolerance? AsBoolean = False

'A VARIABLE TO SET THE TOLERANCE TYPE

Parameter

Rule strToleranceType AsString = "Default"' "Default","Deviation","LimitLinear","LimitsStacked","Reference","Symmetric"

'A VARIABLE TO SET THE PRECISION OF THE TOLERANCE IE. 2 DECIMAL PLACES OR 4 DECIMAL PLACES

Parameter

Rule intTolerancePrecision AsInteger = -1

 

'A VARIABLE TO SET THE UPPERTOLERANCE ON A RANGE

Parameter

Rule anyUpperTolerance AsAny = 0.00  'UPPERTOLERANCE CAN BE PUT In As A String WITH UNITS DEFINED("0.012 IN") Or As A  Number(0.012) And DEFAULT CENTIMETER UNITS IS ASSUMED.

'A VARIABLE TO SET THE LOWERTOLERANCE ON A RANGE

Parameter

Rule anyLowerTolerance AsAny = 0.00  'LOWERTOLERANCE CAN BE PUT In As A String WITH UNITS DEFINED("-0.012 IN") Or As A  Number(-0.012) And DEFAULT CENTIMETER UNITS IS ASSUMED.

'A VARIABLE TO SET THE SYMMETRICAL TOLERANCE IF USING THE SYMMETRICAL TOLERANCE TYPE.

Parameter

Rule anySymmetricTolerance AsAny = 0.00  'SYMMETRICTOLERANCE CAN BE PUT In As A String WITH UNITS DEFINED("0.012 IN") Or As A  Number(0.012) And DEFAULT CENTIMETER UNITS IS ASSUMED.

 

 

'Pulled this from %%IvCommonDimensionMixin and added my rule to it so that it would generate automatically when the dimension was created.

 

' This should be used for post-create properties for ALL DIMENSIONS

  < %%category(

"Inventor Internal") > _

 

Rule %%setGenericNonIntrinsicProperties AsBoolean

    %%setDimensionLayer

    %%setDimensionStyle

    %%setFirstArrowheadInside

    %%setSecondArrowheadInside

'Added to the rule

changeTolerance

'End added to the rule

   

ReturnTrue

 

End Rule

 

Uncached

Rule changeTolerance AsList

If blnSetTolerance? Then

Return addMyTolerance(Me)

Else

Return {"NO"}

EndIf

End Rule

 

Method

addMyTolerance(p AsPart) AsList

If blnSetTolerance? Then

'GET THE CURRENT DIMENSION

Dim linDim AsAny = GetHostObject(p)

'SET THE TOLERANCETYPE IF BLNSETTOLERANCE? IS TRUE

If strToleranceType = "Deviation"Then

linDim.Tolerance.SetToDeviation(anyUpperTolerance, anyLowerTolerance)

ElseIf strToleranceType = "LimitLinear"Then

linDim.Tolerance.SetToLimits(Inventor.ToleranceTypeEnum.kLimitLinearTolerance, anyUpperTolerance, anyLowerTolerance)

ElseIf strToleranceType = "LimitsStacked"Then

linDim.Tolerance.SetToLimits(Inventor.ToleranceTypeEnum.kLimitsStackedTolerance, anyUpperTolerance, anyLowerTolerance)

ElseIf strToleranceType = "Reference"Then

linDim.Tolerance.SetToReference()

ElseIf strToleranceType = "Symmetric"Then

linDim.Tolerance.SetToSymmetric(anySymmetricTolerance)

Else'"Default"

linDim.Tolerance.SetToDefault()

EndIf

'IF THE TOLERANCE PRECISION IS BEING SET BY THE USER TO SOMETHING OTHER THAN DEFAULT

If intTolerancePrecision > -1 Then

linDim.TolerancePrecision = intTolerancePrecision

EndIf

 

EndIf

Return { "Ok" }

 

'Tolerance Methods:

' OF NOTE IS THAT UPPERTOLERANCE and LOWERTOLERANCE CAN BE PUT IN AS A STRING WITH UNITS DEFINED OR AS A  NUMBER AND DEFAULT CENTIMETER UNITS IS ASSUMED.

'SetTobasic()

'SetToDefault()

'SetToDeviation(UpperTolerance, LowerTolerance)

'SetToFits(FitsToleranceType As ToleranceTypeEnum, HoleTolerance As String, ShaftTolerance As String)

'SetToLimits(LimitsToleranceType As ToleranceTypeEnum, UpperTolerance, LowerTolerance)  'kLimitsStackedTolerance = 31237 , kLimitLinearTolerance = 31238

'SetToMax()

'SetToMin()

'SetToReference()

'SetToSymmetric(Tolerance)

'ToleranceTypeEnum:

'Const kBasicTolerance = 31245 (&H7A0D)

'Const kDefaultTolerance = 31233 (&H7A01)

'Const kDeviationTolerance = 31236 (&H7A04)

'Const kLimitLinearTolerance = 31238 (&H7A06)

'Const kLimitsFitsLinearTolerance = 31242 (&H7A0A)

'Const kLimitsFitsShowSizeTolerance = 31243 (&H7A0B)

'Const kLimitsFitsShowTolerance = 31244 (&H7A0C)

'Const kLimitsFitsStackedTolerance = 31241 (&H7A09)

'Const kLimitsStackedTolerance = 31237 (&H7A05)

'Const kMaxTolerance = 31239 (&H7A07)

'Const kMinTolerance = 31240 (&H7A08)

'Const kOverrideTolerance = 31234 (&H7A02)

'Const kReferenceTolerance = 31246 (&H7A0E)

'Const kSymmetricTolerance = 31235 (&H7A03)

 

End Method

 

 

End Design

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

Post to forums  

Autodesk Design & Make Report