Setting Dimension TextPoint Location using iLogic

Setting Dimension TextPoint Location using iLogic

ad64
Advocate Advocate
344 Views
1 Reply
Message 1 of 2

Setting Dimension TextPoint Location using iLogic

ad64
Advocate
Advocate

I can't seem to get Inventor to locate a Sketch Dimension label using TextPoint in Inventor 2014.

 

Here's some simple test code I've been trying.

 

For Each oDim In ThisDoc.Document.ComponentDefinition.Sketches(2).DimensionConstraints
        oDim.TextPoint.X = 3
        oDim.TextPoint.Y = 3
        MsgBox(oDim.TextPoint.X & vbCrLf & oDim.TextPoint.Y)
Next

 

Why doesn't this move the dimension to 3, 3?

 

Thanks,
Steve

 

 

0 Likes
345 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Hi ,

Please use the below code .it is already there in Inventor help file.So i modified some lines to meet your requirement.I hope this helps....

 

Public Sub StartSketchEdit()
' Set a reference to the Sketches collection. This assumes
' that a part document containing a sketch is active.
Dim oSketches As PlanarSketches
Set oSketches = ThisApplication.ActiveDocument.ComponentDefinition.Sketches

' Get the sketch named "Sketch1".
On Error Resume Next
Dim oSketch As PlanarSketch
Set oSketch = oSketches.Item("Sketch1")
oSketch.Edit
Dim oDimConsrts As DimensionConstraints
Set oDimConsrts = oSketch.DimensionConstraints
Dim oDimCons As DimensionConstraint
Dim oDimPosition As Point2d
For Each oDimCons In oDimConsrts
Set oDimPosition = oDimCons.TextPoint
oDimPosition.X = 3
oDimPosition.Y = 3
oDimCons.TextPoint = oDimPosition
Next

oSketch.ExitEdit
If Err Then
MsgBox "A Sketch named ""Sketch1"" must exist."
Exit Sub
End If
On Error GoTo 0
End Sub

 

0 Likes