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: 

Setting Dimension TextPoint Location using iLogic

1 REPLY 1
Reply
Message 1 of 2
ad64
275 Views, 1 Reply

Setting Dimension TextPoint Location using iLogic

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

 

 

1 REPLY 1
Message 2 of 2
prakasht66
in reply to: ad64

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

 

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

Post to forums  

Autodesk Design & Make Report