scaling functionality for a set of drawing views

scaling functionality for a set of drawing views

GeorgK
Advisor Advisor
4,167 Views
17 Replies
Message 1 of 18

scaling functionality for a set of drawing views

GeorgK
Advisor
Advisor

Hello together,

 

there are some posts to solve this. Does there exist a better solution in Inventor 2019 to calculate the view scale for a set of drawing views depending from the sheet size? All views (front, bottom, top etc.) should fit on the sheet with the correct scale (1:1, 1:2 ...) or do I have to calculate it the old way? Does there exist a universal solution?

 

https://forums.autodesk.com/t5/inventor-customization/ilogic-coding-to-create-automated-drawing/m-p/...

https://forums.autodesk.com/t5/inventor-customization/help-with-ilogic-to-create-automated-2d-drawin...

https://forums.autodesk.com/t5/inventor-customization/ilogic-auto-create-scaled-drawing-from-a-model...

https://forums.autodesk.com/t5/inventor-customization/scaling-views-to-fit-a-sheet/td-p/2171712

 

Thank you

 

Georg

0 Likes
Accepted solutions (1)
4,168 Views
17 Replies
Replies (17)
Message 2 of 18

MechMachineMan
Advisor
Advisor

Don't think so. You can use those algorithms or create your own. It really depends on what you want the drawing to look like.

 

Do you want the view to take up the full page but be 1 to 1?

Do you want the view to be roughly 1/3 of the page area?

Do you want the view to be 1/3 of the page height, but no wider than 1/2 the page width?

 

etc., etc.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 18

GeorgK
Advisor
Advisor

The user could choose in the assembly the hole assembly or select a part. In part environment the front fiew is selected. The front view is the base view in the sheet. I thought about calculating the dimensions (bounding box http://modthemachine.typepad.com/my_weblog/2017/06/getting-the-overall-size-of-parts.html , https://forums.autodesk.com/t5/inventor-customization/calculate-limits-max-and-min-assemblies-files/...) from the part or assembly from the front view. That saves a lot of drawing changes and calculations.

The user should choose between the different sheet sizes, styles (hidden, without hidden lines, shaded) and the following views:

 

Drawing.png

 

 

 

 

 

 

 

 

 

 

The views together should be 3/4 of the sheet size. The rest space is for the dimensions. After the sheet is generated the user should have the option to scale the views up or down or to change another sheet size (Portrait: A4; landscape: A3, A2, A1, A0).

The views should be automaticaly scaled to 1:1, 1:2, 1:2,5 , 1:5, 1:10, 2:1, 2,5:1,  5:1, 10:1) If the size of the views is too big to fit on the sheet the next sheet size should be choosen.

 

What do you thing is the best and fastest way to do the calculations?

 

0 Likes
Message 4 of 18

chandra.shekar.g
Autodesk Support
Autodesk Support

@GeorgK,

 

Nice workflow to automate genaration of drawing views in Drawing document. In this, Sheet space(3/4), Sheet Size, styles and Drawing view orientations are fixed. Now, view scale and bounding box of model will varies from model to model.

 

I think that appropriate way to address this would be considering ranges of bounding box of model. For different view scale, there will be different ranges of bounding box.

 

For Example,

 

Sheet size Drawing orientation  Scale  Bounding box range (in cm)
A4 First type with 5 views 1:1 (x = 10, y = 10) to (x = 15, y = 15)
    1:2 (x = 15, y = 15) to (x = 20, y = 20)
    1:2.5 (x = 20, y = 20) to (x = 25, y = 25)
    1:5 (x = 25, y = 25) to (x = 35, y = 35)
    1:10 (x = 35, y = 35) to (x = 50, y = 50)

 

Similarly, Bounding box range can be fixed based on sheet size and view scale.

 

Thanks and regards,

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 18

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

that's a good idea. But how to code this?

 

Thank you Georg

0 Likes
Message 6 of 18

GeorgK
Advisor
Advisor

As a start:

 

Dim m_inventorApp As Inventor.Application = Nothing
            m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")

            Dim oDrawingDoc As DrawingDocument
            oDrawingDoc = m_inventorApp.ActiveDocument

            Dim oTG As TransientGeometry = m_inventorApp.TransientGeometry

            Dim oTrans As Transaction
            oTrans = m_inventorApp.TransactionManager.StartTransaction(m_inventorApp.ActiveDocument, "Ansichten verschieben")

            Dim ActiveSheet As Sheet
            ActiveSheet = oDrawingDoc.ActiveSheet

            Dim oView As DrawingView

            '###########################


            Dim oSheet As Sheet
            oSheet = oDrawingDoc.ActiveSheet

            Dim oListx As ArrayList = New ArrayList()
            Dim oListy As ArrayList = New ArrayList()

            For Each oView In oSheet.DrawingViews
                oListx.Add(oView.Position.X)
                oListy.Add(oView.Position.Y)
            Next

            oListx.Sort()
            oListy.Sort()

            Dim mid As Integer
            mid = (oListy.Count - 1) / 2

            Dim midView As DrawingView = Nothing

            For Each oView In oSheet.DrawingViews
                If Math.Round(oView.Position.X, 6) = Math.Round(oListx(mid), 6) And Math.Round(oView.Position.Y, 6) = Math.Round(oListy(mid), 6) Then
                    midView = oView
                    'MsgBox(midView.Name.ToString)
                    Exit For
                End If
            Next

            '################################
            Dim oPositionX As Double
            Dim oPositionY As Double
            Dim oBaseViewHeight As Double
            Dim oBaseViewWidth As Double



            Dim prompt As String = "Bitte geben Sie den Abstand ein"
            Dim title As String = "Abstand zur " & midView.Name
            Dim oAbstand As String
            ' Set prompt.
            prompt = "Bitte geben Sie den Abstand ein"
            ' Set title.
            title = "Abstand zur " & midView.Name & " in mm"
            ' Set default value.
            oAbstand = "80"
            ' Display prompt, title, and default value.
            oAbstand = Interaction.InputBox(prompt, title, oAbstand)
            If oAbstand = "" Then
                Exit Sub
            End If

            'Prüfen, ob Zahlen
            If oAbstand.All(AddressOf Char.IsDigit) = True Then
                oAbstand = oAbstand / 10
            Else
                Exit Sub
            End If

            For Each oView In ActiveSheet.DrawingViews
                'If oView.ViewType = Inventor.DrawingViewTypeEnum.kStandardDrawingViewType Then
                If oView.Name = midView.Name Then
                    oPositionX = oView.Position.X
                    oPositionY = oView.Position.Y
                    oBaseViewHeight = oView.Height
                    oBaseViewWidth = oView.Width
                    'MsgBox("Height: " & oBaseViewHeight & " ; " & "Width:" & oBaseViewWidth)
                End If
                'End If

                If oView.Position.X > oPositionX And oView.Position.Y = oPositionY Then
                    ' MsgBox("Ansicht rechts")
                    'Ansicht rechts
                    Dim oRightViewPosition As Point2d
                    oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                    oRightViewPosition.X = oPositionX + (oBaseViewWidth) + oView.Height / 2 + oAbstand
                    oRightViewPosition.Y = oPositionY
                    oView.Position = oRightViewPosition
                End If

                If oView.Position.X < oPositionX And oView.Position.Y = oPositionY Then
                    ' MsgBox("Ansicht links")
                    'Ansicht links
                    Dim oRightViewPosition As Point2d
                    oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                    oRightViewPosition.X = oPositionX - (oBaseViewWidth) - oView.Height / 2 - oAbstand
                    oRightViewPosition.Y = oPositionY
                    oView.Position = oRightViewPosition
                End If

                If oView.Position.X = oPositionX And oView.Position.Y < oPositionY Then
                    ' MsgBox("Ansicht unten")
                    'Ansicht unten
                    Dim oRightViewPosition As Point2d
                    oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                    oRightViewPosition.X = oPositionX
                    oRightViewPosition.Y = oPositionY - oBaseViewHeight - oView.Height / 2 - oAbstand
                    oView.Position = oRightViewPosition
                End If
..........................

But this works only if there is one projected view per side (left, right ..). Does someone have an idea to fix this?

0 Likes
Message 7 of 18

chandra.shekar.g
Autodesk Support
Autodesk Support

@GeorgK,

 

Are you generating drawing views from start?

 

Hoping that below calculation would help in sizing drawing views.

 

pTmax = ModelDocument.Componentdefintion.RangeBox.MaxPoint
pTmin = ModelDocument.ComponentDefinition.RangeBox.MinPoint

X = pTmax.X - pTmin.X
Y = pTmax.Y - pTmin.Y
Z = pTmax.Z - pTmin.Z

First_Type.png

 

 

 

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 8 of 18

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

I am generating drawing views from start and change them after they are finished.

 

The main problem is if there are more projected views or section views to one side. Do you have an idea to solve this?

0 Likes
Message 9 of 18

chandra.shekar.g
Autodesk Support
Autodesk Support

@GeorgK,

 

Can you please provide existing source code and sample part/assembly to automate drawing generation? I will try to feasible solution. On the other hand, bounding box of projected view and section view may not be accurate.

 

Please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 10 of 18

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

I have several programs do solve this. One for existing drawings and one for new drawings. The Problem is to sort the views and distances to fit on a sheet and that the views don't overlap (ISO views).

 

Dim m_inventorApp As Inventor.Application = Nothing
m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = m_inventorApp.ActiveDocument

Dim oTG As TransientGeometry = m_inventorApp.TransientGeometry

Dim oTrans As Transaction
oTrans = m_inventorApp.TransactionManager.StartTransaction(m_inventorApp.ActiveDocument, "Ansichten verschieben")

Dim ActiveSheet As Sheet
ActiveSheet = oDrawingDoc.ActiveSheet

Dim oView As DrawingView

'###########################


Dim oSheet As Sheet
oSheet = oDrawingDoc.ActiveSheet

Dim oListx As ArrayList = New ArrayList()
Dim oListy As ArrayList = New ArrayList()

For Each oView In oSheet.DrawingViews
	oListx.Add(oView.Position.X)
	oListy.Add(oView.Position.Y)
Next

oListx.Sort()
oListy.Sort()

Dim mid As Integer
mid = (oListy.Count - 1) / 2

Dim midView As DrawingView = Nothing

For Each oView In oSheet.DrawingViews
	If Math.Round(oView.Position.X, 6) = Math.Round(oListx(mid), 6) And Math.Round(oView.Position.Y, 6) = Math.Round(oListy(mid), 6) Then
		midView = oView
		'MsgBox(midView.Name.ToString)
		Exit For
	End If
Next

'################################
Dim oPositionX As Double
Dim oPositionY As Double
Dim oBaseViewHeight As Double
Dim oBaseViewWidth As Double



Dim prompt As String = "Bitte geben Sie den Abstand ein"
Dim title As String = "Abstand zur " & midView.Name
Dim oAbstand As String
' Set prompt.
prompt = "Bitte geben Sie den Abstand ein"
' Set title.
title = "Abstand zur " & midView.Name & " in mm"
' Set default value.
oAbstand = "80"
' Display prompt, title, and default value.
oAbstand = Interaction.InputBox(prompt, title, oAbstand)
If oAbstand = "" Then
	Exit Sub
End If

'Prüfen, ob Zahlen
If oAbstand.All(AddressOf Char.IsDigit) = True Then
	oAbstand = oAbstand / 10
Else
	Exit Sub
End If

For Each oView In ActiveSheet.DrawingViews
	'If oView.ViewType = Inventor.DrawingViewTypeEnum.kStandardDrawingViewType Then
	If oView.Name = midView.Name Then
		oPositionX = oView.Position.X
		oPositionY = oView.Position.Y
		oBaseViewHeight = oView.Height
		oBaseViewWidth = oView.Width                 
	   
	End If
	'End If

	

	Dim oScale As Double

	If oView.Position.X > oPositionX And oView.Position.Y = oPositionY Then
		' MsgBox("Ansicht rechts")
		'Ansicht rechts

		If oView.Scale >= 1 Then
			oScale = oView.Scale
		End If

		If oView.Scale < 1 Then
			oScale = 1 / oView.Scale
		End If

		Dim oRightViewPosition As Point2d
		oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
		oRightViewPosition.X = oPositionX + (oBaseViewWidth) + (oView.Height / 2) + oAbstand * oScale
		oRightViewPosition.Y = oPositionY
		oView.Position = oRightViewPosition
	End If

	If oView.Position.X < oPositionX And oView.Position.Y = oPositionY Then
		' MsgBox("Ansicht links")
		'Ansicht links

		If oView.Scale >= 1 Then
			oScale = oView.Scale
		End If

		If oView.Scale < 1 Then
			oScale = 1 / oView.Scale
		End If

		Dim oRightViewPosition As Point2d
		oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
		oRightViewPosition.X = oPositionX - (oBaseViewWidth) - (oView.Height / 2) - oAbstand * oScale
		oRightViewPosition.Y = oPositionY
		oView.Position = oRightViewPosition
	End If

	If oView.Position.X = oPositionX And oView.Position.Y < oPositionY Then
		' MsgBox("Ansicht unten")
		'Ansicht unten

		If oView.Scale >= 1 Then
			oScale = oView.Scale
		End If

		If oView.Scale < 1 Then
			oScale = 1 / oView.Scale
		End If

		Dim oRightViewPosition As Point2d
		oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
		oRightViewPosition.X = oPositionX
		oRightViewPosition.Y = oPositionY - oBaseViewHeight - (oView.Height / 2) - oAbstand * oScale
		oView.Position = oRightViewPosition
	End If

	If oView.Position.X = oPositionX And oView.Position.Y > oPositionY Then
		' MsgBox("Ansicht oben")
		'Ansicht oben

		If oView.Scale >= 1 Then
			oScale = oView.Scale
		End If

		If oView.Scale < 1 Then
			oScale = 1 / oView.Scale
		End If

		Dim oRightViewPosition As Point2d
		oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
		oRightViewPosition.X = oPositionX
		oRightViewPosition.Y = oPositionY + oBaseViewHeight + (oView.Height / 2) + oAbstand * oScale
		oView.Position = oRightViewPosition
	End If

	If oView.Position.X > oPositionX And oView.Position.Y > oPositionY Then
		' MsgBox("Ansicht ISO rechs oben")
		'Ansicht ISO rechs oben

		If oView.Scale >= 1 Then
			oScale = oView.Scale
		End If

		If oView.Scale < 1 Then
			oScale = 1 / oView.Scale
		End If

		Dim oRightViewPosition As Point2d
		oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
		oRightViewPosition.X = oPositionX + (oBaseViewWidth) + (oView.Height / 2) + oAbstand * oScale
		oRightViewPosition.Y = oPositionY + oBaseViewHeight + (oView.Height / 2) + oAbstand * oScale
		oView.Position = oRightViewPosition
	End If

	If oView.Position.X < oPositionX And oView.Position.Y > oPositionY Then
		' MsgBox("Ansicht ISO links oben")
		'Ansicht ISO links oben

		If oView.Scale >= 1 Then
			oScale = oView.Scale
		End If

		If oView.Scale < 1 Then
			oScale = 1 / oView.Scale
		End If

		Dim oRightViewPosition As Point2d
		oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
		oRightViewPosition.X = oPositionX - (oBaseViewWidth) - (oView.Height / 2) - oAbstand * oScale
		oRightViewPosition.Y = oPositionY + oBaseViewHeight + (oView.Height / 2) + oAbstand * oScale
		oView.Position = oRightViewPosition
	End If

	If oView.Position.X > oPositionX And oView.Position.Y < oPositionY Then
		' MsgBox("Ansicht ISO rechs unten")
		'Ansicht ISO rechs unten

		If oView.Scale >= 1 Then
			oScale = oView.Scale
		End If

		If oView.Scale < 1 Then
			oScale = 1 / oView.Scale
		End If

		Dim oRightViewPosition As Point2d
		oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
		oRightViewPosition.X = oPositionX + (oBaseViewWidth) + (oView.Height / 2) + oAbstand * oScale
		oRightViewPosition.Y = oPositionY - oBaseViewHeight - (oView.Height / 2) - oAbstand * oScale
		oView.Position = oRightViewPosition
	End If

	If oView.Position.X < oPositionX And oView.Position.Y < oPositionY Then
		' MsgBox("Ansicht ISO links unten")
		'Ansicht ISO links unten

		If oView.Scale >= 1 Then
			oScale = oView.Scale
		End If

		If oView.Scale < 1 Then
			oScale = 1 / oView.Scale
		End If

		Dim oRightViewPosition As Point2d
		oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
		oRightViewPosition.X = oPositionX - (oBaseViewWidth) - (oView.Height / 2) - oAbstand * oScale
		oRightViewPosition.Y = oPositionY - oBaseViewHeight - (oView.Height / 2) - oAbstand * oScale
		oView.Position = oRightViewPosition
	End If
Next
oTrans.End()
m_inventorApp.ActiveView.Fit()

Drawing_Views.png

 

The code is working for the yellow marked area, 4 and 5. Not for 1, 2 and 3.

 

Dim m_inventorApp As Inventor.Application = Nothing
        m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")

        Dim oIamDoc As AssemblyDocument
        oIamDoc = m_inventorApp.ActiveDocument

        Dim oCompOcc As ComponentOccurrence
        oCompOcc = m_inventorApp.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Bitte wählen Sie ein Bauteil oder eine Unterbaugruppe")

        If IsNothing(oCompOcc) Then
            Exit Sub
        End If

        Dim oPart As PartDocument
        oPart = oCompOcc.Definition.Document

        ' Create a new drawing document.
        Dim oDoc As DrawingDocument
        'oDoc = m_inventorApp.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, m_inventorApp.FileManager.GetTemplateFile(DocumentTypeEnum.kDrawingDocumentObject))
        oDoc = m_inventorApp.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, "C:\Users\Public\Documents\Autodesk\Inventor 2017\Templates\Norm.idw", True)

        m_inventorApp.SilentOperation = True

        Dim oDrawingDoc As DrawingDocument
        oDrawingDoc = m_inventorApp.ActiveDocument

        Dim oTG As TransientGeometry = m_inventorApp.TransientGeometry
        Dim oSheet As Sheet = oDrawingDoc.ActiveSheet


        m_inventorApp.ActiveDocument.ActiveSheet.Orientation = PageOrientationTypeEnum.kLandscapePageOrientation

        Select Case True
            Case RadioButton_A4.Checked
                oSheet.Size = DrawingSheetSizeEnum.kA4DrawingSheetSize
            Case RadioButton_A3.Checked
                oSheet.Size = DrawingSheetSizeEnum.kA3DrawingSheetSize
            Case RadioButton_A2.Checked
                oSheet.Size = DrawingSheetSizeEnum.kA2DrawingSheetSize
            Case RadioButton_A1.Checked
                oSheet.Size = DrawingSheetSizeEnum.kA1DrawingSheetSize
            Case RadioButton_A0.Checked
                oSheet.Size = DrawingSheetSizeEnum.kA0DrawingSheetSize
        End Select

        m_inventorApp.ActiveView.Fit()

        Dim oFrontViewX As Integer = oSheet.Width / 2 '17
        Dim oFrontViewY As Integer = oSheet.Height / 2 + 1 '13
        Dim oFrontViewScale As Integer = 1


        ' Create the base view.
        Dim oBaseView As DrawingView
        Select Case True
            Case RadioBtn_Verdeckt.Checked
                oBaseView = oSheet.DrawingViews.AddBaseView(oPart, oTG.CreatePoint2d(oFrontViewX, oFrontViewY), oFrontViewScale, ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle) 'Hauptansicht
                ' Create projected views.
                Dim oDownView As DrawingView
                oDownView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX, oFrontViewY - 5), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Unten


                ' Create projected views.
                Dim oRightView As DrawingView
                oRightView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX + 5, oFrontViewY), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Rechts

                ' Create projected views.
                Dim oLeftView As DrawingView
                oLeftView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX - 5, oFrontViewY), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Links

                ' Create Top views.
                Dim oTopView As DrawingView
                oTopView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX, oFrontViewY + 5), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Oben

                ' Create ISO views.
                Dim oIsoView As DrawingView
                oIsoView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX - 9, oFrontViewY + 8), DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle) ' ISO links oben

                '###### Rechts #########
                ' Create a new point to move the baseview to.
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oFrontViewX + (oBaseView.Width / 2) + 3
                oRightViewPosition.Y = oFrontViewY

                'Move the Rightview to the new position
                oRightView.Position = oRightViewPosition
                '/###### Rechts #########

                '###### Links #########
                ' Create a new point to move the baseview to.
                Dim oLeftViewPosition As Point2d
                oLeftViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oLeftViewPosition.X = oFrontViewX - (oBaseView.Width / 2) - 3
                oLeftViewPosition.Y = oFrontViewY

                'Move the LeftView to the new position
                oLeftView.Position = oLeftViewPosition
                '/###### Links #########

                '###### Oben #########
                ' Create a new point to move the baseview to.
                Dim oTopViewPosition As Point2d
                oTopViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oTopViewPosition.X = oFrontViewX
                oTopViewPosition.Y = oFrontViewY + (oBaseView.Height / 2) + 3

                'Move the TopView to the new position
                oTopView.Position = oTopViewPosition
                '/###### Oben #########


                '###### Unten #########
                ' Create a new point to move the baseview to.
                Dim oDownViewPosition As Point2d
                oDownViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oDownViewPosition.X = oFrontViewX
                oDownViewPosition.Y = oFrontViewY - (oBaseView.Height / 2) - 3

                'Move the DownView to the new position
                oDownView.Position = oDownViewPosition
        '/###### Unten #########

            Case RadioBtn_OhneVerdeckte.Checked
                oBaseView = oSheet.DrawingViews.AddBaseView(oPart, oTG.CreatePoint2d(oFrontViewX, oFrontViewY), oFrontViewScale, ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle) 'Hauptansicht
                ' Create projected views.
                Dim oDownView As DrawingView
                oDownView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX, oFrontViewY - 5), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Unten


                ' Create projected views.
                Dim oRightView As DrawingView
                oRightView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX + 5, oFrontViewY), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Rechts

                ' Create projected views.
                Dim oLeftView As DrawingView
                oLeftView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX - 5, oFrontViewY), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Links

                ' Create Top views.
                Dim oTopView As DrawingView
                oTopView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX, oFrontViewY + 5), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Oben

                ' Create ISO views.
                Dim oIsoView As DrawingView
                oIsoView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX - 9, oFrontViewY + 8), DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle) ' ISO links oben

                '###### Rechts #########
                ' Create a new point to move the baseview to.
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oFrontViewX + (oBaseView.Width / 2) + 3
                oRightViewPosition.Y = oFrontViewY

                'Move the Rightview to the new position
                oRightView.Position = oRightViewPosition
                '/###### Rechts #########

                '###### Links #########
                ' Create a new point to move the baseview to.
                Dim oLeftViewPosition As Point2d
                oLeftViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oLeftViewPosition.X = oFrontViewX - (oBaseView.Width / 2) - 3
                oLeftViewPosition.Y = oFrontViewY

                'Move the LeftView to the new position
                oLeftView.Position = oLeftViewPosition
                '/###### Links #########

                '###### Oben #########
                ' Create a new point to move the baseview to.
                Dim oTopViewPosition As Point2d
                oTopViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oTopViewPosition.X = oFrontViewX
                oTopViewPosition.Y = oFrontViewY + (oBaseView.Height / 2) + 3

                'Move the TopView to the new position
                oTopView.Position = oTopViewPosition
                '/###### Oben #########


                '###### Unten #########
                ' Create a new point to move the baseview to.
                Dim oDownViewPosition As Point2d
                oDownViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oDownViewPosition.X = oFrontViewX
                oDownViewPosition.Y = oFrontViewY - (oBaseView.Height / 2) - 3

                'Move the DownView to the new position
                oDownView.Position = oDownViewPosition
        '/###### Unten #########

            Case RadioBtn_Schattiert.Checked
                oBaseView = oSheet.DrawingViews.AddBaseView(oPart, oTG.CreatePoint2d(oFrontViewX, oFrontViewY), oFrontViewScale, ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kShadedDrawingViewStyle) 'Hauptansicht
                ' Create projected views.
                Dim oDownView As DrawingView
                oDownView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX, oFrontViewY - 5), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Unten


                ' Create projected views.
                Dim oRightView As DrawingView
                oRightView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX + 5, oFrontViewY), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Rechts

                ' Create projected views.
                Dim oLeftView As DrawingView
                oLeftView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX - 5, oFrontViewY), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Links

                ' Create Top views.
                Dim oTopView As DrawingView
                oTopView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX, oFrontViewY + 5), DrawingViewStyleEnum.kFromBaseDrawingViewStyle) 'Oben

                ' Create ISO views.
                Dim oIsoView As DrawingView
                oIsoView = oSheet.DrawingViews.AddProjectedView(oBaseView, oTG.CreatePoint2d(oFrontViewX - 9, oFrontViewY + 8), DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle) ' ISO links oben
                '###### Rechts #########
                ' Create a new point to move the baseview to.
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oFrontViewX + (oBaseView.Width / 2) + 3
                oRightViewPosition.Y = oFrontViewY

                'Move the Rightview to the new position
                oRightView.Position = oRightViewPosition
                '/###### Rechts #########

                '###### Links #########
                ' Create a new point to move the baseview to.
                Dim oLeftViewPosition As Point2d
                oLeftViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oLeftViewPosition.X = oFrontViewX - (oBaseView.Width / 2) - 3
                oLeftViewPosition.Y = oFrontViewY

                'Move the LeftView to the new position
                oLeftView.Position = oLeftViewPosition
                '/###### Links #########

                '###### Oben #########
                ' Create a new point to move the baseview to.
                Dim oTopViewPosition As Point2d
                oTopViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oTopViewPosition.X = oFrontViewX
                oTopViewPosition.Y = oFrontViewY + (oBaseView.Height / 2) + 3

                'Move the TopView to the new position
                oTopView.Position = oTopViewPosition
                '/###### Oben #########


                '###### Unten #########
                ' Create a new point to move the baseview to.
                Dim oDownViewPosition As Point2d
                oDownViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oDownViewPosition.X = oFrontViewX
                oDownViewPosition.Y = oFrontViewY - (oBaseView.Height / 2) - 3

                'Move the DownView to the new position
                oDownView.Position = oDownViewPosition
                '/###### Unten #########

        End Select

        '###################
        'SetAutomatedCenterlineSettings
        Dim ViewCount As Integer
        Dim StartCount As Integer

        StartCount = 0

        'number of drawing views
        Dim oviews As DrawingViews
        ViewCount = m_inventorApp.ActiveDocument.ActiveSheet.DrawingViews.count

        'define collection of views objects
        oviews = m_inventorApp.ActiveDocument.ActiveSheet.DrawingViews

        ' Places Centerlines on all of the drawing views
        For StartCount = 1 To ViewCount
            oviews.Item(StartCount).SetAutomatedCenterlineSettings()
        Next

        '###################

        Dim oView As DrawingView

        oviews = oSheet.DrawingViews
        For Each oView In oviews

        Next
        m_inventorApp.SilentOperation = False
Dim mApp As Inventor.Application
        mApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
        Dim oDoc As DrawingDocument
        oDoc = mApp.ActiveDocument

        Dim oSheet As Sheet
        oSheet = oDoc.ActiveSheet

        Dim oListx As ArrayList = New ArrayList()
        Dim oListy As ArrayList = New ArrayList()
        Dim oView As DrawingView
        For Each oView In oSheet.DrawingViews
            oListx.Add(oView.Position.X)
            oListy.Add(oView.Position.Y)
        Next

        oListx.Sort()
        oListy.Sort()

        Dim mid As Integer
        mid = (oListy.Count - 1) / 2

        Dim midView As DrawingView

        For Each oView In oSheet.DrawingViews
            If Math.Round(oView.Position.X, 6) = Math.Round(oListx(mid), 6) And Math.Round(oView.Position.Y, 6) = Math.Round(oListy(mid), 6) Then
                midView = oView
                Exit For
            End If
        Next

        oDoc.SelectSet.Select(midView)

I think this should be added to Inventor. That would be a big time saver.  There is a similar case:

https://forums.autodesk.com/t5/inventor-customization/automatic-scale-and-view-position/td-p/5784680

 

Thank you very much.

Georg

 

0 Likes
Message 11 of 18

GeorgK
Advisor
Advisor
0 Likes
Message 12 of 18

chandra.shekar.g
Autodesk Support
Autodesk Support

@GeorgK,

 

Generation of drawing seems working fine. But rearranging drawing views needs minor changes.

 

After changes, code seems to work for all drawing views. Check the same from your end and let me know result.

 

Private Sub ReArrange_Drawing()
Dim m_inventorApp As Inventor.Application = Nothing
        m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
Dim oDrawingDoc As DrawingDocument oDrawingDoc = m_inventorApp.ActiveDocument Dim oTG As TransientGeometry = m_inventorApp.TransientGeometry Dim oTrans As Transaction oTrans = m_inventorApp.TransactionManager.StartTransaction(m_inventorApp.ActiveDocument, "Ansichten verschieben") Dim ActiveSheet As Sheet ActiveSheet = oDrawingDoc.ActiveSheet Dim oView As DrawingView '########################### Dim oSheet As Sheet oSheet = oDrawingDoc.ActiveSheet Dim oListx As ArrayList = New ArrayList() Dim oListy As ArrayList = New ArrayList() For Each oView In oSheet.DrawingViews oListx.Add(oView.Position.X) oListy.Add(oView.Position.Y) Next oListx.Sort() oListy.Sort() Dim mid As Integer mid = (oListy.Count - 1) / 2 Dim midView As DrawingView = Nothing For Each oView In oSheet.DrawingViews If Math.Round(oView.Position.X, 6) = Math.Round(oListx(mid), 6) And Math.Round(oView.Position.Y, 6) = Math.Round(oListy(mid), 6) Then midView = oView 'MsgBox(midView.Name.ToString) Exit For End If Next '################################ Dim oPositionX As Double Dim oPositionY As Double Dim oBaseViewHeight As Double Dim oBaseViewWidth As Double Dim prompt As String = "Bitte geben Sie den Abstand ein" Dim title As String = "Abstand zur " & midView.Name Dim oAbstand As String ' Set prompt. prompt = "Bitte geben Sie den Abstand ein" ' Set title. title = "Abstand zur " & midView.Name & " in mm" ' Set default value. oAbstand = "80" ' Display prompt, title, and default value. oAbstand = Interaction.InputBox(prompt, title, oAbstand) If oAbstand = "" Then Exit Sub End If 'Prüfen, ob Zahlen If oAbstand.All(AddressOf Char.IsDigit) = True Then oAbstand = oAbstand / 10 Else Exit Sub End If For Each oView In ActiveSheet.DrawingViews 'If oView.ViewType = Inventor.DrawingViewTypeEnum.kStandardDrawingViewType Then If oView.Name = midView.Name Then oPositionX = oView.Position.X oPositionY = oView.Position.Y oBaseViewHeight = oView.Height oBaseViewWidth = oView.Width End If 'End If Dim xRange As Double Dim yRange As Double xRange = Math.Round(oView.Position.X, 2) - Math.Round(oPositionX, 2) yRange = Math.Round(oView.Position.Y, 2) - Math.Round(oPositionY, 2) Dim oScale As Double If oView.Position.X > oPositionX And Math.Round(yRange, 2) < 1 Then ' MsgBox("Ansicht rechts") 'Ansicht rechts If oView.Scale >= 1 Then oScale = oView.Scale End If If oView.Scale < 1 Then oScale = 1 / oView.Scale End If Dim oRightViewPosition As Point2d oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d() oRightViewPosition.X = oView.Position.X + oAbstand oRightViewPosition.Y = oView.Position.Y oView.Position = oRightViewPosition ElseIf oView.Position.X < oPositionX And Math.Round(yRange, 2) < 1 Then ' MsgBox("Ansicht links") 'Ansicht links If oView.Scale >= 1 Then oScale = oView.Scale End If If oView.Scale < 1 Then oScale = 1 / oView.Scale End If Dim oRightViewPosition As Point2d oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d() oRightViewPosition.X = oView.Position.X - oAbstand oRightViewPosition.Y = oView.Position.Y oView.Position = oRightViewPosition ElseIf Math.Round(xRange, 2) < 1 And oView.Position.Y < oPositionY Then ' MsgBox("Ansicht unten") 'Ansicht unten If oView.Scale >= 1 Then oScale = oView.Scale End If If oView.Scale < 1 Then oScale = 1 / oView.Scale End If Dim oRightViewPosition As Point2d oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d() oRightViewPosition.X = oView.Position.X oRightViewPosition.Y = oView.Position.Y - (oAbstand) oView.Position = oRightViewPosition ElseIf Math.Round(xRange, 2) < 1 And oView.Position.Y > oPositionY Then ' MsgBox("Ansicht oben") 'Ansicht oben If oView.Scale >= 1 Then oScale = oView.Scale End If If oView.Scale < 1 Then oScale = 1 / oView.Scale End If Dim oRightViewPosition As Point2d oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d() oRightViewPosition.X = oView.Position.X oRightViewPosition.Y = oView.Position.Y + (oAbstand) oView.Position = oRightViewPosition ElseIf oView.Position.X > oPositionX And oView.Position.Y > oPositionY Then ' MsgBox("Ansicht ISO rechs oben") 'Ansicht ISO rechs oben If oView.Scale >= 1 Then oScale = oView.Scale End If If oView.Scale < 1 Then oScale = 1 / oView.Scale End If Dim oRightViewPosition As Point2d oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d() oRightViewPosition.X = oView.Position.X + (oAbstand) oRightViewPosition.Y = oView.Position.Y + (oAbstand) oView.Position = oRightViewPosition ElseIf oView.Position.X < oPositionX And oView.Position.Y > oPositionY Then ' MsgBox("Ansicht ISO links oben") 'Ansicht ISO links oben If oView.Scale >= 1 Then oScale = oView.Scale End If If oView.Scale < 1 Then oScale = 1 / oView.Scale End If Dim oRightViewPosition As Point2d oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d() oRightViewPosition.X = oView.Position.X - (oAbstand) oRightViewPosition.Y = oView.Position.Y + (oAbstand) oView.Position = oRightViewPosition ElseIf oView.Position.X > oPositionX And oView.Position.Y < oPositionY Then ' MsgBox("Ansicht ISO rechs unten") 'Ansicht ISO rechs unten If oView.Scale >= 1 Then oScale = oView.Scale End If If oView.Scale < 1 Then oScale = 1 / oView.Scale End If Dim oRightViewPosition As Point2d oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d() oRightViewPosition.X = oView.Position.X + (oAbstand) oRightViewPosition.Y = oView.Position.Y - (oAbstand) oView.Position = oRightViewPosition ElseIf oView.Position.X < oPositionX And oView.Position.Y < oPositionY Then ' MsgBox("Ansicht ISO links unten") 'Ansicht ISO links unten If oView.Scale >= 1 Then oScale = oView.Scale End If If oView.Scale < 1 Then oScale = 1 / oView.Scale End If Dim oRightViewPosition As Point2d oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d() oRightViewPosition.X = oView.Position.X - (oAbstand) oRightViewPosition.Y = oView.Position.Y - (oAbstand) oView.Position = oRightViewPosition End If Next oTrans.End() m_inventorApp.ActiveView.Fit() End Sub

Please feel free to contact if there is any queries.

 

If solves problem, click on "Accept as solution" / give a "Like".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 13 of 18

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

Your code increases the distance between the views with each call. However, the distance should be as large as entered. In addition, the distance between the views should be equalized or equal. Therefore different regions / circles have to be defined. My code works for the inner circle. It does not work for the other circles.

Your code works fine, if only the distance should be increased and the arrangement should remain the same. But I need a function to increase or decrease the distance.

 

Views.pngThank you for your help

 

Georg

0 Likes
Message 14 of 18

HermJan.Otterman
Advisor
Advisor

verry nice!, but just to think things through... do you realy need the exact scale of f.e. 1:2 ...??

do you print these drawings 1 tot 1....? if not (what I see 99 of 100 times) the printed version will not be on scale..

so if the printed version is not on scale, you can use any scale in your drawing, and makes coding it easier...

it was just a thought.....

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 15 of 18

chandra.shekar.g
Autodesk Support
Autodesk Support

@GeorgK,

 

Decreasing distance between views is similar to Increasing distance. messagebox is created to read option either to increase or decrease distance. Below code would help to increase or decrease the same.

 

Private Sub ReArrange_Drawing()
        Dim oDrawingDoc As DrawingDocument
        oDrawingDoc = m_inventorApp.ActiveDocument

        Dim oTG As TransientGeometry = m_inventorApp.TransientGeometry

        Dim oTrans As Transaction
        oTrans = m_inventorApp.TransactionManager.StartTransaction(m_inventorApp.ActiveDocument, "Ansichten verschieben")

        Dim ActiveSheet As Sheet
        ActiveSheet = oDrawingDoc.ActiveSheet

        Dim oView As DrawingView

        '###########################


        Dim oSheet As Sheet
        oSheet = oDrawingDoc.ActiveSheet

        Dim oListx As ArrayList = New ArrayList()
        Dim oListy As ArrayList = New ArrayList()

        For Each oView In oSheet.DrawingViews
            oListx.Add(oView.Position.X)
            oListy.Add(oView.Position.Y)
        Next

        oListx.Sort()
        oListy.Sort()

        Dim mid As Integer
        mid = (oListy.Count - 1) / 2

        Dim midView As DrawingView = Nothing

        For Each oView In oSheet.DrawingViews
            If Math.Round(oView.Position.X, 6) = Math.Round(oListx(mid), 6) And Math.Round(oView.Position.Y, 6) = Math.Round(oListy(mid), 6) Then
                midView = oView
                'MsgBox(midView.Name.ToString)
                Exit For
            End If
        Next

        '################################
        Dim oPositionX As Double
        Dim oPositionY As Double
        Dim oBaseViewHeight As Double
        Dim oBaseViewWidth As Double



        Dim prompt As String = "Bitte geben Sie den Abstand ein"
        Dim title As String = "Abstand zur " & midView.Name
        Dim oAbstand As String
        ' Set prompt.
        prompt = "Bitte geben Sie den Abstand ein"
        ' Set title.
        title = "Abstand zur " & midView.Name & " in mm"
        ' Set default value.
        oAbstand = "80"
        ' Display prompt, title, and default value.
        oAbstand = Interaction.InputBox(prompt, title, oAbstand)
        If oAbstand = "" Then
            Exit Sub
        End If

        'Prüfen, ob Zahlen
        If oAbstand.All(AddressOf Char.IsDigit) = True Then
            oAbstand = oAbstand / 10
        Else
            Exit Sub
        End If

        Dim oResult As DialogResult
        oResult = MessageBox.Show("Increasing(Yes) or Decreasing (No)", "Increasing/Decreasing", MessageBoxButtons.YesNo)

        If oResult = DialogResult.No Then
            oAbstand = oAbstand * (-1)
        End If

        For Each oView In ActiveSheet.DrawingViews
            'If oView.ViewType = Inventor.DrawingViewTypeEnum.kStandardDrawingViewType Then
            If oView.Name = midView.Name Then
                oPositionX = oView.Position.X
                oPositionY = oView.Position.Y
                oBaseViewHeight = oView.Height
                oBaseViewWidth = oView.Width

            End If
            'End If

            Dim xRange As Double
            Dim yRange As Double
            xRange = Math.Round(oView.Position.X, 2) - Math.Round(oPositionX, 2)
            yRange = Math.Round(oView.Position.Y, 2) - Math.Round(oPositionY, 2)

            Dim oScale As Double

            If oView.Position.X > oPositionX And Math.Round(yRange, 2) < 1 Then
                ' MsgBox("Ansicht rechts")
                'Ansicht rechts

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If

                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oView.Position.X + oAbstand
                oRightViewPosition.Y = oView.Position.Y
                oView.Position = oRightViewPosition


            ElseIf oView.Position.X < oPositionX And Math.Round(yRange, 2) < 1 Then
                ' MsgBox("Ansicht links")
                'Ansicht links

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If

                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oView.Position.X - oAbstand
                oRightViewPosition.Y = oView.Position.Y
                oView.Position = oRightViewPosition
            ElseIf Math.Round(xRange, 2) < 1 And oView.Position.Y < oPositionY Then
                ' MsgBox("Ansicht unten")
                'Ansicht unten

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If

                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oView.Position.X
                oRightViewPosition.Y = oView.Position.Y - (oAbstand)
                oView.Position = oRightViewPosition
            ElseIf Math.Round(xRange, 2) < 1 And oView.Position.Y > oPositionY Then
                ' MsgBox("Ansicht oben")
                'Ansicht oben

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If

                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oView.Position.X
                oRightViewPosition.Y = oView.Position.Y + (oAbstand)
                oView.Position = oRightViewPosition
            ElseIf oView.Position.X > oPositionX And oView.Position.Y > oPositionY Then
                ' MsgBox("Ansicht ISO rechs oben")
                'Ansicht ISO rechs oben

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If

                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oView.Position.X + (oAbstand)
                oRightViewPosition.Y = oView.Position.Y + (oAbstand)
                oView.Position = oRightViewPosition
            ElseIf oView.Position.X < oPositionX And oView.Position.Y > oPositionY Then
                ' MsgBox("Ansicht ISO links oben")
                'Ansicht ISO links oben

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If

                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oView.Position.X - (oAbstand)
                oRightViewPosition.Y = oView.Position.Y + (oAbstand)
                oView.Position = oRightViewPosition
            ElseIf oView.Position.X > oPositionX And oView.Position.Y < oPositionY Then
                ' MsgBox("Ansicht ISO rechs unten")
                'Ansicht ISO rechs unten

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If

                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oView.Position.X + (oAbstand)
                oRightViewPosition.Y = oView.Position.Y - (oAbstand)
                oView.Position = oRightViewPosition
            ElseIf oView.Position.X < oPositionX And oView.Position.Y < oPositionY Then
                ' MsgBox("Ansicht ISO links unten")
                'Ansicht ISO links unten

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If

                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oView.Position.X - (oAbstand)
                oRightViewPosition.Y = oView.Position.Y - (oAbstand)
                oView.Position = oRightViewPosition
            End If
        Next
        oTrans.End()
        m_inventorApp.ActiveView.Fit()
    End Sub

Please feel free to contact if there is any queries.

 

If solves problem, click on "Accept as solution" / give a "Like".

 

Thanks and regards,

 

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 16 of 18

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

your code does not adjust the distance between each view. I did some tests with this code:

 

Dim m_inventorApp As Inventor.Application = Nothing
        m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")

        Dim oDrawingDoc As DrawingDocument
        oDrawingDoc = m_inventorApp.ActiveDocument

        Dim oTG As TransientGeometry = m_inventorApp.TransientGeometry

        Dim oTrans As Transaction
        oTrans = m_inventorApp.TransactionManager.StartTransaction(m_inventorApp.ActiveDocument, "Ansichten verschieben")

        Dim ActiveSheet As Sheet
        ActiveSheet = oDrawingDoc.ActiveSheet

        Dim oView As DrawingView
        Dim oSheet As Sheet
        oSheet = oDrawingDoc.ActiveSheet

        Dim oListx As ArrayList = New ArrayList()
        Dim oListy As ArrayList = New ArrayList()

        For Each oView In oSheet.DrawingViews
            oListx.Add(oView.Position.X)
            oListy.Add(oView.Position.Y)
        Next

        oListx.Sort()
        oListy.Sort()

        Dim mid As Integer
        mid = (oListy.Count - 1) / 2

        Dim midView As DrawingView = Nothing

        For Each oView In oSheet.DrawingViews
            If Math.Round(oView.Position.X, 6) = Math.Round(oListx(mid), 6) And Math.Round(oView.Position.Y, 6) = Math.Round(oListy(mid), 6) Then
                midView = oView
                'MsgBox(midView.Name.ToString)
                Exit For
            End If
        Next

        Dim oPositionX As Double
        Dim oPositionY As Double
        Dim oBaseViewHeight As Double
        Dim oBaseViewWidth As Double

        Dim prompt As String = "Bitte geben Sie den Abstand ein"
        Dim title As String = "Abstand zur " & midView.Name
        Dim oAbstand As String
        ' Set prompt.
        prompt = "Bitte geben Sie den Abstand ein"
        ' Set title.
        title = "Abstand zur " & midView.Name & " in mm"
        ' Set default value.
        oAbstand = "10"
        ' Display prompt, title, and default value.
        oAbstand = Interaction.InputBox(prompt, title, oAbstand)
        If oAbstand = "" Then
            Exit Sub
        End If

        'Prüfen, ob Zahlen
        If oAbstand.All(AddressOf Char.IsDigit) = True Then
            oAbstand = oAbstand / 10
        Else
            Exit Sub
        End If

        Dim valuesRE As New List(Of Tuple(Of String, Double, Double, Double, Double)) 'Name, x-Wert, Y-Wert, Breite, Höhe
        Dim valuesLI As New List(Of Tuple(Of String, Double, Double, Double, Double))
        Dim valuesU As New List(Of Tuple(Of String, Double, Double, Double, Double))
        Dim valuesO As New List(Of Tuple(Of String, Double, Double, Double, Double))
        Dim values_ISO_Re_O As New List(Of Tuple(Of String, Double, Double, Double, Double))
        Dim values_ISO_Li_O As New List(Of Tuple(Of String, Double, Double, Double, Double))
        Dim values_ISO_Re_U As New List(Of Tuple(Of String, Double, Double, Double, Double))
        Dim values_ISO_Li_U As New List(Of Tuple(Of String, Double, Double, Double, Double))

        For Each oView In ActiveSheet.DrawingViews
            If oView.Name = midView.Name Then
                oPositionX = oView.Position.X
                oPositionY = oView.Position.Y

                oBaseViewHeight = oView.Height
                oBaseViewWidth = oView.Width
            End If

            If oView.Position.X > oPositionX And oView.Position.Y = oPositionY Then 'Ansicht rechts
                Console.WriteLine(oView.Position.X & " ; " & oView.Position.Y)
                valuesRE.Add(Tuple.Create(oView.Name, oView.Position.X, oView.Position.Y, oView.Width, oView.Height))
            ElseIf oView.Position.X < oPositionX And oView.Position.Y = oPositionY Then 'Ansicht links
                Console.WriteLine(oView.Position.X & " ; " & oView.Position.Y)
                valuesLI.Add(Tuple.Create(oView.Name, oView.Position.X, oView.Position.Y, oView.Width, oView.Height))
            ElseIf oView.Position.X = oPositionX And oView.Position.Y < oPositionY Then 'Ansicht unten
                Console.WriteLine(oView.Position.X & " ; " & oView.Position.Y)
                valuesU.Add(Tuple.Create(oView.Name, oView.Position.X, oView.Position.Y, oView.Width, oView.Height))
            ElseIf oView.Position.X = oPositionX And oView.Position.Y > oPositionY Then 'Ansicht oben
                Console.WriteLine(oView.Position.X & " ; " & oView.Position.Y)
                valuesO.Add(Tuple.Create(oView.Name, oView.Position.X, oView.Position.Y, oView.Width, oView.Height))
            ElseIf oView.Position.X > oPositionX And oView.Position.Y > oPositionY Then 'Ansicht ISO rechs oben
                Console.WriteLine(oView.Position.X & " ; " & oView.Position.Y)
                values_ISO_Re_O.Add(Tuple.Create(oView.Name, oView.Position.X, oView.Position.Y, oView.Width, oView.Height))
            ElseIf oView.Position.X < oPositionX And oView.Position.Y > oPositionY Then 'Ansicht ISO links oben
                Console.WriteLine(oView.Position.X & " ; " & oView.Position.Y)
                values_ISO_Li_O.Add(Tuple.Create(oView.Name, oView.Position.X, oView.Position.Y, oView.Width, oView.Height))
            ElseIf oView.Position.X > oPositionX And oView.Position.Y < oPositionY Then 'Ansicht ISO rechs unten
                Console.WriteLine(oView.Position.X & " ; " & oView.Position.Y)
                values_ISO_Re_U.Add(Tuple.Create(oView.Name, oView.Position.X, oView.Position.Y, oView.Width, oView.Height))
            ElseIf oView.Position.X < oPositionX And oView.Position.Y < oPositionY Then 'Ansicht ISO links unten
                Console.WriteLine(oView.Position.X & " ; " & oView.Position.Y)
                values_ISO_Li_U.Add(Tuple.Create(oView.Name, oView.Position.X, oView.Position.Y, oView.Width, oView.Height))
            End If
        Next

        valuesRE = valuesRE.OrderBy(Function(i) i.Item2).ToList
        valuesLI = valuesLI.OrderBy(Function(i) i.Item2).ToList

        Dim oScale As Double
        Dim oRightViewPosition As Point2d = Nothing
        Dim oRightViewPosition1 As Point2d = Nothing
        Dim oRightViewPosition2 As Point2d = Nothing

        Dim oLeftViewPosition As Point2d = Nothing
        Dim oLeftViewPosition1 As Point2d = Nothing
        Dim oLeftViewPosition2 As Point2d = Nothing

        Dim oWidth As Double
        Dim oWidth1 As Double

        Dim oWidth_LI As Double
        Dim oWidth1_LI As Double


        Dim ii_RE As Integer = 1
        Dim ii_Li As Integer = 1

        For Each tpl_Re As Tuple(Of String, Double, Double, Double, Double) In valuesRE
            Console.WriteLine(tpl_Re.Item1 & "-" & tpl_Re.Item2 & "-" & tpl_Re.Item3 & "-" & tpl_Re.Item4 & "-" & tpl_Re.Item5)

            For Each oView In ActiveSheet.DrawingViews
                If tpl_Re.Item1 = oView.Name Then
                    If oView.Scale >= 1 Then
                        oScale = oView.Scale
                    End If

                    If oView.Scale < 1 Then
                        oScale = 1 / oView.Scale
                    End If

                    If ii_RE = 1 Then
                        oWidth = tpl_Re.Item4

                        oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                        oRightViewPosition.X = oPositionX + (oBaseViewWidth) + (tpl_Re.Item5 / 2) + (oAbstand * oScale)
                        oRightViewPosition.Y = oPositionY

                        oView.Position = oRightViewPosition
                    ElseIf ii_RE = 2 Then
                        oWidth = tpl_Re.Item4

                        oRightViewPosition1 = m_inventorApp.TransientGeometry.CreatePoint2d()
                        oRightViewPosition1.X = oRightViewPosition.X + (tpl_Re.Item4) + (oAbstand * oScale)
                        oRightViewPosition1.Y = oPositionY

                        oView.Position = oRightViewPosition1
                    ElseIf ii_RE = 3 Then
                        oWidth1 = tpl_Re.Item4

                        oRightViewPosition2 = m_inventorApp.TransientGeometry.CreatePoint2d()
                        oRightViewPosition2.X = oRightViewPosition1.X + (tpl_Re.Item4) + (oAbstand * oScale)
                        oRightViewPosition2.Y = oPositionY

                        oView.Position = oRightViewPosition2
                    End If
                End If
            Next
            ii_RE = ii_RE + 1
            Console.WriteLine(ii_RE.ToString)
        Next

        For Each tpl_Li As Tuple(Of String, Double, Double, Double, Double) In valuesLI
            Console.WriteLine(tpl_Li.Item1 & "-" & tpl_Li.Item2 & "-" & tpl_Li.Item3 & "-" & tpl_Li.Item4 & "-" & tpl_Li.Item5)

            For Each oView In ActiveSheet.DrawingViews
                If tpl_Li.Item1 = oView.Name Then
                    If oView.Scale >= 1 Then
                        oScale = oView.Scale
                    End If

                    If oView.Scale < 1 Then
                        oScale = 1 / oView.Scale
                    End If

                    If ii_Li = 1 Then
                        oWidth_LI = tpl_Li.Item4

                        oLeftViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                        oLeftViewPosition.X = oPositionX - (oBaseViewWidth) - (tpl_Li.Item4) - (oAbstand * oScale)
                        oLeftViewPosition.Y = oPositionY

                        oView.Position = oLeftViewPosition
                    ElseIf ii_Li = 2 Then
                        oWidth_LI = tpl_Li.Item4

                        oLeftViewPosition1 = m_inventorApp.TransientGeometry.CreatePoint2d()
                        oLeftViewPosition1.X = oLeftViewPosition.X - (tpl_Li.Item4) - (oAbstand * oScale)
                        oLeftViewPosition1.Y = oPositionY

                        oView.Position = oLeftViewPosition1
                    ElseIf ii_Li = 3 Then
                        oWidth1_LI = tpl_Li.Item4

                        oLeftViewPosition2 = m_inventorApp.TransientGeometry.CreatePoint2d()
                        oLeftViewPosition2.X = oLeftViewPosition1.X - (tpl_Li.Item4) - (oAbstand * oScale)
                        oLeftViewPosition2.Y = oPositionY

                        oView.Position = oLeftViewPosition2
                    End If
                End If
            Next
            ii_Li = ii_Li + 1
            Console.WriteLine(ii_Li.ToString)
        Next
        oTrans.End()
        m_inventorApp.ActiveView.Fit()

Do you think it could be improved?

 

Thank you Georg

 

 

0 Likes
Message 17 of 18

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@GeorgK,

 

My apologies for late reply,

 

Try below VB.net code to place equidistance between views.

 

Private Sub ReArrange_Drawing()
        Dim m_inventorApp As Inventor.Application
        m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")

        Dim oDrawingDoc As DrawingDocument
        oDrawingDoc = m_inventorApp.ActiveDocument

        Dim oTG As TransientGeometry = m_inventorApp.TransientGeometry

        Dim oTrans As Transaction
        oTrans = m_inventorApp.TransactionManager.StartTransaction(m_inventorApp.ActiveDocument, "Ansichten verschieben")

        Dim ActiveSheet As Sheet
        ActiveSheet = oDrawingDoc.ActiveSheet

        Dim oView As DrawingView

        '###########################


        Dim oSheet As Sheet
        oSheet = oDrawingDoc.ActiveSheet

        Dim oListx As ArrayList = New ArrayList()
        Dim oListy As ArrayList = New ArrayList()

        For Each oView In oSheet.DrawingViews
            oListx.Add(oView.Position.X)
            oListy.Add(oView.Position.Y)
        Next

        oListx.Sort()
        oListy.Sort()

        Dim mid As Integer
        mid = (oListy.Count - 1) / 2

        Dim midView As DrawingView = Nothing

        For Each oView In oSheet.DrawingViews
            If Math.Round(oView.Position.X, 6) = Math.Round(oListx(mid), 6) And Math.Round(oView.Position.Y, 6) = Math.Round(oListy(mid), 6) Then
                midView = oView
                'MsgBox(midView.Name.ToString)
                Exit For
            End If
        Next

        '################################
        Dim oPositionX As Double
        Dim oPositionY As Double
        Dim oBaseViewHeight As Double
        Dim oBaseViewWidth As Double



        Dim prompt As String = "Bitte geben Sie den Abstand ein"
        Dim title As String = "Abstand zur " & midView.Name
        Dim oAbstand As String
        ' Set prompt.
        prompt = "Bitte geben Sie den Abstand ein"
        ' Set title.
        title = "Abstand zur " & midView.Name & " in mm"
        ' Set default value.
        oAbstand = "80"
        ' Display prompt, title, and default value.
        oAbstand = Interaction.InputBox(prompt, title, oAbstand)
        If oAbstand = "" Then
            Exit Sub
        End If

        'Prüfen, ob Zahlen
        If oAbstand.All(AddressOf Char.IsDigit) = True Then
            oAbstand = oAbstand / 10
        Else
            Exit Sub
        End If

        Dim oResult As DialogResult
        oResult = MessageBox.Show("Increasing(Yes) or Decreasing (No)", "Increasing/Decreasing", MessageBoxButtons.YesNo)

        If oResult = DialogResult.No Then
            oAbstand = oAbstand * (-1)
        End If

        Dim inc_1 As Double = 1
        Dim inc_2 As Double = 1
        Dim inc_3 As Double = 1
        Dim inc_4 As Double = 1
        Dim inc_5 As Double = 1
        Dim inc_6 As Double = 1
        Dim inc_7 As Double = 1
        Dim inc_8 As Double = 1
        Dim dist As Double

        For Each oView In ActiveSheet.DrawingViews
            'If oView.ViewType = Inventor.DrawingViewTypeEnum.kStandardDrawingViewType Then
            If oView.Name = midView.Name Then
                oPositionX = oView.Position.X
                oPositionY = oView.Position.Y
                oBaseViewHeight = oView.Height / 2
                oBaseViewWidth = oView.Width / 2

            End If
            'End If

            Dim xRange As Double
            Dim yRange As Double
            xRange = Math.Abs(Math.Round(oView.Position.X, 2) - Math.Round(oPositionX, 2))
            yRange = Math.Abs(Math.Round(oView.Position.Y, 2) - Math.Round(oPositionY, 2))

            Dim oScale As Double

            If oView.Position.X > oPositionX And Math.Round(yRange, 2) < 1 Then
                ' MsgBox("Ansicht rechts")
                'Ansicht rechts

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If

                dist = oAbstand * inc_1
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oPositionX + dist + oBaseViewWidth
                oRightViewPosition.Y = oPositionY
                oView.Position = oRightViewPosition

                inc_1 = inc_1 + 1
            ElseIf oView.Position.X < oPositionX And Math.Round(yRange, 2) < 1 Then
                ' MsgBox("Ansicht links")
                'Ansicht links

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If
                dist = oAbstand * inc_2
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oPositionX - dist - oBaseViewWidth
                oRightViewPosition.Y = oPositionY
                oView.Position = oRightViewPosition
                inc_2 = inc_2 + 1
            ElseIf Math.Round(xRange, 2) < 1 And oView.Position.Y < oPositionY Then
                ' MsgBox("Ansicht unten")
                'Ansicht unten

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If
                dist = oAbstand * inc_3
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oPositionX
                oRightViewPosition.Y = oPositionY - dist - oBaseViewHeight
                oView.Position = oRightViewPosition
                inc_3 = inc_3 + 1
            ElseIf Math.Round(xRange, 2) < 1 And oView.Position.Y > oPositionY Then
                ' MsgBox("Ansicht oben")
                'Ansicht oben

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If
                dist = oAbstand * inc_4
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oPositionX
                oRightViewPosition.Y = oPositionY + dist + oBaseViewHeight
                oView.Position = oRightViewPosition

                inc_4 = inc_4 + 1
            ElseIf oView.Position.X > oPositionX And oView.Position.Y > oPositionY Then
                ' MsgBox("Ansicht ISO rechs oben")
                'Ansicht ISO rechs oben

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If
                dist = oAbstand * inc_5
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oPositionX + dist + oBaseViewWidth
                oRightViewPosition.Y = oPositionY + oAbstand + oBaseViewHeight
                oView.Position = oRightViewPosition
                inc_5 = inc_5 + 1
            ElseIf oView.Position.X < oPositionX And oView.Position.Y > oPositionY Then
                ' MsgBox("Ansicht ISO links oben")
                'Ansicht ISO links oben

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If

                dist = oAbstand * inc_6
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oPositionX - dist - oBaseViewWidth
                oRightViewPosition.Y = oPositionY + oAbstand + oBaseViewHeight
                oView.Position = oRightViewPosition
                inc_6 = inc_6 + 1
            ElseIf oView.Position.X > oPositionX And oView.Position.Y < oPositionY Then
                ' MsgBox("Ansicht ISO rechs unten")
                'Ansicht ISO rechs unten

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If
                dist = oAbstand * inc_7
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oPositionX + dist + oBaseViewWidth
                oRightViewPosition.Y = oPositionY - oAbstand - oBaseViewHeight
                oView.Position = oRightViewPosition
                inc_7 = inc_7 + 1
            ElseIf oView.Position.X < oPositionX And oView.Position.Y < oPositionY Then
                ' MsgBox("Ansicht ISO links unten")
                'Ansicht ISO links unten

                If oView.Scale >= 1 Then
                    oScale = oView.Scale
                End If

                If oView.Scale < 1 Then
                    oScale = 1 / oView.Scale
                End If
                dist = oAbstand * inc_8
                Dim oRightViewPosition As Point2d
                oRightViewPosition = m_inventorApp.TransientGeometry.CreatePoint2d()
                oRightViewPosition.X = oPositionX - dist - oBaseViewWidth
                oRightViewPosition.Y = oPositionY - oAbstand - oBaseViewHeight
                oView.Position = oRightViewPosition
                inc_8 = inc_8 + 1
            End If
        Next
        oTrans.End()
        m_inventorApp.ActiveView.Fit()
    End Sub

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 18 of 18

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

great. That rocks. Thank you very much. I almost finished my app.

 

Georg

0 Likes