Alan Lowbands
Aerospace
- May 17, 2017
- 274
Hi guys,
I dropped this in another thread but didn't get a reply.
I'm hoping it was just missed and that someone may know the answer.
The script below just alters some hole dimension properties but has to be run twice to complete everything.
Does anyone know why?
It was botched together from other bits of code so it's not very pretty
--------------------------------------------------------------------------------------
Sub CATMain()
Dim documents1
Set documents1 = CATIA.Documents
Set Document = CATIA.ActiveDocument
Dim selection1
Set selection1 = Document.Selection
Set Info = selection1.Item(1)
Dim Dimension1
Set Dimension1 = Info.Value
Dim DimTolValue
Set DimTolValue = Dimension1
Dim oTolType
Dim oDisplayMode
Dim oTolName
Dim oUpTolS
Dim oLowTolS
Dim oUpTolD
Dim oLowTolD
DimTolValue.GetTolerances oTolType, oTolName, oUpTolS, oLowTolS, oUpTolD, oLowTolD, oDisplayMode
oTolName = "TOL_NUM2"
oUpTolD = 0.2
oLowTolD = -0.0
DimTolValue.SetTolerances oTolType, oTolName, oUpTolS, oLowTolS, oUpTolD, oLowTolD, oDisplayMode
Dim DimDimValue
Set DimDimValue = Dimension1.GetValue
DimDimValue.SetFormatName 1, "ANS.DIMM"
DimDimValue.SetFormatPrecision 1, "0.100" 'precision
Dim oNoOff
oNoOff=InputBox ( "Enter No Off Holes" )
Dim oNoOffText
oNoOffText = "("& oNoOff &"x) "
Dim oBefore
oBefore =oNoOffText
Dim oAfter
oAfter =" THRO'"
Dim oUpper
'oUpper = "Upper"
Dim oLower
'oLower = "Lower"
Dimension1.GetValue.SetBaultText 1, oBefore, oAfter, oUpper, oLower
Dim myDim 'As DrawingDimension
Set myDim = CATIA.ActiveDocument.Selection.Item(1).Value
Dim myDimLine 'As DrawingDimLine
Set myDimLine = myDim.GetDimLine
myDimLine.DimLineGraphRep = catDimLine2Parts
MyDim.RestoreValuePosition()
End Sub
I dropped this in another thread but didn't get a reply.
I'm hoping it was just missed and that someone may know the answer.
The script below just alters some hole dimension properties but has to be run twice to complete everything.
Does anyone know why?
It was botched together from other bits of code so it's not very pretty
--------------------------------------------------------------------------------------
Sub CATMain()
Dim documents1
Set documents1 = CATIA.Documents
Set Document = CATIA.ActiveDocument
Dim selection1
Set selection1 = Document.Selection
Set Info = selection1.Item(1)
Dim Dimension1
Set Dimension1 = Info.Value
Dim DimTolValue
Set DimTolValue = Dimension1
Dim oTolType
Dim oDisplayMode
Dim oTolName
Dim oUpTolS
Dim oLowTolS
Dim oUpTolD
Dim oLowTolD
DimTolValue.GetTolerances oTolType, oTolName, oUpTolS, oLowTolS, oUpTolD, oLowTolD, oDisplayMode
oTolName = "TOL_NUM2"
oUpTolD = 0.2
oLowTolD = -0.0
DimTolValue.SetTolerances oTolType, oTolName, oUpTolS, oLowTolS, oUpTolD, oLowTolD, oDisplayMode
Dim DimDimValue
Set DimDimValue = Dimension1.GetValue
DimDimValue.SetFormatName 1, "ANS.DIMM"
DimDimValue.SetFormatPrecision 1, "0.100" 'precision
Dim oNoOff
oNoOff=InputBox ( "Enter No Off Holes" )
Dim oNoOffText
oNoOffText = "("& oNoOff &"x) "
Dim oBefore
oBefore =oNoOffText
Dim oAfter
oAfter =" THRO'"
Dim oUpper
'oUpper = "Upper"
Dim oLower
'oLower = "Lower"
Dimension1.GetValue.SetBaultText 1, oBefore, oAfter, oUpper, oLower
Dim myDim 'As DrawingDimension
Set myDim = CATIA.ActiveDocument.Selection.Item(1).Value
Dim myDimLine 'As DrawingDimLine
Set myDimLine = myDim.GetDimLine
myDimLine.DimLineGraphRep = catDimLine2Parts
MyDim.RestoreValuePosition()
End Sub