View Justification of Drawing Detail

View Justification of Drawing Detail

dev8FGGQ
Participant Participant
805 Views
5 Replies
Message 1 of 6

View Justification of Drawing Detail

dev8FGGQ
Participant
Participant

Hi,

 

when I make a drawing detail of the main view, the detail is Centered view and I cannot align it in the right position with main view. When I make a cut, there is no problem.

See example.

 

I have found a solution on this forum, but it haven't helped me.

 

Do you know how can I do it?

0 Likes
Accepted solutions (2)
806 Views
5 Replies
Replies (5)
Message 2 of 6

dev8FGGQ
Participant
Participant

The solution which didnt help is

https://www.youtube.com/watch?v=x_9yd45rJYg 

0 Likes
Message 3 of 6

Alexander_Chernikov
Mentor
Mentor

Usually the detail view is done at a different scale from the base view and it's not entirely clear how you want to align it.

However, the problem can be solved using  iLogic rules - the corresponding code is described by @Andrii_Humeniuk  in
https://forums.autodesk.com/t5/product-design-manufacturing/inventor-yak-virivnyati-vidi-yaki-e-fiks...

 

Do you find the posts helpful? "LIKE" these posts! | Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням!
Have your question been answered successfully? Click "ACCEPT SOLUTION" button. | На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ"

Олександр Черніков / Alexander Chernikov

EESignature

Facebook | LinkedIn

.


Message 4 of 6

dev8FGGQ
Participant
Participant

Hi, thank you, i will try it.

 

The detail view can have a different scale, but all cuts of this detail are then also centered, so there is the problem.

0 Likes
Message 5 of 6

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hi @dev8FGGQ . Here is the iLogic rule I use. I translated the text into English for ease of use.

Sub main
	Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
	Dim oCM As CommandManager = ThisApplication.CommandManager
	Dim oCurve1, oCurve2 As DrawingCurveSegment
	oCurve1 = oCM.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select a curve of the view...(Press ESC to cancel)")
	If oCurve1 Is Nothing Then Exit Sub
	Do
		oCurve2 = oCM.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select the orientation curve...(Press ESC to cancel)")
		If oCurve2 Is Nothing Then Exit Sub
	Loop While oCurve1.Parent.Parent Is oCurve2.Parent.Parent
	Dim lPosCurves As Long = GetPositionCurve(oCurve1, oCurve2)
	If lPosCurves <> 0 Then
		Dim dDistance As Double = GetMinimumDistance(oCurve1, oCurve2, lPosCurves)
		Call SetPositionView(oCurve1.Parent.Parent, dDistance, lPosCurves)
	Else
		MessageBox.Show("The curves are not parallel, or your option is not described in a circle.", _
						"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
	End If
End Sub

Private Function GetPositionCurve(ByVal oCurve1 As DrawingCurveSegment, ByVal oCurve2 As DrawingCurveSegment) As Long
	Dim dCurve1StartX, dCurve1StartY, dCurve1EndX, dCurve1EndY, dCurve2StartX, dCurve2StartY, dCurve2EndX, dCurve2EndY As Double
	Dim oPoint1, oPoint2 As Point2d
	If oCurve1.GeometryType = Curve2dTypeEnum.kLineSegmentCurve2d Then
		dCurve1StartX = Round(oCurve1.StartPoint.X, 5)
		dCurve1StartY = Round(oCurve1.StartPoint.Y, 5)
		dCurve1EndX = Round(oCurve1.EndPoint.X, 5)
		dCurve1EndY = Round(oCurve1.EndPoint.Y, 5)
	Else If oCurve1.GeometryType = Curve2dTypeEnum.kCircleCurve2d Then
		oPoint1 = oCurve1.Geometry.Center
	Else If oCurve1.GeometryType = Curve2dTypeEnum.kCircularArcCurve2d Then
		oPoint1 = oCurve1.Geometry.Center
	End If
	If oCurve2.GeometryType = Curve2dTypeEnum.kLineSegmentCurve2d Then
		dCurve2StartX = Round(oCurve2.StartPoint.X, 5)
		dCurve2StartY = Round(oCurve2.StartPoint.Y, 5)
		dCurve2EndX = Round(oCurve2.EndPoint.X, 5)
		dCurve2EndY = Round(oCurve2.EndPoint.Y, 5)
	Else If oCurve2.GeometryType = Curve2dTypeEnum.kCircleCurve2d Then
		oPoint2 = oCurve2.Geometry.Center
	Else If oCurve2.GeometryType = Curve2dTypeEnum.kCircularArcCurve2d Then
		oPoint2 = oCurve2.Geometry.Center
	End If
	If oCurve1.GeometryType = Curve2dTypeEnum.kLineSegmentCurve2d Then
		If oCurve2.GeometryType = Curve2dTypeEnum.kLineSegmentCurve2d Then
			If dCurve1StartX = dCurve1EndX And dCurve2StartX = dCurve2EndX Then
				If dCurve1StartX >= dCurve2StartX Then
					Return 3
				Else
					Return 4
				End If
			Else If dCurve1StartY = dCurve1EndY And dCurve2StartY = dCurve2EndY Then
				If dCurve1StartY >= dCurve2StartY Then
					Return 1
				Else
					Return 2
				End If
			End If
		Else If oCurve2.GeometryType = Curve2dTypeEnum.kCircleCurve2d Or _
			oCurve2.GeometryType = Curve2dTypeEnum.kCircularArcCurve2d Then
			If dCurve1StartX = dCurve1EndX Then
				If oPoint2.X >= dCurve1StartX Then
					Return 7
				Else
					Return 8
				End If
			Else If dCurve1StartY = dCurve1EndY Then
				If oPoint2.Y >= dCurve1StartY Then
					Return 5
				Else
					Return 6
				End If
			End If
		End If
	Else If oCurve1.GeometryType = Curve2dTypeEnum.kCircleCurve2d Or _
		oCurve1.GeometryType = Curve2dTypeEnum.kCircularArcCurve2d Then
		If oCurve2.GeometryType = Curve2dTypeEnum.kLineSegmentCurve2d Then
			If dCurve2StartX = dCurve2EndX Then
				If oPoint1.X >= dCurve2StartX Then
					Return 11
				Else
					Return 12
				End If
			Else If dCurve2StartY = dCurve2EndY Then
				If oPoint1.Y >= dCurve2StartY Then
					Return 9
				Else
					Return 10
				End If
			End If
		Else If oCurve2.GeometryType = Curve2dTypeEnum.kCircleCurve2d Or _
			oCurve2.GeometryType = Curve2dTypeEnum.kCircularArcCurve2d Then
			Dim bvResult As DialogResult
			If oCurve1.Parent.Parent.Aligned Then
				Dim oView, oParenView As DrawingView
				oView = oCurve1.Parent.Parent
				oParenView = oCurve1.Parent.Parent.ParentView
				If (Math.Abs(oView.Top - oParenView.Top) < 0.0000001) Then
					bvResult = vbYes
				ElseIf (Math.Abs(oView.Left - oParenView.Left) < 0.0000001) Then
					bvResult = vbNo
				End If
			End If
			If bvResult = 0 Then
				bvResult = MessageBox.Show("Select 'Yes' to center vertically and 'No' to center horizontally.", _
							"Centering.", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
			End If
			If bvResult = vbYes Then
				If oPoint1.X >= oPoint2.X Then
					Return 15
				Else
					Return 16
				End If
			Else If bvResult = vbNo Then
				If oPoint1.Y >= oPoint2.Y Then
					Return 13
				Else
					Return 14
				End If
			End If
		End If
	End If
	Return 0
End Function

Private Function GetMinimumDistance(ByVal oCurve1 As DrawingCurveSegment, ByVal oCurve2 As DrawingCurveSegment, ByVal lPosCurves As Long) As Double
	Select Case lPosCurves
	Case 1, 2 : Return Math.Abs(oCurve1.StartPoint.Y - oCurve2.StartPoint.Y)
	Case 3, 4 : Return Math.Abs(oCurve1.StartPoint.X - oCurve2.StartPoint.X)
	Case 5, 6 : Return Math.Abs(oCurve1.StartPoint.Y - oCurve2.Geometry.Center.Y)
	Case 7, 8 : Return Math.Abs(oCurve1.StartPoint.X - oCurve2.Geometry.Center.X)
	Case 9, 10 : Return Math.Abs(oCurve1.Geometry.Center.Y - oCurve2.StartPoint.Y)
	Case 11, 12 : Return Math.Abs(oCurve1.Geometry.Center.X - oCurve2.StartPoint.X)
	Case 13, 14 : Return Math.Abs(oCurve1.Geometry.Center.Y - oCurve2.Geometry.Center.Y)
	Case 15, 16 : Return Math.Abs(oCurve1.Geometry.Center.X - oCurve2.Geometry.Center.X)
	End Select
	Return 0
End Function

Private Function SetPositionView(ByVal oView As DrawingView, ByVal dDistance As Double, ByVal lPosCurves As Long)
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	Select Case lPosCurves
	Case 1, 5, 9, 13 : oView.Position = oTG.CreatePoint2d(oView.Position.X, oView.Position.Y - dDistance)
	Case 2, 6, 10, 14 : oView.Position = oTG.CreatePoint2d(oView.Position.X, oView.Position.Y + dDistance)
	Case 3, 7, 11, 15 : oView.Position = oTG.CreatePoint2d(oView.Position.X - dDistance, oView.Position.Y)
	Case 4, 8, 12, 16 : oView.Position = oTG.CreatePoint2d(oView.Position.X + dDistance, oView.Position.Y)
	End Select
End Function

 

 

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

Message 6 of 6

dev8FGGQ
Participant
Participant
Accepted solution
It works well. Thank you very much 🙂
0 Likes