Alignment of detail views

Alignment of detail views

mr_ensing
Advocate Advocate
842 Views
2 Replies
Message 1 of 3

Alignment of detail views

mr_ensing
Advocate
Advocate

So, Inventor used to align detail views in according to the model. Now it appears it aligns them based on the size of the detail view:

 

mr_ensing_0-1605011107036.png

 

Old drawings that where aligned this way still work. But if one breaks the alignment there is no way back.

Is there a setting i'm missing?

 

Other info:

0 Likes
843 Views
2 Replies
Replies (2)
Message 2 of 3

rhasell
Advisor
Advisor

Hi

 

I use some code which I found on the forum.

 

'Got this from Bart Den Otter
'Autodesk Forums
'https://forums.autodesk.com/t5/inventor-forum/aligning-views-to-a-line/td-p/7186354
'21.02.2020

Sub Main()

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document

Dim oCurve1, oCurve2 As DrawingCurveSegment
oCurve1 = GetCurve1(oDoc)
oCurve2 = GetCurve2(oDoc)

Dim oView1, oView2 As DrawingView
oView1 = oCurve1.Parent.Parent
oView2 = oCurve2.Parent.Parent

Dim Curve1Point1, Curve1Point2, Curve2Point1, Curve2Point2, View1Point, View2Point As Point2d
Curve1Point1 = oCurve1.StartPoint
Curve1Point2 = oCurve1.EndPoint
Curve2Point1 = oCurve2.StartPoint
Curve2Point2 = oCurve2.EndPoint

If oView1.Name = oView2.Name Then
MessageBox.Show("Select lines from different views", "Align view error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
Exit Sub
End If

If (Round((Curve1Point1.X - Curve1Point2.X) * 1e8) = 0 And Round((Curve2Point1.X - Curve2Point2.X) * 1e8) = 0) Then
MoveView = Curve1Point1.X - Curve2Point1.X
oView2Point = oView2.Position
oView2Point.X = oView2Point.X + MoveView
oView2.Position = oView2Point
Else If (Round((Curve1Point1.Y - Curve1Point2.Y) * 1e8) = 0 And Round((Curve2Point1.Y - Curve2Point2.Y) * 1e8) = 0) Then
MoveView = Curve1Point1.Y - Curve2Point1.Y
oView2Point = oView2.Position
oView2Point.Y = oView2Point.Y + MoveView
oView2.Position = oView2Point
Else
MessageBox.Show("Lines are not horizontal or vertical or not in the same orientation.", "Align view error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
MsgBox(Curve1Point1.Y - Curve1Point2.Y)
MsgBox(Curve2Point1.Y - Curve2Point2.Y)
Exit Sub
End If
oAgainQ()
End Sub

Sub oAgainQ()
oAgain = MessageBox.Show("Again", "Rinse and Repeat", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
If oAgain = vbYes
Main()
End If
End Sub



Private Function GetCurve1(ByVal oDoc As DrawingDocument) As DrawingCurveSegment
Dim Curve As DrawingCurveSegment
Curve = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select first line to align")
Return Curve
End Function

Private Function GetCurve2(ByVal oDoc As DrawingDocument) As DrawingCurveSegment
Dim Curve As DrawingCurveSegment
Curve = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select second line to align")
Return Curve
End Function

 

Reg
2026.1
Message 3 of 3

mr_ensing
Advocate
Advocate

@rhasell wrote:

Hi

 

I use some code which I found on the forum.

Thanks.

So that's iLogic code. And it works, but only at the moment you apply it. 

I'm working on standard drawings. These get copied and the dimensions of the models change. 

 

The old style of aligning detail views worked great. A super weird change from Autodesk.

(It still works for sections, but detail views now align the center of the view instead of the center of the model.)

 

mr_ensing_0-1605078001487.png

0 Likes